Nuvo
12-27-2005, 01:08 PM
Hello.
The other day, I recalled seeing a blog post about Ruby on Rails and one of the tech movies from the Rails site (http://www.rubyonrails.org).
The movie in question showed how you could, in theory, have a very basic blogging system up and running in under an hour using Rails.
I had a basic idea of what Rails was and the movie was quite interesting, so I thought I'd try it out myself since I had been promised a nice and powerful language before, but had been dissapointed by poor syntax and such (hello perl).
For those who don't know, Rails is an application framework which is supposedly capable of lowering the workload required to get things running by handling some things for you and by generating some base files for you to edit, kind of like a R.A.D. IDE but without the drag and drop design interface.
Ruby is another multipurpose interpreted language which is supposed to be a fair bit like python (YAY!!) or a better alternative to perl (the name ruby was chosen to compliment the name of perl).
Anyway, once I'd installed ruby and then rails via ruby's gem package manager (I know, it all sounds very *nix-ish, but I am using XP) and I had downloaded the .mov that shows how to make a blog in such a short time, I was pretty much set (I already had a better version of SciTE installed and I had to download the movie so I could resize it to gain access to the quicktime controls... stupid apple media player).
The first thing I noticed about the movie was how the guy walking us through it has one of those really irritating voices and a tendancy to say "whoops" when ever he does something, but as he is one of the more integral developers of rails, that can be forgiven.
The first thing I noticed is that rails seems to start off doing a fair bit of hand holding in terms of generating the directory structure and binding stuff together.
I don't think this is a bad thing as not everyone knows PHP or some other web scripting language and it does save time.
The advantage of having the framework set up a fair bit of the database connection coding is that it both saves time, and reduces the need to type out masses of SQL queries (in PHP, I have often found myself either running the same sort of query multiple times for different things, or building functions just to get around doing that), but on the flip side, you don't get as much knowlage of SQL as you do with standard PHP and others.
Basically, once you've got your database made, you just modify one file which has your database setting in it, and bam, you don't have to worry all that much about the database end after that.
Once I had got the basics up using the movie as a tutorial, I thought I'd trawl google's murky depths for info I could use to add more functionality to my little blog which had been thrust into the world.
The thing is, rails isn't quite as mature as PHP or even Ruby, so documentation on rails can be harder to find, and even when you do find what you're looking for, don't always expect it to work 100%.
The movie is a good example of this as it quite happly goes through adding textile functionality (thing BBCode, but not), but neglects to mention that in order to use the textilize functionality of rails, you need to install another gem (gems are like libs or DLL's, they add more features to Ruby) called RedCloth...
I was sat there wondeing why the hell it worked for him, but not for me, so I googled it and after a bit of trawling, I found out about RedCloth and it worked (don't you just love inferior quality tutorials / demo's?).
Since documentation can be fairly hard to find on implementing specific features, I opted to add member features using one of the available authentication generators.
This was actually simple enough to do, just install (gem will try to do a remote install from the rubyforge website if you don't have the file on your system), generate a login system with:
ruby script/generate install user
And tell it what to protect and such.
With that done, I thought I'd play around since rails has built in AJAX support (AJAX is a way of creating a dynamic interface by using the xmlhttprequest object and javascript with a server side language like PHP or RoR, AJAX isn't another language).
I decided that it'd be cool if I could have something similar to Typo (http://typo.leetsoft.com/trac/), which is made with rails and has neat effects when adding or removing comments from blog entries.
To do this, it just took a bit of editing to 2 files, but I didn't have to use any other scripting language than ruby as rails did the AJAX for me.
Well, that was almost smooth sailing... It fades the comments from view, updates the database and then scrolls down a list of comments in a pretty attractive way, but due to my inexperience with Ruby on rails and the standard of some of the documents I was reading, it doesn't seem to like showing the comment right after it's added and you end up refreshing to see it... (I don't know if this is because of me or what, but I'm guessing so)
When I ran the stats using ruby's rake tool, it came out that I had managed this with 165 lines of code if you count the fact that I also shipped the skin of my PHP blog to the rails version and the mistakes I have made while stumbling through this first endevour.
The end result has been that I have pretty much replicated a blog I built with PHP using rails, minus a skin changer and gzip compression, but I have also added some things to it which my puny knowlage of javascript would have made quite difficult with PHP and without using mod_rewrite, I already have nice looking url's.
I'm not sure rails will be the next big thing after PHP, but it has definitely thrown the idea of a framework for web developemtn into the view of many more web developers than others before it, which is probably why projects such as PHP on TRAX have sprung up (formerly PHP on rails) and I definitely think there's some future for similar web frameworks.
The other day, I recalled seeing a blog post about Ruby on Rails and one of the tech movies from the Rails site (http://www.rubyonrails.org).
The movie in question showed how you could, in theory, have a very basic blogging system up and running in under an hour using Rails.
I had a basic idea of what Rails was and the movie was quite interesting, so I thought I'd try it out myself since I had been promised a nice and powerful language before, but had been dissapointed by poor syntax and such (hello perl).
For those who don't know, Rails is an application framework which is supposedly capable of lowering the workload required to get things running by handling some things for you and by generating some base files for you to edit, kind of like a R.A.D. IDE but without the drag and drop design interface.
Ruby is another multipurpose interpreted language which is supposed to be a fair bit like python (YAY!!) or a better alternative to perl (the name ruby was chosen to compliment the name of perl).
Anyway, once I'd installed ruby and then rails via ruby's gem package manager (I know, it all sounds very *nix-ish, but I am using XP) and I had downloaded the .mov that shows how to make a blog in such a short time, I was pretty much set (I already had a better version of SciTE installed and I had to download the movie so I could resize it to gain access to the quicktime controls... stupid apple media player).
The first thing I noticed about the movie was how the guy walking us through it has one of those really irritating voices and a tendancy to say "whoops" when ever he does something, but as he is one of the more integral developers of rails, that can be forgiven.
The first thing I noticed is that rails seems to start off doing a fair bit of hand holding in terms of generating the directory structure and binding stuff together.
I don't think this is a bad thing as not everyone knows PHP or some other web scripting language and it does save time.
The advantage of having the framework set up a fair bit of the database connection coding is that it both saves time, and reduces the need to type out masses of SQL queries (in PHP, I have often found myself either running the same sort of query multiple times for different things, or building functions just to get around doing that), but on the flip side, you don't get as much knowlage of SQL as you do with standard PHP and others.
Basically, once you've got your database made, you just modify one file which has your database setting in it, and bam, you don't have to worry all that much about the database end after that.
Once I had got the basics up using the movie as a tutorial, I thought I'd trawl google's murky depths for info I could use to add more functionality to my little blog which had been thrust into the world.
The thing is, rails isn't quite as mature as PHP or even Ruby, so documentation on rails can be harder to find, and even when you do find what you're looking for, don't always expect it to work 100%.
The movie is a good example of this as it quite happly goes through adding textile functionality (thing BBCode, but not), but neglects to mention that in order to use the textilize functionality of rails, you need to install another gem (gems are like libs or DLL's, they add more features to Ruby) called RedCloth...
I was sat there wondeing why the hell it worked for him, but not for me, so I googled it and after a bit of trawling, I found out about RedCloth and it worked (don't you just love inferior quality tutorials / demo's?).
Since documentation can be fairly hard to find on implementing specific features, I opted to add member features using one of the available authentication generators.
This was actually simple enough to do, just install (gem will try to do a remote install from the rubyforge website if you don't have the file on your system), generate a login system with:
ruby script/generate install user
And tell it what to protect and such.
With that done, I thought I'd play around since rails has built in AJAX support (AJAX is a way of creating a dynamic interface by using the xmlhttprequest object and javascript with a server side language like PHP or RoR, AJAX isn't another language).
I decided that it'd be cool if I could have something similar to Typo (http://typo.leetsoft.com/trac/), which is made with rails and has neat effects when adding or removing comments from blog entries.
To do this, it just took a bit of editing to 2 files, but I didn't have to use any other scripting language than ruby as rails did the AJAX for me.
Well, that was almost smooth sailing... It fades the comments from view, updates the database and then scrolls down a list of comments in a pretty attractive way, but due to my inexperience with Ruby on rails and the standard of some of the documents I was reading, it doesn't seem to like showing the comment right after it's added and you end up refreshing to see it... (I don't know if this is because of me or what, but I'm guessing so)
When I ran the stats using ruby's rake tool, it came out that I had managed this with 165 lines of code if you count the fact that I also shipped the skin of my PHP blog to the rails version and the mistakes I have made while stumbling through this first endevour.
The end result has been that I have pretty much replicated a blog I built with PHP using rails, minus a skin changer and gzip compression, but I have also added some things to it which my puny knowlage of javascript would have made quite difficult with PHP and without using mod_rewrite, I already have nice looking url's.
I'm not sure rails will be the next big thing after PHP, but it has definitely thrown the idea of a framework for web developemtn into the view of many more web developers than others before it, which is probably why projects such as PHP on TRAX have sprung up (formerly PHP on rails) and I definitely think there's some future for similar web frameworks.