KEMBAR78
Future Programming Language | PPT
Future Programming Languages Ben Logsdon, Dustin Beadle, Jaim Ahmed, Nivedita Kaluskar, Hongchao Li CS Department, University of Georgia April. 13 th  2005
Outline Python 3000 Ruby 2 Groovy Scala
Python 3000 Mystery Science meets Windows
From the creator “one day you may find that you are _already_ using Python 3000 -- only it won't be called that, but rather something like Python 2.8.7. “
About Python Development Open Source  www.python.org/dev P ython  E nhancement  P roposals www.python.org/peps BDFL – Guido van Rossum guides development PEPs are used in further versions of Python such as multi-line imports (328) and reverse iteration(322)
Sample PEPs http://www.python.org/peps/pep-0328.html Fix import statements Current: from Tkinter import Tk, Frame, Button\ Entry, Canvas, Text, LEFT, DISABLED\ NORMAL, RIDGE, END  To: from Tkinter import (Tk,Frame,Button,Entry, Canvas, Text, LEFT,DISABLED,NORMAL,RIDGE,END) Change to absolute imports indicating relative paths through dots ex) from foo import bar => from .foo import bar
Python 2.5 Add support for shadow passwords Deprecate and/or remove old modules such as gopher and posixfile Remove support for old platforms AST-based compiler (Abstract Syntax Tree) Decimal data type with specified precision (327)
Ruby 2
Intro To Ruby Designed to be a successor to Perl. Dynamically Typed, OO, Scripting Language Contains a garbage collector, contains threads, fully integrated closures and iterators, plus proper meta-classes.  Open source, multi-platform can be download at... http://www.ruby-lang.org/en/20020102.html
Ruby vs Python Both are High Level languages In Ruby, everything is an Object. Python allows programming with out objects if needed. Python has a much larger range of libraries for use. However, Ruby can make use of these through  Ruby/Python , although performance can suffer. According to  The Great Computer Language Shootout  Python has better performance time. More info at  Python Vs Ruby
Ruby on Rails Flagship Ruby Program Framework for developing web applications at a quick but sustainable pace Automatic Object-Relational-Mapping class Templated and non-templated page generation Automatic generation of unit tests Powerful and intelligent multi-level caching Pre-database entry validation Go to  http://www.rubyonrails.org/  to check out an example of what Ruby can do.
Future of Ruby.. Ruby 2 Ruby 2, or Ruby Rite, is still aways away from being released.  It is promised to be a bytecode based, thread-safe virtual machine. Changes include,  variable scopes the difference between statement and expressions semantics of multiple values private method visibility range in condition keyword arguments new hash literals
Future of Ruby.. Ruby 2 Ruby 2 is still quite a ways away, the current version of ruby is still 1.8 Most syntax changes will be complete by version 1.9 however. More details about Ruby Rite can be found  here .
Groovy
Groovy An object oriented programming language designed for the Java platform. Makes available the features in Ruby, Smalltalk, Python using a Java-like syntax. Can be used as a replacement for Java for small and medium sized applications. Makes writing test cases for unit tests very easy.
Features Uses Java syntax, but with far fewer rules. Does not require semi colons; access modifiers and variable types are optional. Makes use of standard Java libraries including Collection and File I/O. Can utilize any Java library from within Groovy, including JUnit. Includes support for Closures, SQL, Servlets, Beans, Unit testing etc.
Closures in Groovy A closure is one or more program statements enclosed in curly brackets. { [closureArguments->] statements }  The main difference between a closure and method is that closures do not require a class or a method name.  Closures can be assigned to a variable when created which can be passed around the program like any other variable.
Closures (Contd…) Example: Method definition package example.math; public class MyMath {  public static long square(int numberToSquare) {  return numberToSquare * numberToSquare; } }  Corresponding Closure definition def c = {numberToSquare -> numberToSquare * numberToSquare };
Closures Vs Code Blocks Code within a code block is executed by the virtual machine as soon as it is encountered. Statements within closures are not executed until the call() is made on the closure. Eg: y = c.call(x) instead of  y = example.math.MyMath.square(x) for  the method block.
Unit testing with Groovy Groovy's relaxed Java-like syntax, its reuse of standard Java libraries, and its rapid build-and-run cycle make it an ideal candidate for rapidly developing unit tests.  Groovy extends JUnit and this allows running of tests via the groovy command. GroovyTestCase gives some particularly handy assert methods.  Eg: assertArrayEquals, asserts that two arrays are equal by checking their individual values and respective lengths.
Contd… To write unit tests in groovy, a class extending groovy.util.GroovyTestCase has to be created. Example: import groovy.util.GroovyTestCase  class MyTest extends GroovyTestCase {  void testSomething() { assert 1 == 1  } }
Scala
Scala is object-oriented Scala is a pure object-oriented language in the sense that every value is an object.  Types and behavior of objects are described by  classes  and  traits .  Class abstractions are extended by subclassing and a flexible mixin-based composition mechanism as a clean replacement for multiple inheritance.   example
Scala is functional  Scala is also a functional language in the sense that every function is a value. Example class  MyBool(x: Boolean) {    def  and(that: MyBool): MyBool =  if  (x) that  else   this ;  def  or(that: MyBool): MyBool =  if  (x)  this   else  that;    def  negate: MyBool = new MyBool(!x); }
Scala is statically typed  Scala is equipped with an expressive type system that enforces statically that abstractions are used in a safe and coherent manner.  In particular, the type system supports:  generic classes,  variance annotations,  upper and lower type bounds,  classes and abstract types as object members,  compound types,  explicitly typed self references,  views, and  polymorphic methods.
Polymorphic Method Example object  PolyTest  with  Application {  def  dup[T](x: T, n: Int): List[T] =    if (n == 0) Nil    else  x :: dup(x, n - 1); Console.println(dup[Int](3, 4));  Console.println(dup("three", 3)) }
Scala is extensible  Scala provides a unique combination of language mechanisms that make it easy to smoothly add new language constructs in form of libraries.
Scala interoperates with Java and .NET  Scala is designed to interoperate well with popular programming environments like the Java 2 Runtime Environment (JRE) and the .NET CLR.  In particular, the interaction with mainstream object-oriented languages like Java and C++ is as smooth as possible.
Reference http://www.python.org http://www.rubygarden.org http://groovy.codehaus.org http://scala.epfl.ch

Future Programming Language

  • 1.
    Future Programming LanguagesBen Logsdon, Dustin Beadle, Jaim Ahmed, Nivedita Kaluskar, Hongchao Li CS Department, University of Georgia April. 13 th 2005
  • 2.
    Outline Python 3000Ruby 2 Groovy Scala
  • 3.
    Python 3000 MysteryScience meets Windows
  • 4.
    From the creator“one day you may find that you are _already_ using Python 3000 -- only it won't be called that, but rather something like Python 2.8.7. “
  • 5.
    About Python DevelopmentOpen Source www.python.org/dev P ython E nhancement P roposals www.python.org/peps BDFL – Guido van Rossum guides development PEPs are used in further versions of Python such as multi-line imports (328) and reverse iteration(322)
  • 6.
    Sample PEPs http://www.python.org/peps/pep-0328.htmlFix import statements Current: from Tkinter import Tk, Frame, Button\ Entry, Canvas, Text, LEFT, DISABLED\ NORMAL, RIDGE, END To: from Tkinter import (Tk,Frame,Button,Entry, Canvas, Text, LEFT,DISABLED,NORMAL,RIDGE,END) Change to absolute imports indicating relative paths through dots ex) from foo import bar => from .foo import bar
  • 7.
    Python 2.5 Addsupport for shadow passwords Deprecate and/or remove old modules such as gopher and posixfile Remove support for old platforms AST-based compiler (Abstract Syntax Tree) Decimal data type with specified precision (327)
  • 8.
  • 9.
    Intro To RubyDesigned to be a successor to Perl. Dynamically Typed, OO, Scripting Language Contains a garbage collector, contains threads, fully integrated closures and iterators, plus proper meta-classes. Open source, multi-platform can be download at... http://www.ruby-lang.org/en/20020102.html
  • 10.
    Ruby vs PythonBoth are High Level languages In Ruby, everything is an Object. Python allows programming with out objects if needed. Python has a much larger range of libraries for use. However, Ruby can make use of these through Ruby/Python , although performance can suffer. According to The Great Computer Language Shootout Python has better performance time. More info at Python Vs Ruby
  • 11.
    Ruby on RailsFlagship Ruby Program Framework for developing web applications at a quick but sustainable pace Automatic Object-Relational-Mapping class Templated and non-templated page generation Automatic generation of unit tests Powerful and intelligent multi-level caching Pre-database entry validation Go to http://www.rubyonrails.org/ to check out an example of what Ruby can do.
  • 12.
    Future of Ruby..Ruby 2 Ruby 2, or Ruby Rite, is still aways away from being released. It is promised to be a bytecode based, thread-safe virtual machine. Changes include, variable scopes the difference between statement and expressions semantics of multiple values private method visibility range in condition keyword arguments new hash literals
  • 13.
    Future of Ruby..Ruby 2 Ruby 2 is still quite a ways away, the current version of ruby is still 1.8 Most syntax changes will be complete by version 1.9 however. More details about Ruby Rite can be found here .
  • 14.
  • 15.
    Groovy An objectoriented programming language designed for the Java platform. Makes available the features in Ruby, Smalltalk, Python using a Java-like syntax. Can be used as a replacement for Java for small and medium sized applications. Makes writing test cases for unit tests very easy.
  • 16.
    Features Uses Javasyntax, but with far fewer rules. Does not require semi colons; access modifiers and variable types are optional. Makes use of standard Java libraries including Collection and File I/O. Can utilize any Java library from within Groovy, including JUnit. Includes support for Closures, SQL, Servlets, Beans, Unit testing etc.
  • 17.
    Closures in GroovyA closure is one or more program statements enclosed in curly brackets. { [closureArguments->] statements } The main difference between a closure and method is that closures do not require a class or a method name. Closures can be assigned to a variable when created which can be passed around the program like any other variable.
  • 18.
    Closures (Contd…) Example:Method definition package example.math; public class MyMath { public static long square(int numberToSquare) { return numberToSquare * numberToSquare; } } Corresponding Closure definition def c = {numberToSquare -> numberToSquare * numberToSquare };
  • 19.
    Closures Vs CodeBlocks Code within a code block is executed by the virtual machine as soon as it is encountered. Statements within closures are not executed until the call() is made on the closure. Eg: y = c.call(x) instead of y = example.math.MyMath.square(x) for the method block.
  • 20.
    Unit testing withGroovy Groovy's relaxed Java-like syntax, its reuse of standard Java libraries, and its rapid build-and-run cycle make it an ideal candidate for rapidly developing unit tests. Groovy extends JUnit and this allows running of tests via the groovy command. GroovyTestCase gives some particularly handy assert methods. Eg: assertArrayEquals, asserts that two arrays are equal by checking their individual values and respective lengths.
  • 21.
    Contd… To writeunit tests in groovy, a class extending groovy.util.GroovyTestCase has to be created. Example: import groovy.util.GroovyTestCase class MyTest extends GroovyTestCase { void testSomething() { assert 1 == 1 } }
  • 22.
  • 23.
    Scala is object-orientedScala is a pure object-oriented language in the sense that every value is an object. Types and behavior of objects are described by classes and traits . Class abstractions are extended by subclassing and a flexible mixin-based composition mechanism as a clean replacement for multiple inheritance. example
  • 24.
    Scala is functional Scala is also a functional language in the sense that every function is a value. Example class MyBool(x: Boolean) { def and(that: MyBool): MyBool = if (x) that else this ; def or(that: MyBool): MyBool = if (x) this else that; def negate: MyBool = new MyBool(!x); }
  • 25.
    Scala is staticallytyped Scala is equipped with an expressive type system that enforces statically that abstractions are used in a safe and coherent manner. In particular, the type system supports: generic classes, variance annotations, upper and lower type bounds, classes and abstract types as object members, compound types, explicitly typed self references, views, and polymorphic methods.
  • 26.
    Polymorphic Method Exampleobject PolyTest with Application { def dup[T](x: T, n: Int): List[T] = if (n == 0) Nil else x :: dup(x, n - 1); Console.println(dup[Int](3, 4)); Console.println(dup("three", 3)) }
  • 27.
    Scala is extensible Scala provides a unique combination of language mechanisms that make it easy to smoothly add new language constructs in form of libraries.
  • 28.
    Scala interoperates withJava and .NET Scala is designed to interoperate well with popular programming environments like the Java 2 Runtime Environment (JRE) and the .NET CLR. In particular, the interaction with mainstream object-oriented languages like Java and C++ is as smooth as possible.
  • 29.
    Reference http://www.python.org http://www.rubygarden.orghttp://groovy.codehaus.org http://scala.epfl.ch