SlideShare a Scribd company logo
Java, Ruby & Rails
The Java platform “ It’s all about the Java Virtual Machine. That’s the integration hub.” Gosling, Sun Tech Days 2007 Lots of new languages for the JVM Scala, Clojure, Groovy, Jython, (J)Ruby, JavaScript (Rhino), JavaFX The DaVinci Machine JSR-292 Target JDK 7 invokedynamic instruction
Why Ruby? Ubiquity C-Ruby (MRI) JRuby IronRuby (.NET) Rubinius, Maglev, YARV Scripting java shebang/backticks Rails Framework Support from Sun, Thoughtworks Most likely to succeed?
What is Ruby? Created by Yukihiro Matsumoto (Matz) in 1993 “ A dynamic, open source programming language with a focus on simplicity and productivity. It has an elegant syntax that is natural to read and easy to write.”  The principle of least surprise Runtime efficiency not a top priority “ More powerful than Perl, more OO  than Python” MRI is the specification RubySpec is in the works
Ruby Characteristics Interpreted Object oriented ” myString”.upcase 2_500.+2 44.modulo 5 Reflective Garbage collected Duck typing If it walks like a duck and quacks like a duck it must be a duck
Dynamic features Reopen existing classes redefine methods “ monkeypatching” Meta-programming Method aliasing alias_method  :validates_size_of ,  :validates_length_of method_missing Eg provide a generic sort method sort_by_x Closures
Core Ruby tools (j)ruby the interpreter (j)irb interactive ruby, ~readline support, tab completion ri ruby interactive ~man pages rdoc html doc ~javadoc rake ant/make for ruby gem package manager
Ruby anatomy Classes are CamelCased Methods are under_scored Generally no need for curly braces, parentheses, semicolon or return statement code more compact Comments =begin block comment =end # line comment Variables Constant @@classVariable @instanceVariable localVariable :symbol
Example
Ruby structure Modules Module::Class Mix-ins interfaces with functionality Namespace Subclass < Superclass Single inheritance only Files are named *.rb can hold many classes require ’file’ include Module searches $LOAD_PATH
Access modifiers private Private to this instance (might be a subclass) You can’t specify the receiver, not even self protected Can be called by instances of the same class Eg use for comparators  public FFA private :method or private (until end) The modifiers are methods, not keywords
Testing Test::Unit::TestCase xUnit for ruby JRuby to test Java code? JtestR to invoke Code coverage  might be an issue RSpec BDD
Method signature - Java Method overloading Number of method signatures increases fast if flexibility is wanted
Method signature – PL/SQL Named parameters Still have to change method signature too add parameters
Method signature – Ruby Hash as optional parameter, not named parameters No need to change method signature Hash doesn’t need curly braces Method overload unavailable *args => arguments array
More syntax examples =~  regexp matcher myString =~ /[0-9]+/ %w[]  String array myArray = %w[ruby java haskell] {||}   or  do || end  closures  (and embedded variables) myHash.each { |k, v| puts k+’ is ‘+v } myHash.each do |key, val| puts “#{key} is #{val}” end
Ruby on Rails MVC Framework “ Rails is the most well thought-out web development framework I’ve ever used. And that’s in a decade of doing web applications for a living. I’ve built my own frameworks, helped develop the Servlet API, and have created more than a few web servers from scratch. Nobody has done it like this before.” -James Duncan Davidson, Creator of Tomcat and Ant “ Rails is the killer app for Ruby.” Yukihiro Matsumoto, Creator of Ruby
RoR principles Opinionated software Convention over configuration DRY REST GET /products #get all GET /products/42 #get id=42 POST /products #create Fast feedback loop just reload, no compile Rails itself is a gem
Ruby on Rails concepts rails <appname> generates skeleton  routes.rb ~struts-config.xml *.html.erb ~JSP Generators Generates model, view, controller, tests Partials (html.erb snippets) Plugins (instead of gems) Default database is sqlite3 (via JDBC for JRuby) Filters (defined in controller)
RoR tools rails <appname> -d <database> script/generate scaffold Person name:string script/server script/console irb with access to the application script/dbconsole enter SQL script/server –debugger debugger in the code drops to console
ActiveRecord O/R mapping Db migrations, dev, test, prod   up and down database agnostic rake db:migrate config/database.yml Opinionated software primary key named id pluralization class Book => db books
RoR model example class BlogPost < ActiveRecord::Base belongs_to :author has_many :comments validates_presence_of :title end comments table needs blog_post_id blog_posts table needs author_id New post need title field
A/R Metaprogramming
A/R Metaprogramming
ActiveSupport::TestCase Inherits Test::Unit::TestCase Provides helpers, eg http calls <app>/test functional integration unit fixtures/fixtures.yml rake
Jruby Motivation The JVM Sneak into the enterprise Reuse infrastructure Integrate with Java applications Performance and scalability
JRuby on Rails Develop as Java Netbeans Eclipse Integrate with Java Call EJBs Use JMS queues Use JNDI  Use JAAS Deploy on Java As *.war using warbler Rails deployer (JBoss, Glassfish)
Java integration include Java / require ”java” include Java::JavaxSwing include_class &quot;javax.naming.InitialContext” require ”path/to/my.jar” prefix javaclasses to avoid name collisions String => JString include_class 'java.lang.String’  {|package,name| &quot;J#{name}&quot; }  Method alias System.currentTimeMillis => System.current_time_millis Getters and setters behaves like attr_accessor fields
IDE support Eclipse - DLTK (Dynamic Languages Toolkit) Eclipse foundation plugin Support for TCL, Python, Ruby  No Rails Eclipse - Aptana RadRails RDT Ruby Editor Rails support generators/scripts Visual debug Testrunner Netbeans Official plugin
Conclusion Ruby is sweet! Syntactic sugar Fun to work with Ruby is useful! Integrate with Java OO scripting Rails is probably fast enough Ruby is hard! “ Good programmers become better, bad programmers become worse” Test, test, test
Thank you and Namaste
Contact © Devoteam Consulting A/S. This document  is not  to be copied or reproduced in any way without the  express permission of Devoteam Consulting. AUSTRIA BELGIUM CZECH REPUBLIC DENMARK FRANCE MOROCCO NETHERLANDS NORWAY POLAND SAUDI ARABIA SPAIN SWEDEN SWITZERLAND  UNITED ARAB EMIRATES UNITED KINGDOM +46 (0)733-812135 Phone: [email_address] E-mail: Address Peter Sönnergren Person: CONTACT Author:  Date:  # ID:  DOCUMENT

More Related Content

What's hot (19)

Introduction to Ruby on Rails
Introduction to Ruby on RailsIntroduction to Ruby on Rails
Introduction to Ruby on Rails
Agnieszka Figiel
 
Rjb
RjbRjb
Rjb
Wes Gamble
 
Ruby for C#-ers (ScanDevConf 2010)
Ruby for C#-ers (ScanDevConf 2010)Ruby for C#-ers (ScanDevConf 2010)
Ruby for C#-ers (ScanDevConf 2010)
Thomas Lundström
 
An Introduction to Java Compiler and Runtime
An Introduction to Java Compiler and RuntimeAn Introduction to Java Compiler and Runtime
An Introduction to Java Compiler and Runtime
Omar Bashir
 
Grand Central Dispatch
Grand Central DispatchGrand Central Dispatch
Grand Central Dispatch
Robert Brown
 
Java byte code & virtual machine
Java byte code & virtual machineJava byte code & virtual machine
Java byte code & virtual machine
Laxman Puri
 
Ruby on Rails 101 - Presentation Slides for a Five Day Introductory Course
Ruby on Rails 101 - Presentation Slides for a Five Day Introductory CourseRuby on Rails 101 - Presentation Slides for a Five Day Introductory Course
Ruby on Rails 101 - Presentation Slides for a Five Day Introductory Course
peter_marklund
 
Java ScriptingJava Scripting: One VM, Many Languages
Java ScriptingJava Scripting: One VM, Many LanguagesJava ScriptingJava Scripting: One VM, Many Languages
Java ScriptingJava Scripting: One VM, Many Languages
elliando dias
 
Java introduction
Java introductionJava introduction
Java introduction
The icfai university jaipur
 
Online game server on Akka.NET (NDC2016)
Online game server on Akka.NET (NDC2016)Online game server on Akka.NET (NDC2016)
Online game server on Akka.NET (NDC2016)
Esun Kim
 
Security Goodness with Ruby on Rails
Security Goodness with Ruby on RailsSecurity Goodness with Ruby on Rails
Security Goodness with Ruby on Rails
Source Conference
 
Ruby on Rails Training - Module 1
Ruby on Rails Training - Module 1Ruby on Rails Training - Module 1
Ruby on Rails Training - Module 1
Mark Menard
 
Vert.x - Tehran JUG meeting Aug-2014 - Saeed Zarinfam
Vert.x - Tehran JUG meeting Aug-2014 - Saeed ZarinfamVert.x - Tehran JUG meeting Aug-2014 - Saeed Zarinfam
Vert.x - Tehran JUG meeting Aug-2014 - Saeed Zarinfam
Saeed Zarinfam
 
TorqueBox - Ultrapassando a fronteira entre Java e Ruby
TorqueBox - Ultrapassando a fronteira entre Java e RubyTorqueBox - Ultrapassando a fronteira entre Java e Ruby
TorqueBox - Ultrapassando a fronteira entre Java e Ruby
Bruno Oliveira
 
Dvm
DvmDvm
Dvm
Shivam Sharma
 
JRuby Basics
JRuby BasicsJRuby Basics
JRuby Basics
elliando dias
 
Quick Intro To JRuby
Quick Intro To JRubyQuick Intro To JRuby
Quick Intro To JRuby
Frederic Jean
 
DataMapper on Infinispan
DataMapper on InfinispanDataMapper on Infinispan
DataMapper on Infinispan
Lance Ball
 
Basics of java
Basics of javaBasics of java
Basics of java
onewomanmore witl
 
Introduction to Ruby on Rails
Introduction to Ruby on RailsIntroduction to Ruby on Rails
Introduction to Ruby on Rails
Agnieszka Figiel
 
Ruby for C#-ers (ScanDevConf 2010)
Ruby for C#-ers (ScanDevConf 2010)Ruby for C#-ers (ScanDevConf 2010)
Ruby for C#-ers (ScanDevConf 2010)
Thomas Lundström
 
An Introduction to Java Compiler and Runtime
An Introduction to Java Compiler and RuntimeAn Introduction to Java Compiler and Runtime
An Introduction to Java Compiler and Runtime
Omar Bashir
 
Grand Central Dispatch
Grand Central DispatchGrand Central Dispatch
Grand Central Dispatch
Robert Brown
 
Java byte code & virtual machine
Java byte code & virtual machineJava byte code & virtual machine
Java byte code & virtual machine
Laxman Puri
 
Ruby on Rails 101 - Presentation Slides for a Five Day Introductory Course
Ruby on Rails 101 - Presentation Slides for a Five Day Introductory CourseRuby on Rails 101 - Presentation Slides for a Five Day Introductory Course
Ruby on Rails 101 - Presentation Slides for a Five Day Introductory Course
peter_marklund
 
Java ScriptingJava Scripting: One VM, Many Languages
Java ScriptingJava Scripting: One VM, Many LanguagesJava ScriptingJava Scripting: One VM, Many Languages
Java ScriptingJava Scripting: One VM, Many Languages
elliando dias
 
Online game server on Akka.NET (NDC2016)
Online game server on Akka.NET (NDC2016)Online game server on Akka.NET (NDC2016)
Online game server on Akka.NET (NDC2016)
Esun Kim
 
Security Goodness with Ruby on Rails
Security Goodness with Ruby on RailsSecurity Goodness with Ruby on Rails
Security Goodness with Ruby on Rails
Source Conference
 
Ruby on Rails Training - Module 1
Ruby on Rails Training - Module 1Ruby on Rails Training - Module 1
Ruby on Rails Training - Module 1
Mark Menard
 
Vert.x - Tehran JUG meeting Aug-2014 - Saeed Zarinfam
Vert.x - Tehran JUG meeting Aug-2014 - Saeed ZarinfamVert.x - Tehran JUG meeting Aug-2014 - Saeed Zarinfam
Vert.x - Tehran JUG meeting Aug-2014 - Saeed Zarinfam
Saeed Zarinfam
 
TorqueBox - Ultrapassando a fronteira entre Java e Ruby
TorqueBox - Ultrapassando a fronteira entre Java e RubyTorqueBox - Ultrapassando a fronteira entre Java e Ruby
TorqueBox - Ultrapassando a fronteira entre Java e Ruby
Bruno Oliveira
 
Quick Intro To JRuby
Quick Intro To JRubyQuick Intro To JRuby
Quick Intro To JRuby
Frederic Jean
 
DataMapper on Infinispan
DataMapper on InfinispanDataMapper on Infinispan
DataMapper on Infinispan
Lance Ball
 

Similar to Java, Ruby & Rails (20)

JRuby - Enterprise 2.0
JRuby - Enterprise 2.0JRuby - Enterprise 2.0
JRuby - Enterprise 2.0
Jan Sifra
 
From Java to Ruby...and Back
From Java to Ruby...and BackFrom Java to Ruby...and Back
From Java to Ruby...and Back
Anil Hemrajani
 
Introduction to Ruby on Rails
Introduction to Ruby on RailsIntroduction to Ruby on Rails
Introduction to Ruby on Rails
mithunsasidharan
 
Why Ruby?
Why Ruby? Why Ruby?
Why Ruby?
IT Weekend
 
Ruby on Rails survival guide of an aged Java developer
Ruby on Rails survival guide of an aged Java developerRuby on Rails survival guide of an aged Java developer
Ruby on Rails survival guide of an aged Java developer
gicappa
 
Workin ontherailsroad
Workin ontherailsroadWorkin ontherailsroad
Workin ontherailsroad
Jim Jones
 
WorkinOnTheRailsRoad
WorkinOnTheRailsRoadWorkinOnTheRailsRoad
WorkinOnTheRailsRoad
webuploader
 
JRuby + Rails = Awesome Java Web Framework at Jfokus 2011
JRuby + Rails = Awesome Java Web Framework at Jfokus 2011JRuby + Rails = Awesome Java Web Framework at Jfokus 2011
JRuby + Rails = Awesome Java Web Framework at Jfokus 2011
Nick Sieger
 
Dynamic Languages on the JVM
Dynamic Languages on the JVMDynamic Languages on the JVM
Dynamic Languages on the JVM
elliando dias
 
Ruby for Java Developers
Ruby for Java DevelopersRuby for Java Developers
Ruby for Java Developers
Robert Reiz
 
JRoR Deploying Rails on JRuby
JRoR Deploying Rails on JRubyJRoR Deploying Rails on JRuby
JRoR Deploying Rails on JRuby
elliando dias
 
10 Things you should know about Ruby
10 Things you should know about Ruby10 Things you should know about Ruby
10 Things you should know about Ruby
sikachu
 
Rapid Application Development using Ruby on Rails
Rapid Application Development using Ruby on RailsRapid Application Development using Ruby on Rails
Rapid Application Development using Ruby on Rails
Simobo
 
Ruby vs Java: Comparing Two Popular Programming Languages For Developing Ente...
Ruby vs Java: Comparing Two Popular Programming Languages For Developing Ente...Ruby vs Java: Comparing Two Popular Programming Languages For Developing Ente...
Ruby vs Java: Comparing Two Popular Programming Languages For Developing Ente...
Katy Slemon
 
IJTC%202009%20JRuby
IJTC%202009%20JRubyIJTC%202009%20JRuby
IJTC%202009%20JRuby
tutorialsruby
 
IJTC%202009%20JRuby
IJTC%202009%20JRubyIJTC%202009%20JRuby
IJTC%202009%20JRuby
tutorialsruby
 
Adventures of java developer in ruby world
Adventures of java developer in ruby worldAdventures of java developer in ruby world
Adventures of java developer in ruby world
Orest Ivasiv
 
Meta Programming in Ruby - Code Camp 2010
Meta Programming in Ruby - Code Camp 2010Meta Programming in Ruby - Code Camp 2010
Meta Programming in Ruby - Code Camp 2010
ssoroka
 
Optimizing for programmer happiness
Optimizing for programmer happinessOptimizing for programmer happiness
Optimizing for programmer happiness
Josh Schramm
 
JRuby - The Best of Java and Ruby
JRuby - The Best of Java and RubyJRuby - The Best of Java and Ruby
JRuby - The Best of Java and Ruby
Evgeny Rahman
 
JRuby - Enterprise 2.0
JRuby - Enterprise 2.0JRuby - Enterprise 2.0
JRuby - Enterprise 2.0
Jan Sifra
 
From Java to Ruby...and Back
From Java to Ruby...and BackFrom Java to Ruby...and Back
From Java to Ruby...and Back
Anil Hemrajani
 
Introduction to Ruby on Rails
Introduction to Ruby on RailsIntroduction to Ruby on Rails
Introduction to Ruby on Rails
mithunsasidharan
 
Ruby on Rails survival guide of an aged Java developer
Ruby on Rails survival guide of an aged Java developerRuby on Rails survival guide of an aged Java developer
Ruby on Rails survival guide of an aged Java developer
gicappa
 
Workin ontherailsroad
Workin ontherailsroadWorkin ontherailsroad
Workin ontherailsroad
Jim Jones
 
WorkinOnTheRailsRoad
WorkinOnTheRailsRoadWorkinOnTheRailsRoad
WorkinOnTheRailsRoad
webuploader
 
JRuby + Rails = Awesome Java Web Framework at Jfokus 2011
JRuby + Rails = Awesome Java Web Framework at Jfokus 2011JRuby + Rails = Awesome Java Web Framework at Jfokus 2011
JRuby + Rails = Awesome Java Web Framework at Jfokus 2011
Nick Sieger
 
Dynamic Languages on the JVM
Dynamic Languages on the JVMDynamic Languages on the JVM
Dynamic Languages on the JVM
elliando dias
 
Ruby for Java Developers
Ruby for Java DevelopersRuby for Java Developers
Ruby for Java Developers
Robert Reiz
 
JRoR Deploying Rails on JRuby
JRoR Deploying Rails on JRubyJRoR Deploying Rails on JRuby
JRoR Deploying Rails on JRuby
elliando dias
 
10 Things you should know about Ruby
10 Things you should know about Ruby10 Things you should know about Ruby
10 Things you should know about Ruby
sikachu
 
Rapid Application Development using Ruby on Rails
Rapid Application Development using Ruby on RailsRapid Application Development using Ruby on Rails
Rapid Application Development using Ruby on Rails
Simobo
 
Ruby vs Java: Comparing Two Popular Programming Languages For Developing Ente...
Ruby vs Java: Comparing Two Popular Programming Languages For Developing Ente...Ruby vs Java: Comparing Two Popular Programming Languages For Developing Ente...
Ruby vs Java: Comparing Two Popular Programming Languages For Developing Ente...
Katy Slemon
 
Adventures of java developer in ruby world
Adventures of java developer in ruby worldAdventures of java developer in ruby world
Adventures of java developer in ruby world
Orest Ivasiv
 
Meta Programming in Ruby - Code Camp 2010
Meta Programming in Ruby - Code Camp 2010Meta Programming in Ruby - Code Camp 2010
Meta Programming in Ruby - Code Camp 2010
ssoroka
 
Optimizing for programmer happiness
Optimizing for programmer happinessOptimizing for programmer happiness
Optimizing for programmer happiness
Josh Schramm
 
JRuby - The Best of Java and Ruby
JRuby - The Best of Java and RubyJRuby - The Best of Java and Ruby
JRuby - The Best of Java and Ruby
Evgeny Rahman
 
Ad

Recently uploaded (20)

MuleSoft for AgentForce : Topic Center and API Catalog
MuleSoft for AgentForce : Topic Center and API CatalogMuleSoft for AgentForce : Topic Center and API Catalog
MuleSoft for AgentForce : Topic Center and API Catalog
shyamraj55
 
FIDO Seminar: Authentication for a Billion Consumers - Amazon.pptx
FIDO Seminar: Authentication for a Billion Consumers - Amazon.pptxFIDO Seminar: Authentication for a Billion Consumers - Amazon.pptx
FIDO Seminar: Authentication for a Billion Consumers - Amazon.pptx
FIDO Alliance
 
Oracle Cloud and AI Specialization Program
Oracle Cloud and AI Specialization ProgramOracle Cloud and AI Specialization Program
Oracle Cloud and AI Specialization Program
VICTOR MAESTRE RAMIREZ
 
Your startup on AWS - How to architect and maintain a Lean and Mean account J...
Your startup on AWS - How to architect and maintain a Lean and Mean account J...Your startup on AWS - How to architect and maintain a Lean and Mean account J...
Your startup on AWS - How to architect and maintain a Lean and Mean account J...
angelo60207
 
Edge-banding-machines-edgeteq-s-200-en-.pdf
Edge-banding-machines-edgeteq-s-200-en-.pdfEdge-banding-machines-edgeteq-s-200-en-.pdf
Edge-banding-machines-edgeteq-s-200-en-.pdf
AmirStern2
 
Floods in Valencia: Two FME-Powered Stories of Data Resilience
Floods in Valencia: Two FME-Powered Stories of Data ResilienceFloods in Valencia: Two FME-Powered Stories of Data Resilience
Floods in Valencia: Two FME-Powered Stories of Data Resilience
Safe Software
 
Kubernetes Security Act Now Before It’s Too Late
Kubernetes Security Act Now Before It’s Too LateKubernetes Security Act Now Before It’s Too Late
Kubernetes Security Act Now Before It’s Too Late
Michael Furman
 
The State of Web3 Industry- Industry Report
The State of Web3 Industry- Industry ReportThe State of Web3 Industry- Industry Report
The State of Web3 Industry- Industry Report
Liveplex
 
Scaling GenAI Inference From Prototype to Production: Real-World Lessons in S...
Scaling GenAI Inference From Prototype to Production: Real-World Lessons in S...Scaling GenAI Inference From Prototype to Production: Real-World Lessons in S...
Scaling GenAI Inference From Prototype to Production: Real-World Lessons in S...
Anish Kumar
 
Bridging the divide: A conversation on tariffs today in the book industry - T...
Bridging the divide: A conversation on tariffs today in the book industry - T...Bridging the divide: A conversation on tariffs today in the book industry - T...
Bridging the divide: A conversation on tariffs today in the book industry - T...
BookNet Canada
 
“Addressing Evolving AI Model Challenges Through Memory and Storage,” a Prese...
“Addressing Evolving AI Model Challenges Through Memory and Storage,” a Prese...“Addressing Evolving AI Model Challenges Through Memory and Storage,” a Prese...
“Addressing Evolving AI Model Challenges Through Memory and Storage,” a Prese...
Edge AI and Vision Alliance
 
Supporting the NextGen 911 Digital Transformation with FME
Supporting the NextGen 911 Digital Transformation with FMESupporting the NextGen 911 Digital Transformation with FME
Supporting the NextGen 911 Digital Transformation with FME
Safe Software
 
National Fuels Treatments Initiative: Building a Seamless Map of Hazardous Fu...
National Fuels Treatments Initiative: Building a Seamless Map of Hazardous Fu...National Fuels Treatments Initiative: Building a Seamless Map of Hazardous Fu...
National Fuels Treatments Initiative: Building a Seamless Map of Hazardous Fu...
Safe Software
 
Data Validation and System Interoperability
Data Validation and System InteroperabilityData Validation and System Interoperability
Data Validation and System Interoperability
Safe Software
 
Providing an OGC API Processes REST Interface for FME Flow
Providing an OGC API Processes REST Interface for FME FlowProviding an OGC API Processes REST Interface for FME Flow
Providing an OGC API Processes REST Interface for FME Flow
Safe Software
 
Reducing Conflicts and Increasing Safety Along the Cycling Networks of East-F...
Reducing Conflicts and Increasing Safety Along the Cycling Networks of East-F...Reducing Conflicts and Increasing Safety Along the Cycling Networks of East-F...
Reducing Conflicts and Increasing Safety Along the Cycling Networks of East-F...
Safe Software
 
“Why It’s Critical to Have an Integrated Development Methodology for Edge AI,...
“Why It’s Critical to Have an Integrated Development Methodology for Edge AI,...“Why It’s Critical to Have an Integrated Development Methodology for Edge AI,...
“Why It’s Critical to Have an Integrated Development Methodology for Edge AI,...
Edge AI and Vision Alliance
 
FIDO Alliance Seminar State of Passkeys.pptx
FIDO Alliance Seminar State of Passkeys.pptxFIDO Alliance Seminar State of Passkeys.pptx
FIDO Alliance Seminar State of Passkeys.pptx
FIDO Alliance
 
ENERGY CONSUMPTION CALCULATION IN ENERGY-EFFICIENT AIR CONDITIONER.pdf
ENERGY CONSUMPTION CALCULATION IN ENERGY-EFFICIENT AIR CONDITIONER.pdfENERGY CONSUMPTION CALCULATION IN ENERGY-EFFICIENT AIR CONDITIONER.pdf
ENERGY CONSUMPTION CALCULATION IN ENERGY-EFFICIENT AIR CONDITIONER.pdf
Muhammad Rizwan Akram
 
June Patch Tuesday
June Patch TuesdayJune Patch Tuesday
June Patch Tuesday
Ivanti
 
MuleSoft for AgentForce : Topic Center and API Catalog
MuleSoft for AgentForce : Topic Center and API CatalogMuleSoft for AgentForce : Topic Center and API Catalog
MuleSoft for AgentForce : Topic Center and API Catalog
shyamraj55
 
FIDO Seminar: Authentication for a Billion Consumers - Amazon.pptx
FIDO Seminar: Authentication for a Billion Consumers - Amazon.pptxFIDO Seminar: Authentication for a Billion Consumers - Amazon.pptx
FIDO Seminar: Authentication for a Billion Consumers - Amazon.pptx
FIDO Alliance
 
Oracle Cloud and AI Specialization Program
Oracle Cloud and AI Specialization ProgramOracle Cloud and AI Specialization Program
Oracle Cloud and AI Specialization Program
VICTOR MAESTRE RAMIREZ
 
Your startup on AWS - How to architect and maintain a Lean and Mean account J...
Your startup on AWS - How to architect and maintain a Lean and Mean account J...Your startup on AWS - How to architect and maintain a Lean and Mean account J...
Your startup on AWS - How to architect and maintain a Lean and Mean account J...
angelo60207
 
Edge-banding-machines-edgeteq-s-200-en-.pdf
Edge-banding-machines-edgeteq-s-200-en-.pdfEdge-banding-machines-edgeteq-s-200-en-.pdf
Edge-banding-machines-edgeteq-s-200-en-.pdf
AmirStern2
 
Floods in Valencia: Two FME-Powered Stories of Data Resilience
Floods in Valencia: Two FME-Powered Stories of Data ResilienceFloods in Valencia: Two FME-Powered Stories of Data Resilience
Floods in Valencia: Two FME-Powered Stories of Data Resilience
Safe Software
 
Kubernetes Security Act Now Before It’s Too Late
Kubernetes Security Act Now Before It’s Too LateKubernetes Security Act Now Before It’s Too Late
Kubernetes Security Act Now Before It’s Too Late
Michael Furman
 
The State of Web3 Industry- Industry Report
The State of Web3 Industry- Industry ReportThe State of Web3 Industry- Industry Report
The State of Web3 Industry- Industry Report
Liveplex
 
Scaling GenAI Inference From Prototype to Production: Real-World Lessons in S...
Scaling GenAI Inference From Prototype to Production: Real-World Lessons in S...Scaling GenAI Inference From Prototype to Production: Real-World Lessons in S...
Scaling GenAI Inference From Prototype to Production: Real-World Lessons in S...
Anish Kumar
 
Bridging the divide: A conversation on tariffs today in the book industry - T...
Bridging the divide: A conversation on tariffs today in the book industry - T...Bridging the divide: A conversation on tariffs today in the book industry - T...
Bridging the divide: A conversation on tariffs today in the book industry - T...
BookNet Canada
 
“Addressing Evolving AI Model Challenges Through Memory and Storage,” a Prese...
“Addressing Evolving AI Model Challenges Through Memory and Storage,” a Prese...“Addressing Evolving AI Model Challenges Through Memory and Storage,” a Prese...
“Addressing Evolving AI Model Challenges Through Memory and Storage,” a Prese...
Edge AI and Vision Alliance
 
Supporting the NextGen 911 Digital Transformation with FME
Supporting the NextGen 911 Digital Transformation with FMESupporting the NextGen 911 Digital Transformation with FME
Supporting the NextGen 911 Digital Transformation with FME
Safe Software
 
National Fuels Treatments Initiative: Building a Seamless Map of Hazardous Fu...
National Fuels Treatments Initiative: Building a Seamless Map of Hazardous Fu...National Fuels Treatments Initiative: Building a Seamless Map of Hazardous Fu...
National Fuels Treatments Initiative: Building a Seamless Map of Hazardous Fu...
Safe Software
 
Data Validation and System Interoperability
Data Validation and System InteroperabilityData Validation and System Interoperability
Data Validation and System Interoperability
Safe Software
 
Providing an OGC API Processes REST Interface for FME Flow
Providing an OGC API Processes REST Interface for FME FlowProviding an OGC API Processes REST Interface for FME Flow
Providing an OGC API Processes REST Interface for FME Flow
Safe Software
 
Reducing Conflicts and Increasing Safety Along the Cycling Networks of East-F...
Reducing Conflicts and Increasing Safety Along the Cycling Networks of East-F...Reducing Conflicts and Increasing Safety Along the Cycling Networks of East-F...
Reducing Conflicts and Increasing Safety Along the Cycling Networks of East-F...
Safe Software
 
“Why It’s Critical to Have an Integrated Development Methodology for Edge AI,...
“Why It’s Critical to Have an Integrated Development Methodology for Edge AI,...“Why It’s Critical to Have an Integrated Development Methodology for Edge AI,...
“Why It’s Critical to Have an Integrated Development Methodology for Edge AI,...
Edge AI and Vision Alliance
 
FIDO Alliance Seminar State of Passkeys.pptx
FIDO Alliance Seminar State of Passkeys.pptxFIDO Alliance Seminar State of Passkeys.pptx
FIDO Alliance Seminar State of Passkeys.pptx
FIDO Alliance
 
ENERGY CONSUMPTION CALCULATION IN ENERGY-EFFICIENT AIR CONDITIONER.pdf
ENERGY CONSUMPTION CALCULATION IN ENERGY-EFFICIENT AIR CONDITIONER.pdfENERGY CONSUMPTION CALCULATION IN ENERGY-EFFICIENT AIR CONDITIONER.pdf
ENERGY CONSUMPTION CALCULATION IN ENERGY-EFFICIENT AIR CONDITIONER.pdf
Muhammad Rizwan Akram
 
June Patch Tuesday
June Patch TuesdayJune Patch Tuesday
June Patch Tuesday
Ivanti
 
Ad

Java, Ruby & Rails

  • 1. Java, Ruby & Rails
  • 2. The Java platform “ It’s all about the Java Virtual Machine. That’s the integration hub.” Gosling, Sun Tech Days 2007 Lots of new languages for the JVM Scala, Clojure, Groovy, Jython, (J)Ruby, JavaScript (Rhino), JavaFX The DaVinci Machine JSR-292 Target JDK 7 invokedynamic instruction
  • 3. Why Ruby? Ubiquity C-Ruby (MRI) JRuby IronRuby (.NET) Rubinius, Maglev, YARV Scripting java shebang/backticks Rails Framework Support from Sun, Thoughtworks Most likely to succeed?
  • 4. What is Ruby? Created by Yukihiro Matsumoto (Matz) in 1993 “ A dynamic, open source programming language with a focus on simplicity and productivity. It has an elegant syntax that is natural to read and easy to write.” The principle of least surprise Runtime efficiency not a top priority “ More powerful than Perl, more OO than Python” MRI is the specification RubySpec is in the works
  • 5. Ruby Characteristics Interpreted Object oriented ” myString”.upcase 2_500.+2 44.modulo 5 Reflective Garbage collected Duck typing If it walks like a duck and quacks like a duck it must be a duck
  • 6. Dynamic features Reopen existing classes redefine methods “ monkeypatching” Meta-programming Method aliasing alias_method :validates_size_of , :validates_length_of method_missing Eg provide a generic sort method sort_by_x Closures
  • 7. Core Ruby tools (j)ruby the interpreter (j)irb interactive ruby, ~readline support, tab completion ri ruby interactive ~man pages rdoc html doc ~javadoc rake ant/make for ruby gem package manager
  • 8. Ruby anatomy Classes are CamelCased Methods are under_scored Generally no need for curly braces, parentheses, semicolon or return statement code more compact Comments =begin block comment =end # line comment Variables Constant @@classVariable @instanceVariable localVariable :symbol
  • 10. Ruby structure Modules Module::Class Mix-ins interfaces with functionality Namespace Subclass < Superclass Single inheritance only Files are named *.rb can hold many classes require ’file’ include Module searches $LOAD_PATH
  • 11. Access modifiers private Private to this instance (might be a subclass) You can’t specify the receiver, not even self protected Can be called by instances of the same class Eg use for comparators public FFA private :method or private (until end) The modifiers are methods, not keywords
  • 12. Testing Test::Unit::TestCase xUnit for ruby JRuby to test Java code? JtestR to invoke Code coverage might be an issue RSpec BDD
  • 13. Method signature - Java Method overloading Number of method signatures increases fast if flexibility is wanted
  • 14. Method signature – PL/SQL Named parameters Still have to change method signature too add parameters
  • 15. Method signature – Ruby Hash as optional parameter, not named parameters No need to change method signature Hash doesn’t need curly braces Method overload unavailable *args => arguments array
  • 16. More syntax examples =~ regexp matcher myString =~ /[0-9]+/ %w[] String array myArray = %w[ruby java haskell] {||} or do || end closures (and embedded variables) myHash.each { |k, v| puts k+’ is ‘+v } myHash.each do |key, val| puts “#{key} is #{val}” end
  • 17. Ruby on Rails MVC Framework “ Rails is the most well thought-out web development framework I’ve ever used. And that’s in a decade of doing web applications for a living. I’ve built my own frameworks, helped develop the Servlet API, and have created more than a few web servers from scratch. Nobody has done it like this before.” -James Duncan Davidson, Creator of Tomcat and Ant “ Rails is the killer app for Ruby.” Yukihiro Matsumoto, Creator of Ruby
  • 18. RoR principles Opinionated software Convention over configuration DRY REST GET /products #get all GET /products/42 #get id=42 POST /products #create Fast feedback loop just reload, no compile Rails itself is a gem
  • 19. Ruby on Rails concepts rails <appname> generates skeleton routes.rb ~struts-config.xml *.html.erb ~JSP Generators Generates model, view, controller, tests Partials (html.erb snippets) Plugins (instead of gems) Default database is sqlite3 (via JDBC for JRuby) Filters (defined in controller)
  • 20. RoR tools rails <appname> -d <database> script/generate scaffold Person name:string script/server script/console irb with access to the application script/dbconsole enter SQL script/server –debugger debugger in the code drops to console
  • 21. ActiveRecord O/R mapping Db migrations, dev, test, prod up and down database agnostic rake db:migrate config/database.yml Opinionated software primary key named id pluralization class Book => db books
  • 22. RoR model example class BlogPost < ActiveRecord::Base belongs_to :author has_many :comments validates_presence_of :title end comments table needs blog_post_id blog_posts table needs author_id New post need title field
  • 25. ActiveSupport::TestCase Inherits Test::Unit::TestCase Provides helpers, eg http calls <app>/test functional integration unit fixtures/fixtures.yml rake
  • 26. Jruby Motivation The JVM Sneak into the enterprise Reuse infrastructure Integrate with Java applications Performance and scalability
  • 27. JRuby on Rails Develop as Java Netbeans Eclipse Integrate with Java Call EJBs Use JMS queues Use JNDI Use JAAS Deploy on Java As *.war using warbler Rails deployer (JBoss, Glassfish)
  • 28. Java integration include Java / require ”java” include Java::JavaxSwing include_class &quot;javax.naming.InitialContext” require ”path/to/my.jar” prefix javaclasses to avoid name collisions String => JString include_class 'java.lang.String’ {|package,name| &quot;J#{name}&quot; } Method alias System.currentTimeMillis => System.current_time_millis Getters and setters behaves like attr_accessor fields
  • 29. IDE support Eclipse - DLTK (Dynamic Languages Toolkit) Eclipse foundation plugin Support for TCL, Python, Ruby No Rails Eclipse - Aptana RadRails RDT Ruby Editor Rails support generators/scripts Visual debug Testrunner Netbeans Official plugin
  • 30. Conclusion Ruby is sweet! Syntactic sugar Fun to work with Ruby is useful! Integrate with Java OO scripting Rails is probably fast enough Ruby is hard! “ Good programmers become better, bad programmers become worse” Test, test, test
  • 31. Thank you and Namaste
  • 32. Contact © Devoteam Consulting A/S. This document is not to be copied or reproduced in any way without the express permission of Devoteam Consulting. AUSTRIA BELGIUM CZECH REPUBLIC DENMARK FRANCE MOROCCO NETHERLANDS NORWAY POLAND SAUDI ARABIA SPAIN SWEDEN SWITZERLAND UNITED ARAB EMIRATES UNITED KINGDOM +46 (0)733-812135 Phone: [email_address] E-mail: Address Peter Sönnergren Person: CONTACT Author: Date: # ID: DOCUMENT

Editor's Notes