NetBeans & Ruby David Botterill Software Engineer Global Technology Manager - Campus Ambassador Program Sun Microsystems, Inc.
2 Agenda Ruby JRuby Ruby on Rails NetBeans Ruby Support Next Steps
Ruby
4 Invented by Yukihiro Matsumoto (“Matz”) starting in 1993 > Goal: “Make Ruby natural, not simple” Released to the public in 1995 Popularity began in 2000, jumped in 2006 with Rails web framework
5 Ruby Ruby is an object-oriented programming language Ruby is a single-pass interpreted language The official implementation is free software written in C Ruby has a package manager called “RubyGems” that manages packages called “Gems”
6 Everything, including a literal, is an object Array and Hash support Ruby Language Basics Ruby
7 Demo Everything an Object Arrays and Hashes
8 Blocks and iterators > A block is defined between “{ }” or “do end” > An iterator is a method that processes blocks > The iterator “yield”s to the block > The block is a set of code that can process values from the iterator Ruby Language Basics Ruby
9 Demo Blocks and Iterators
10 Mixin > Ruby supports “Module”s - a collection of methods > Ruby only supports single inheritance > A Ruby class can “mixin” one or more modules to take advantage of the methods in the module Ruby Language Basics Ruby
11 Demo Mixins
12 Variables > Ruby is strongly typed > Ruby is dynamically typed > var.kind_of? Scope > var – could be a local variable – instance variable > – class variable > $var – global variable > Var – constant (can be changed in Ruby) Ruby Language Basics Ruby
13 Demo Variable Scope
14 Metaprogramming - “Programs that write programs” > missing_method > Code evaluation “class_eval” > Ability to add methods dynamically to an existing class even built-in classes Ruby Language Basics Ruby
15 Demo Metaprogramming
16 “Duck Typing” > If it walks like a duck and sounds like a duck, treat it like a duck > The class's methods are the important part, not the type > In other words, the objects action abilities are what's important regardless of what type of object it is > Eliminates casting > Natural for a language that is dynamically typed Ruby Language Basics Ruby
17 Demo Duck Typing
JRuby
19 JRuby is a Java Implementation of the Ruby Language JRuby is free software released under a three-way CPL/GPL/LGPL license. JRuby is tightly integrated with Java to allow the embedding of the interpreter into any Java application with full two-way access between the Java and the Ruby code JRuby offers all the performance benefits of using a JVM JRuby
20 Demo JRuby
Ruby on Rails
22 Ruby on Rails is a free web application framework RoR aims to increase the speed and ease with which database-driven web sites can be created Scaffolding - Ability to generate majority of the web application Applications developed using the Model-View- Controller design pattern Ruby on Rails
23 RoR Guiding Principles: > DRY - “Don't Repeat Yourself”, don't write the same code over and over again > Convention of Configuration – Rails makes assumptions about what you need to do and how you should do it (convention) rather than allowing you to configure all the details > REST (Representational State Transfer) is the best pattern for web applications Ruby on Rails
24 Demo Ruby on Rails
NetBeans & Ruby
26 Netbeans Ruby Support Comprehensive support for Ruby editing > Code Completion > Parameter Hints > Smart Indent > Smart Selection > Formatting > Pair Matching > RDoc Support and String Support > Spell Checking > Syntax highlighting > Navigation display > Code Folding > Background error parsing > Mark Occurrences > Go To Declaration > Instant Rename > Code Templates
27 Netbeans Ruby Support Refactoring > Find Usages > Rename > Other Refactorings Project support > Gem Support > File Type Recognition > Project Support > Unit Tests > IRB - Interactive Ruby Shell
28 Netbeans Ruby Support Debugging Support > Classic and fast debugger support > RHTML debugging > tool-tip variable and expression evaluation > Views (variables, stacks etc.) > Breakpoints > Session (multiple debugging session, finishing, switching support) > Thread (state, thread switching support) > Breakpoints management > Stepping (over/into/out/resume) into project, core, loadpath classes, RHTML
29 Netbeans Ruby Support Unit Test Support > Test::Unit – Ruby built-in test framework > Rspec – Behavior driven testing > AutoTest – optional continuous test environment
Next Steps
31 Get Involved Join the NetBeans Community! Next Steps Join the NetBeans OSUM !
32 Next Steps NetBeans: > Latest news and community information > Netbeans Plugins NetBeans & Ruby Wiki: NetBeans Community: > Forums, support, how to get involved NetBeans Ruby and Rails Learning trail Ruby developer Center at SDN Resources
33 Next Steps Free Ruby on Rails Training by Sang Shin Netbeans IDE Features for Ruby - Ruby User's Guide - doc.org/docs/UsersGuide/rg/index.html doc.org/docs/UsersGuide/rg/index.html The Programmatic Programmer's Guide - doc.org/docs/ProgrammingRuby/html/index.html doc.org/docs/ProgrammingRuby/html/index.html Ruby Essentials Resources
34 Get FREE Web-based training on Java TM, Solaris TM & more! > Visit: > Course registration code from your Campus Ambassador Increase earnings potential with a Sun Certification! > Sun Certified Associate/Programmer for the Java 2 Platform SE > Sun Certified Web Component Developer for Java EE > Sun Certified Mobile Application Developer for Java ME > Sun Certified System/Network Admin for Solaris Operating System Free practice exams Discounted exams fees for academic developers – only US$60 (US$40 in APAC and Latin America) Next Steps Fast Track Your Career with Sun!
THANK YOU! David Botterill NetBeans & Ruby