Playing with Ruby on Rails
I've had this on-again, off-again experience with Ruby on Rails. For those of you that don't know Ruby on Rails is a really simple framework and model for building Web applications very quickly and easily. This is not new news and in fact Ruby on Rails has gotten some very significant attention. As a Microsoft guy for many years I simply glanced in the direction of Rails and said "meh". I was immersed in the Microsoft development tools for so many years I wasn't willing to look very hard at things outside my .Net / Visual Studio / C# comfort zone.
My positive experience with my Mac switch led me to rethink that strategy, or at least give it a much better try than the quick glances I gave it before. I did a lot of research, found a lot of information and have found lots of controversy as to whether there is a future in Ruby on Rails. I've also found lots of evidence that some pretty large sites are using Ruby on Rails for their projects. In spite of all that I am in the early stages of really pushing it and so far I like what I see.
The initial challenge was setting up the right build environment which included a MySQL instance and several other components. I struggled with it at first because it was so difficult to deal with, hence the off-again part of the experience. Part of the challenge was that Ruby on Rails (RoR) was in a transition from 1.2 to 2.0 and there were some significant changes to the framework. I started playing with Rails before most of the help and assistance information was updated to reflect the new 2.0 version.
A few weeks ago I came across a post on the Apple Developers site that walks through what's required to actually get Ruby on Rails 2.0 set up and running on Leopard. Turns out I was using 1.2 instructions for getting Rails up and running and the release of 2.0 switched to use SQLite3 as the default development database engine. If you have ever entertained the idea of playing with Rails and you are running Leopard, check out that two part post. It's really easy to follow along with.
One of the things that Apple did and documents in that post is allow you to use Xcode to manage your Rails project. While I found the environment to be pretty cool I liked the editing surface in TextMate, which also has pretty good support for Rails constructs and Ruby code.
In addition I went out and purchased a slew of books that I figured would help me in my education with Ruby the language and Rails the framework. I'll list some of these in later posts as I form more of an opinion on them. One word of caution though: If you just run to Amazon like I did and buy Agile Web Development with Rails you will be disappointed. Not because it's a bad book - I like the style - it's because the book's tutorial does not work with Rails 2.0. They are selling a PDF version of the new book that is supposed to come out in October that will have a tutorial that actually works.
In the mean time if you want to give Ruby on Rails a quick spin on your Mac you should follow those Apple Developer instructions I linked to. Here are a couple more that may get you started and help get some perspective on Ruby on Rails:
Much as I have done with my Mac experience, I hope to share some of my learning process about Ruby on Rails as I go along, from the perspective of a .Net / C# / Visual Studio guy. I know I have a fair number of readers that are using Visual Studio now on their Macs so hopefully you'll get some value out of this.
Who knows though - it may be a very short series if it doesn't go well.
Comments
I discovered this the other day when I ported a tiny Windows C++ command line app over to my Mac with XCode. I had been just using the built in text editor, but had some other task come up that made me open TextWrangler. When I went back to XCode and tried to build, it was asking if I wanted to save some unrelated file I had left unsaved in TextWrangler.
Sorry that I don't know the specifics of how this works or how it's configured, but it might be worth looking into. I'm still debating what text editor I want to use for coding on the Mac myself.
David, I have been curious about Ruby and Ruby on Rails ever since I first heard about them. Problem is, I don't know what they would do for me as a developer. I've never done any web based development and don't really know of any practical uses. I suppose if I made a shopping list program that used a desktop client to edit the database, I could use a web based app to access the list when I was actually out shopping. Is that pretty much the kind of thing Ruby on Rails could do for me? (Not that I have any plans to do this)
I'm more an applications programmer myself, although, I have moved away from that in recent days and started doing software testing professionally. I suppose this is why I am still looking for a job instead of working right now. :(
There is a fundamental shift in the way applications are being deployed, with web based alternatives becoming very attractive to companies that don't want to deal with the local client side applications. Unlike tools like Visual Studio, which can target a great many different classes of applications, RoR is just for web sites.
I used Sean Lynch's excellent tutorial - it builds basically the same application that's in the Agile Web Development with Rails book (Depot). Keep the book handy and follow along with that too.
I say this like I'm an expert but the reality is I'm just learning this too. Hope it helps!
Anon
I'd definitely recommend TextMate as the tool to use : get used to it's tab completion shortcuts and you'll save a load of typing.
However, the main reason for my post is that I notice that you actually bought books for learning RoR. I used to be the kind of guy to buy at LEAST one technical book a month. This gets to be a bit expensive and it really takes up space on the bookshelf (and the once a year garage sale just doesn't get rid enough of the old ones!) I started using O'Reilly's Safari online service. I haven't bought a technical book in two years and I have access to thousands of books and VIDEOS for the same price as a book a month. In addition to the convenience of not have tons of books laying around - you get full-text index searching of their entire library.
@JTaylor: I hear you on the IDE front - it makes it a challenge to try and go back to the "old way" of development with different components for each phase. TextMate, especially with the helpers it has for Ruby work, takes it pretty far. By far the thing I miss most is the function finishing (IntelliSense).
Thanks for the great tip on O'Reilly's service - I had not heard of them before. While I've been buying quite a few technical books lately I don't know that paying on that model would work for me. Plus I'm a dinosaur that's still addicted to the dead tree form for reading. I do like that idea though...
Setting up Rails on Leopard
Setting up Rails on Tiger
Free online course in Ruby on Rails (podcast and screencasts)
Can Rails Scale? Absolutely!
Anyway, after bought it, i bought
Packt Ruby on Rails Enterprise Application Development too and i mainly used ti to step into ROR.
http://www.packtpub.com/Ruby-on-Rails-Enterprise-Application-Open-Source/book
I suggest
Advanced Rails
http://www.oreilly.com/catalog/9780596510329/
and
Pro Active Record: Databases with Ruby and Rails
http://www.apress.com/book/view/9781590598474
for a more detailed view of ROR development.
I use TextMate and Terminal for all my needs. Use the svn and sql bundles for managing projects and databases within TM. You don't need Xcode for advanced stuff. TM is capable of this and more.
Welcome aboard ROR, David. I hope you'll have fun.
Without a doubt the best book out there right now for RoR is "The Rails Way" by Obie Fernandez. It includes Rails 2.0, and goes in-depth in just about any thing you could want to know about Rails. When you finish that book you're going to know the right stuff and know it well.
And if you want to know more about Ruby, get "The Ruby Programming Language" by Matz and Dave Flanagan.
Tnx for suggest the Obi Fernandez book. I read some positive review about it and all of them touting it as 'an expert guide'. Not for someone on his way in the ROR world.
http://www.rubyinside.com/the-rails-way-by-obie-fernandez-679.html
http://www.amazon.com/Rails-Way-Addison-Wesley-Professional-Ruby/dp/0321445619
I'd like to know your opinion in the matter.
Travis, this is an open learning experience for me. If you have specific suggestions don't hesitate to shout them out - I appreciate it man.
If you go to the iTunes store and search Ruby on Rails there are quite a few podcasts some of them are for more advanced users and talk about news in the Rails community but others are for good for learning as well.
And then the forums, railsforum.com is probably number one and there is also the ruby-forum.com.
So just throw yourself in head-first building something you want and when you hit a wall go find the fix.
@semioticmonkey once you've got the basics, MVC architecture, how to move data back and forth from the model to the controller to the view and vice-versa then go ahead and get Rails Way. It's a little difficult but so will every other book at first and at least with this book your effort won't be wasted.
Ruby is not at all complex for me and is quite easy to learn - it's the syntax that's kicking my butt right now. I'm also really interested in the unit testing model being part of the development process - I've always just done that after the fact, more in the debugging phase when something breaks down. That said, I have some crappy programming habits I've fallen into that I need to relearn and I'm using Ruby as an excuse to that as well.
Again, thanks for the help Travis!
Seriously, tnx for the direct input. I've already ordered a copy of it on Amazon.
Pretty impressive index, i must say.
--Tourist in coding-land