RSS 2.0
 Thursday, June 22, 2006

I have had the idea for a “web 2.0” application for some time, and playing with Ruby on Rails has spurred me to try a pre-alpha development of it. Make it pre-pre-alpha.

So, first step - a basic database diagram. I decided to use SQL Server 2000 as my database (not MySQL which is traditional in the open source world) because that is what I am used to. I like Enterprise manager, and I work quickly inside it. I found playing with MySQL from the command line too limiting.

I have created 4 tables to start:

First you have categories. Categories contain a number of goals. Goals contain a number of paths. And paths contain a number of steps. This is by no means complete or final, but it's a start.

Now, lets see if I can get a series of web pages set up to manage these four tables and their nested relationships.

By the way, there is a pretty good rails tutorial at O'Reilly OnLamp.

Once I have the database created, and have configured Rails to use SQL Server, I then use ruby to generate the model and component objects for these classes.

What is a model? A model is a data-tier object that represents a database table - it is a class. It provides the basic data-related create, delete, update, and find functionality.

What is a controller? A controller is an application-tier object that publishes a number of predefined (inherited) and custom methods and properties. It is also a class, but it is one level of abstraction above the database object.

Now I can generate the models and controllers separately. You can see what that looks like here and here. But I want Ruby to go that extra step further and generate all the starting code I need for my web app. You'll see what I mean in a second.

You know the old saying, “it's easier to edit than to create“, so I am going let Ruby create the basic HTML and classes needed for my application, and I will simply edit the pages according to the look and feel I want for the site. This pregenerated code is called “scaffolds”, and they are pretty cool. This will generate the models and controllers at the same time.

I will do this for all four of my database tables.

Finally, when I start the ruby web server (“ruby script/server”) and point my web browser to http://127.0.0.1:3000/categories I get:

Which is ugly as sin, but at least it's something to start editing. When I add a few sample categories it gets a bit better:

This is fun. Ruby on Rails is fun.

 

Thursday, June 22, 2006 10:34:47 PM (Eastern Daylight Time, UTC-04:00)  #    Comments [2] -
Demo Code | Ruby on Rails | Technology
Del.icio.us Digg Technorati Blinklist Furl reddit
 Wednesday, June 21, 2006

So I finally gave in to the hype and downloaded the new Web 2.0 programming language, Ruby on Rails.

Ruby is a relatively new (1998, I believe) programming language that aims right for “developer productivity”. Someone sat down, I suppose, and combined all the easy-to-use-but-powerful parts of Smalltalk, Python and Perl. Does the world NEED a new programming language? Well, usually the answer is no but Ruby is starting to gain some traction as a powerful tool. People are starting to port Ruby to .NET even.

Rails is a web application framework developed by the folks at 37 Signals for Ruby. 37 Signals is famous for their easy to use web applications such as Basecamp, Backpack and Ta Da List.

The claim made by Ruby on Rails is that you could get a new web application up and running in minutes, where it would take days using another language such as ASP.NET. Now when hearing someone claim a web site could be up and running in “minutes”, I instinctively roll my eyes and think, “Yeah, right.”

Last night I ran through the ONLamp Ruby on Rails tutorial, and I must admit to being impressed.

Perhaps the revolutionary feature is this thing called “scaffolds”. Rails will actually provide a default set of CRUD (create, read, update, delete) pages for any database table. So if you have a database table of employees, you simply run a couple of command line programs, and Rails will create a bunch of web pages to let to manage those tables through the browser. It's amazing. Maybe you have to see it in action to be blown away.

I'm still getting into it. I'll spend more time with it tonight. But I have just begun customizing those pages, and working with multiple tables.

I will update this blog later with more on my experience with Ruby. Maybe I'll even have a web application to share with the world, in 15 minutes development time!

 

Wednesday, June 21, 2006 4:49:48 PM (Eastern Daylight Time, UTC-04:00)  #    Comments [0] -
Technology | Ruby on Rails
Del.icio.us Digg Technorati Blinklist Furl reddit
Archive
<May 2008>
SunMonTueWedThuFriSat
27282930123
45678910
11121314151617
18192021222324
25262728293031
1234567
About the author/Disclaimer

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

© Copyright 2008
Scott Duffy
Sign In
Statistics
Total Posts: 453
This Year: 12
This Month: 1
This Week: 0
Comments: 70
Themes
Pick a theme:
All Content © 2008, Scott Duffy
DasBlog theme 'Business' created by Christoph De Baene (delarou)