CSC/ECE 517 Spring 2014/ch1a 1c yj: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
Line 119: Line 119:
: One of the most generally accepted problem of play framework is the lack of the backward compatibility. For now, play 2.x is not compatible with play 1.x, which is also a potential concern for the web developer who want to keep the framework updated in the future.<ref>http://www.javacodegeeks.com/2013/09/the-pros-and-cons-of-play-and-grails-java-framework.html</ref>
: One of the most generally accepted problem of play framework is the lack of the backward compatibility. For now, play 2.x is not compatible with play 1.x, which is also a potential concern for the web developer who want to keep the framework updated in the future.<ref>http://www.javacodegeeks.com/2013/09/the-pros-and-cons-of-play-and-grails-java-framework.html</ref>


== Hyperlinks to important terms ==
= Feature-based Comparison on Web Frameworks=
= Feature-based Comparison on Web Frameworks=
{| {{table}}
{| {{table}}

Revision as of 01:42, 11 February 2014

Background

In such internet age, web applications had been highly valued by programmers on the Web. To help those who aimed to utilize the design patterns to produce a maintainable, readable, and high quality code, many object-oriented web frameworks has been released public that allow enthusiastic programmers to take advantage of the well-built developing environment.

You may already see several examples from other chapters(here, here, and here), but today, we are going to deliver several further details on each, based on their strength and weakness, and make a comparision to make the decision on choosing the best object-oriented web frameworks being easier.

Frameworks

As there are tons of object-oriented web frameworks can be found online, we will need to limit only four of the most famous web frameworks we consider will be discussed today.

Ruby on Rails

  • First created: 2003 by David Heinemeier Hansson <ref>http://rubyonrails.org/</ref>
  • Current Developer: Rails Core Team
  • Current version: 4.0.2 and 3.2.16
  • Licence: Rails under the MIT license. Ruby under the Ruby License.

Ruby on Rails has been one of the most popular web app frameworks on Ruby <ref>https://www.ruby-toolbox.com/categories/web_app_frameworks</ref>, Some of the famous applications built with Rails can be Twitter and Github.

Strength

Faster development
Many people say Ruby on Rails helps developers being productive. People even developed a survey to proof such claim is true. <ref>http://martinfowler.com/articles/rubyAtThoughtWorks.html#IsRubyMoreProductive</ref> Forgoing the runtime performance, ruby comes with the interpreter and support of MVC design, that help the developer minimize any repeating code, and maximize the scalability of web application .
More readable code thanks to Ruby
It may be hard to say if this is one of the strengths of rails, because readability is the advantage for every frameworks developed on Ruby. It still worth to compare with the frameworks which are developed on languages other than Ruby.
A code in Ruby <ref>http://www.slideshare.net/dosire/when-to-use-ruby-on-rails-1308900#</ref>

 describe Bowling do
   before(:each) do
       @bowling = Bowling.new
   end
   it "should score 0 for gutter game" do
       20.times { @bowling.hit(0) }
       @bowling.score.should = 0
   end
 end

Will look like this in PHP

Class NewBowlingGame extends PHPSpec_Context
 {
  private $_bowling = null;
  public function before()
  {
       $this->_bowling = new Bowling;
  }
  public function itShouldScore0ForGutterGame()
  {
       for ($i=1; $i<=20; $i++) {
       $this->_bowling->hit(0);
       $this->spec($this->_bowling->score)->should->equal(0);
       }
  }
}

Weakness

Run relatively slow
Since Ruby on Rails designed to optimize the development speed and readability, such optimization sacrificed the runtime speed on web applications that was written in rails. In fact, according to performance comparison result published online, the performance of rails on JSON serialization, single query, multiple queries, fortunes, data updates and plain text, are way far from the top tier of all of the frameworks. <ref>http://www.techempower.com/benchmarks/</ref>
Unique way of thinking
Ruby is a smart language, so as Ruby on Rails. Most of the works on rails seems to be more than straight forward, as well as readable. However, the more people focus on rails, the more they are far from the effort behind. There are more and more frameworks that were inspired by rails, but most of the long-existed large scale works are built based on a traditional way. For most of the times, the way of thinking in Ruby on Rails is not adaptable to other languages, especially for those frameworks that are considered more "enterprise-based".

CakePHP

Inspired on the Ruby on Rails project and using many of the same concepts, it’s called this way because it was written based on a minimal version of a Rapid Application Framework in PHP. CakePHP is licensed and distributed under the MIT license, and provides an extensible architecture for development of web applications.

The slogan of CakePHP is to “CakePHP makes building web applications simpler, faster and require less code.” [2] Started from 2005, CakePHP has been praised for its security, flexibility, and the support of good MVC convention.

Strengths

Framework is completely open source
Speed
Scalability
Security built-in tools

Weakness

Inability to create tables based on the definition model.
No admin interface

Django

This is a high level Python Web framework for rapid development on the Web in an easy way. It mainly focus on the DRY (Don't Repeat Yourself) Principle[7], and it provides several free API’s to handle database-abstraction. According to the documentation, a typical workflow is to get the site as fast as possible, populate the data (as in a content management publishing), to finally develop the data in the same way is presented to the public.

Strength: Easy and fast to learn. Free database access API’s Wide range of reusable apps

Weakness: Terminology. In a MVC framework, the Controller is called “View” and the View is called “template” Some would say that is not big customizable.

Play!

Written in Scala and Java, Play Framework is another choice for Java lovers that was developed based on open source, following the MVC model pattern, and is also inspired on Ruby on Rails and Django. Famous websites built with Play! are LinkedIn, coursera, etc. Play! call itself as “The High Velocity Web Framework For Java and Scala” <ref>http://www.playframework.com/</ref>.

Strength

Simplified development cycle due to full-stack
play framework comes with almost everything that a web application will need for development, which minimize the waste of time on setup for the framework and looking for additional libraries during the development cycle. It comes with compiler, web server, in-memory DB server, offline documentation, integrated database manager, local and distributed cache management, fixtures, evolutions, dependency management, lots of utility libraries, unit tests, selenium tests, functional tests, and great IDE support (because it's Java!).
Provide built-in frameworks for unit testing and functional testing. Allow use to mock a whole application for testing reason
As every Java lovers got used to, play utilizes JUnit for unit testing and functional testing. Play is also famous for its unique way that approaches testing. It makes use of JavaTest with FakeAplication to allow developer to spin up a real version of "fake application" with an in-memory database. Moreover, it has a good default for selenium test for black box testing to produce reproducible tests for use cases. They also provide a decent interface to give a overview for the written tests. <ref>http://zeroturnaround.com/rebellabs/the-2014-decision-makers-guide-to-java-web-frameworks</ref>

Weakness

Simple at first, but get complicated when trying to take full advantage <ref name="javacompare">http://zeroturnaround.com/rebellabs/the-curious-coders-java-web-frameworks-comparison-spring-mvc-grails-vaadin-gwt-wicket-play-struts-and-jsf/11/#!/</ref>
Like other frameworks, it is easy to get a simple web application built with play framework to get off the ground. Play wants to provide the whole ecosystem, which is way more than a mere framework. They provide a lot of features that are really convenient to develop a web application one in all, but in some case, it is required to research into the Scala when necessary.
Significant learning curve when integrating it with any existing build tools and environment. <ref name="javacompare" />
As mentioned above, play actually provide a well-built ecosystem, but rather than a mere framework. Swapping or migrating the existed items in the infrastructure may not be working well. Even if it is in Java, it did not take advantage of the flexibility and robustness of Java.
Lack of backward compatibility
One of the most generally accepted problem of play framework is the lack of the backward compatibility. For now, play 2.x is not compatible with play 1.x, which is also a potential concern for the web developer who want to keep the framework updated in the future.<ref>http://www.javacodegeeks.com/2013/09/the-pros-and-cons-of-play-and-grails-java-framework.html</ref>

Feature-based Comparison on Web Frameworks

Feature-based Comparison on Web Frameworks <ref>http://en.wikipedia.org/wiki/Comparison_of_web_application_frameworks</ref>
Project Language Ajax MVC framework MVC push-pull Testing framework(s) DB migration framework(s) Security framework(s) Template framework(s) Caching framework(s) Form validation framework(s) Scaffolding
Ruby on Rails Ruby Prototype, script.aculo.us, jQuery Yes (ActiveRecord, Action Pack) Push Unit Tests, Functional Tests and Integration Tests Yes Plug-in Yes Yes Yes Yes
CakePHP PHP >= 5.2 Prototype, script.aculo.us, jQuery, MooTools Yes Push Unit tests, object mocking, fixtures, code coverage, memory analysis with SimpleTest and XDebug PHPUnit (cakephp 2.0) Yes, CakePHP Schema Shell by default, and some others ACL-based Themes, layouts, views, elements Memcache, Redis, XCache, APC, File Validation, security Yes
Django Python Yes Yes Push unittest, test client, LiveServerTestCase Provided by South(http://south.aeracode.org/), Django Evolution ACL-based Django Template Language Cache Framework Django Forms API No, not by default
Play Scala/Java Yes Yes Push-pull Unit test, Functional test, Selenium Yes, similar to Ruby on Rails via Core Security module Yes Yes Server-side validation Yes

References

<references/>