• Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
1,259
On Slideshare
0
From Embeds
0
Number of Embeds
1

Actions

Shares
Downloads
47
Comments
0
Likes
3

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. Dynamic Languages on the JVM Groovy, Grails, JRuby, and JRuby on Rails Matt Stine Memphis/Mid-South JUG October 18, 2007
  • 2. Dynamic Languages
    • "Dynamic programming language is a term used broadly in computer science to describe a class of high level programming languages that execute at runtime many common behaviors that other languages might perform during compilation, if at all. These behaviors could include extension of the program, by adding new code, or by extending objects and definitions, or by modifying the type system, all during program execution. These behaviors can be emulated in nearly any language of sufficient complexity, but dynamic languages provide direct tools to make use of them." - Wikipedia
  • 3. Examples of Dynamic Languages:
    • Ruby
      • Created by Yukihiro “matz” Matsumoto
      • First released in 1995
      • Currently at version 1.8.6
      • http://www. ruby-lang .org
    • Groovy
      • Project founded by James Strachan and Bob McWhirter in 2003
      • Became JSR-241 in 2004
      • Currently at version 1.1-RC-1
      • http://groovy. codehaus .org
  • 4. DL Quick Feature Tour
    • Absolutely everything is an object – no primitives!
        • 7.class => java.lang.Integer
    • Lots of syntactical sugar for lists, maps, ranges, regular expressions, etc.
        • def numbers = [1,2,3] // a list
        • def ages = 18..65 // a range
        • def currencies = [USD: “US Dollar”, GBP: “Pounds”, EUR: “Euros”]
    • Dynamic typing
    • Blocks / Closures
        • 3.times {println it}
    • Metaprogramming
        • Dynamically generate classes
        • Modify existing classes
        • Special dispatching to pretend things exist
  • 5. Metaprogramming (Groovy)
  • 6. DL for the Web
    • Ruby = Ruby on Rails
      • Full-stack MVC web development framework
      • Open Source (MIT)
      • First released in 2004 by David Heinemeier Hansson
      • Currently at version 1.2.4 (2.0 coming soon!!!)
      • Ruby and Rails books are outselling Perl books
      • http: //rubyonrails .org
  • 7. DL for the Web
    • Groovy = Grails (formerly “Groovy on Rails”)
      • Model View Controller (MVC) action-based web framework
      • Open Source (Apache 2.0)
      • First released in early 2006 by Graeme Rocher, Guillaume LaForge, and Steven Devijver
      • Currently at version 0.6 (1.0 coming soon!!!)
      • Now backed by a company, G2one, formed by authors (October 2007).
      • http://grails.org
  • 8. DL Web Framework Similarities
    • Convention over configuration
      • Why punish the common cases?
      • Encourages standard practices
      • Everything simpler and smaller
    • Don’t Repeat Yourself (DRY)
      • Frameworks written around minimizing repetition
      • Repetitive code harmful to adaptability
  • 9. DL Web Framework Similarities
    • Agile development environment
      • No recompile, deploy, restart cycles
      • Simple tools to generate code quickly
      • Testing built into the frameworks
    • Full Stack
      • All technologies necessary to build persistence, service, and web layers fully integrated.
  • 10. What does all of this have to do with Java?!?!?! Both of these languages are FIRST CLASS CITIZENS on the Java Virtual Machine!
  • 11. JRuby
    • Started in 2002
    • Java platform implementation of Ruby language
    • Open source, many active contributors, including full-time Sun employees
    • Currently at version 1.0.1
    • Fully compatible with Ruby 1.8.5 (including Rails!)
    • http: //jruby . codehaus .org
  • 12. JRuby
    • Integrates with Java technology
      • Call to Ruby from Java technology via JSR 223, BSF, Spring
      • Use Java class files from Ruby (e.g. Script Java)
    • Growing set of external projects based on JRuby
      • JRuby-extras (GoldSpike, ActiveRecord-JDBC, Mongrel-JRuby, Mongrel-JCluster, …)
  • 13. Why JRuby?
    • JRuby over Ruby
      • Strong likelihood it will be faster soon
      • Better scalability with native threading
      • Native Unicode support
      • Compilation
      • Integration with Java libraries
      • Easier path to getting Ruby in the enterprise
  • 14. Why JRuby?
    • JRuby over Java technology
      • Language features
        • Blocks, modules, metaprogramming, dynamic-typing
      • Ruby applications/libraries
        • Rails, Rspec, Rake, Raven, other R’s
  • 15. Why JRuby on Rails?
    • “ Less Rails code that Java application configuration.”
    • Growing excited community of developers
    • Makes small apps trivial to create
    • Deployment to Java application servers
    • Java technology production environments are pervasive
      • Easier to switch framework vs. whole architecture
      • Lower barrier to entry
    • Broader, more scalable database support
    • Integration w/ Java technology libs, legacy services
  • 16. JRuby on Rails: Java EE Platform
    • Pool database connections
    • Access any JNDI resource
    • Access any Java EE platform TLA:
      • Java Persistence API (JPA)
      • Java Management Extensions (JMX)
      • Enterprise JavaBeans ™ (EJB ™ )
      • Java Message Service (JMS) API
      • SOAP/WSDL/SOA
  • 17. JRuby on Rails: Deployment
    • Use goldspike plugin to build WAR file
    • Deploy to any Java EE App Server
  • 18. DEMO
    • JUG Meeting App
      • Create Meetings
      • Create Attendees
      • Associate Attendees w/ Meetings
      • Conduct Prize Drawings
  • 19. Groovy
    • Written specifically for the JVM (JSR-241)
    • Generates bytecode for the JVM and supports both static and dynamic typing
    • A runtime and library (GDK) extension to Java
    • Expressive Java-like syntax
    • Same object model as Java (a Groovy object is a Java object!)
  • 20. Groovy
    • Same mechanisms for:
      • Class extension and interface implementation
      • Method overloading
      • JavaBean ™ creation (with a twist!)
    • But brings the dynamic features of Ruby, Python, and Smalltalk to a Java friendly environment
  • 21.
    • Based on solid foundations
      • Groovy
      • Spring and Spring MVC
      • Hibernate
      • Quartz
      • Sitemesh
      • Embedded Jetty and HSQLDB
    • And, of course, Java ™ technology
    Grails
  • 22. Why Groovy/Grails?
    • Simplicity and flexibility
      • All the power of the underlying frameworks is available to you, but you don’t have to use it!
    • Mindshare integration
      • Developers have no need to abandon their existing Java knowledge
    • API integration
      • Groovy/Grails provides elegant extensions to existing good APIs (GORM).
  • 23. Why Groovy/Grails?
    • Blended Development Approach
      • Write appropriate portions of your application in Groovy and/or Java
    • Dynamic Language Features
      • Pure OO
      • Syntax Sugar
      • Dynamic typing
      • Closures
      • Metaprogramming
  • 24. DEMO
    • JUG Meeting App
      • Create Meetings
      • Create Attendees
      • Associate Attendees w/ Meetings
      • Conduct Prize Drawings
  • 25. Dynamic Languages Summary
    • JVM integration means zero loss of Java investment (developer knowledge, infrastructure)
    • Powerful language features increase developer productivity
    • Frameworks designed for rapid, agile development of web applications
  • 26. Q/A
    • Questions???
  • 27. Resources
    • http://ruby-lang.org
    • http://jruby.codehaus.org
    • http://rubyonrails.org
    • http://groovy.codehaus.org
    • http://grails.codehaus.org
    • http://memphisjug-dynamiclanguages-oct07.googlecode.com