Download DB2 Express-C: The Developer Handbook for XML

Transcript
򐂰 Ruby language comes with a code profiler. You can invoke it at command line
or in the program.
򐂰 Ruby comes ready for Web programming. Ruby can be used to write CGI
scripts for Web programming.
B.1.1 Getting started with Ruby programming language
Getting started with Ruby could not be easier. Ruby is available on all operating
system platforms, including Windows. We show you how to start with Ruby.
Following the new programming language learning tradition, we write and run a
Hello World program in Ruby.
First, you download and install Ruby language pack from the following Web site:
http://rubyforge.org/frs/?group_id=167
Choose the latest stable version. In this example, we downloaded
ruby1.8.4-20.exe and extracted the code in C:\ruby folder. Once extracted, Ruby
is ready to use. Let us write our first program in Ruby.
򐂰 Change the directory to C:\ruby and edit a new notepad file with this content:
puts “Hello Ruby World !”
򐂰 Save this file as hello.rb.
򐂰 On command prompt, run it as shown:
C:\ruby>ruby hello.rb
򐂰 You should see the output as below:
Hello Ruby World !
For your learning pleasure, the Ruby package comes loaded with lots of
samples. You can browse some of these samples in the following folder:
C:\ruby\samples\RubySrc-1.8.4\sample
B.2 Introduction to Ruby on Rails
Ruby on Rails (ROR) is a Web application and persistence framework that
includes everything needed to create database-backed Web applications
according to the Model-View-Control pattern of separation. This pattern splits the
view (also called the presentation) into templates that are primarily responsible
for inserting pre-built data in between HTML tags. The model contains the
"smart" domain objects (such as Account, Customer, and Product) that hold all
the business logic and know how to persist themselves to a database. The
Appendix B. Ruby on Rails
315