Tuesday, April 7, 2009

WORKSHOP 1

LEARN RUBY AND RUBY ON RAILS

The first thing to do is understand the tool we are going to be using. Ruby on Rails is considered today as the hottest technology in web application development. A really good way to introduce you to this technology is visiting the web page: http://www.buildingwebapps.com/podcasts, in this page you will find a series of Audio Lessons and Screencasts that clearly explain what it is “Ruby” and “Rails” technologies. You also can subscribe yourself by writing your name and e- mail to receive periodically the podcasts that will introduce you to Ruby. (See picture bellow)

Screenshot: Subscribing for Ruby audio lessons



INSTALL RUBY AND RUBY ON RAILS

After an understanding what is Ruby and what it is for, the second step is installing Ruby and Rails in your computer as I’ll show you:

1. Get into the web page
http://rubyonrails.org/download and click on Windows Installer (if you are a Windows user) as shown in the figure. Then download and install the latest version clicking on the executable application.


2. Run the setup and follow Instructions until installation is finished as shown in pictures.




3. Once Ruby is Installed, download and Install RubyGems which install Rails and its dependencies through the command line. You can also find the latest version from http://rubyonrails.org/download.

4. Finally run “RubyGems Package Manager” from your program list and type in the command line “gem install rails” to install rails. (See screenshot bellow).



And that’s it, you Ruby on Rails is installed and ready to go.Any inquiry or problem installing the application just let us know and we’ll try to help you out.

INSTALLING INSTANT RAILS (For Windows)
For Windows users, you can also install directly "InstantRails". This package contains Ruby and Rails, so I personally recommend to install InstantRails rather than everything separately.Just follow this link, get the latest version, and better download it first to your computer.http://rubyforge.org/frs/?group_id=307


You can unzip the file direct on the previously created ruby folder on "C:".
Unzipping and installation it's going to take a while. The process took me about 10 minutes and 15 to my friend's, I thought the computer got stock but it's just matter of time, so, be patient.


To run InstantRails, go to the folder where you extract the files and find the executable file (an icon with a big "I"). Then you should see this screen.



INSTALLING LOCOMOTIVE (For OS X users)

How to install ruby on Mac OS X Leopard?

In Leopard and Leopard Server, Ruby and Rails are pre-installed along with a bounty of other useful RubyGems. This means we can hit the ground running when it comes to developing a Rails application and keep up the pace when deploying new releases of our application to Leopard Server.

Out of the box, you get Ruby version 1.8.6 and Rails version 1.2.6, the latest stable releases at the time Leopard shipped.
TRY SOME RUBY
Use mac terminal to try first simple ruby program " hello world"
find and open terminal, and try:
~ zc$ irb***
>> print "hello world\n"
Hello world
=>nil
use Math lab.

UPDATE NEWEST RUBY ON MAC X

Ruby in mac is buildin, however how can we get newest one?Just by using some simple command (you need connect to internet)in Terminal window:

sudo gem update --system
sudo gem install rails
sudo gem update rake
sudo gem update sqlite3-ruby
Now you can get newest ruby version!, and same time please install xcode or textmate.
Textmate is not free so, if pople don't like pay money and even take care about copyright please use Xcode 100% free download from apple web.
Install if as install normal software.


Challenge Problems - Workshop 1


1. Make a list of all programming languages and Web development tools used by you in prior experiences. Describe what you know about Web application frameworks

There are several programming languages at these days I started many years ago using PASCAL, later I learned C++ and Visual Basic, each time the languages are getting simpler and with more applications, but normally following the same programming logic “object-oriented”. Particularly the last one allows me to easily create XML files using some applications, where this information was shared on the net using Web Services. Furthermore Ruby is also an object-oriented programming language but relatively newer, Ruby is has been getting even more popular due to “Ruby on Rails” or just Rails which is a web application framework that using a fast methodology has reduce considerably the time developers spend developing websites or Web applications.


2. Ruby is “an interpreted scripting language” for quick and easy object-oriented programming”. Find out about the Ruby language and discover what this means.

Ruby was designed by Yukishiro Matsumoto on 1990, it is considered as “the hottest technology for web applications” (Slater, M.). Inspired on Pearl and Python, Ruby is defined as an object-oriented language, because like any other object-oriented language an object encapsulate some data and the actions to be taken on these data, then your program is build based on this “capsules”. Ruby it is also an interpreted scripting language due is interpreted dynamically when the program is been executed, hence, not compilation required.


3. What is Rails and how does it work with Ruby?

As it was mentioned on question 1, Rails is a web application framework based on Ruby programming language. Slater (n.d.) well explained in the first podcast of Ruby on Rails saying that “an application framework such as Rails provides a structure for your code and includes a variety of powerful code modules that make many programming tasks simpler”. To organize application programming, Rails uses the MVC architecture just like many web framework, but providing metaprograming methods to build databases applications, Rails can automatically construct models and views for a simple website utilizing common tools included in the Rails framework.


4. What is meant by “convention over configuration” in regards to the use of Rails in Web application development?

So far so good, Ruby on Rails is been showing to be an excellent new way to develop web applications. However the best of Rails that I personally reckon, is that emphasise Convention over Configuration (CoC). There are a lot of things to consider developing web applications and, and one of them is structuring things. It is well known that all these web applications have a lot in common, so, many time is spend doing things over and over again.

Convention means that developing on Rails its only necessary to consider non-conventional features of the application due “it is built around a set of opinions about how to build web applications”. This leads to minimize the developers time reducing the configuration code and less repetition.


5. When did Model-View-Controller begin and where is it used?

An MVC begins when a web framework is used. In our case, for instance MVC is started when we use Ruby on Rails to develop and organize web application programming.

MVC uses its architectural pattern Model-Controller-View. Where “the Model represents the information of the application; the View corresponds to elements of the user interface such as text, checkbox items, and so forth; and the Controller manages the communication of data and the business rules used to manipulate the data to and from the model” Wikipedia (n.d)


6. Describe the steps involved with the MVC design Approach.

The way that MVC works is pretty simple. Basically there are an interface where the user is able to interact with (write a query or press a mouse button) → the controller gets the action from the user → the model controller sends to the model the event occurred on the interface → View uses the model and create an new corresponding user interface →Finally everything backs to status quo waiting for the next interaction to resume with the cycle.

The following diagram shows the relationship between Model, View and Controller. Where solid lines means direct associations, while dashed lines shows indirect associations

References:

Building web applications (n.d). Ruby Lessons podcasts. Retrieved March 20, 2009, from http://www.buildingwebapps.com/podcasts

Wikipedia. The free Encyclopaedia. Retrieved March 28, 2009 from http://en.wikipedia.org/

No comments: