CSC/ECE 517 Fall 2014/ch1a 4 lf: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
Line 39: Line 39:
         {|class="wikitable" border="1"  cellpadding="4"  cellspacing="4"
         {|class="wikitable" border="1"  cellpadding="4"  cellspacing="4"
         | JAVA
         | JAVA
        | SCALA
        |-
| public class Person {<br />
| public class Person {<br />
private int _age;<br />
private int _age;<br />

Revision as of 18:29, 14 September 2014

Lift is a web application framework designed for Scala Programming Language. It was designed by David Polka who was dissatisfied with Ruby on Rails. It was launched on February 26, in 2007 as an Open Source framework under the Apache 2.0 License.

Background

Scala

Scala stands for "Scalable Language". The Scala programming language can be used for making general software application, or for web development. Scala is a pure-bred object-oriented language: Every value is an object, and every operation is a method call. The language is quite similar to Ruby

The biggest difference between Ruby and Scala is that, Scala runs on the Java Virtual Machine. Thus, it is possible to mix up Java and Scala. Both the languages can be used together for a single project; Scala code can refer the Java code and Java code can refer Scala code without any errors turning up.

Scala is an Object-Functional programming and scripting language. The language uses very strong static type system and the compiler deciphers the types of the variables used. Just like Ruby, programs written in Scala can be very concise and thus, are smaller in size than in most languages.

Lift

Lift is an expressive framework for building web applications using Scala. It borrows concept from Grails, Ruby on Rails, Seaside, Wicket and Django. Lift is designed to make powerful techniques easily accessible, while keeping the overall framework simple and flexible.

Just like Rails, it favors convention over configuration: it decreases the number of decisions that developers need to make. But, unlike Rails, it does not follow the Model-View-Controller concept. It rather follows the "View First" approach.<ref>Hello</ref>

As Lift is a framework for Scala and Scala is very compatible with Java, any and all of the java libraries and web containers can be used in running Lift applications.

Dynamic web content is authored into the web pages via templates using the standard HTML5 or XHTML editors. It also provides native support for advanced web development techniques such as Comet and Ajax.

The main characteristics of the Lift framework are:

  • Resistant to common vulnerabilities
  • Fast to build, concise and easy to maintain
  • High performance and scale in the real world to handle big traffic levels
  • Interactive like a desktop application

Examples

When building class definitions, it’s common to have to build so-called getter and setter methods in order to set the values of that instance. This typically creates a lot of noise in the implementation (as seen in the Java example that follows). Scala combats this by using the case modifier to automatically provision standard functionality into the class definition. Given an instance of the Person case class, calling person.name would return the name value.

JAVA SCALA
public class Person {

private int _age;
private String _name; public Person(String n, int a){ _age = a; _name = n; } String name(){ return _name; } int age(){ return _age; } }

text or numbers in.
See longer phrase automatically fit in columns.

Helpful Links

References

<references />