Section 8. Conclusion

And with that, our journey through Ruby and Rails has come to an end. I hope this has been educational and inspirational in your understanding of Ruby, but all I can really wish is that you now have a sense of Ruby’s beauty. You can learn Ruby’s syntax and structure, you can learn its classes and modules, you can even learn its metaprogramming; but without understanding its beauty and philosophy, you might as well learn nothing at all. I want you to have something in the end.

Which, funnily enough, brings me back to the beginning. This digital shortcut originally began life as a presentation to the New York City Ruby and Rails Users’ Group. While hanging out at meetings and on IRC, I noticed that newcomers to Rails often made the same simple mistakes. For instance, instead of using one of Enumerable’s many useful methods, they would construct a for loop and do all the extra work themselves. They were coding Ruby, but thinking of it like Java. It is not that people did not understand syntax or did not know about Ruby’s classes, but rather they just could not conceive of there being any other way of doing iteration beyond the ways already learned from Java and PHP. It became clear to me that learning Ruby without understanding its philosophy was like studying French without hearing it being spoken by fluent speakers—an interesting exercise in grammar but ultimately as dry and lifeless as Latin or ancient Greek.

To my chagrin, I realized I did not really know Ruby myself, because I did not know its principles and how those guided its design. Although I knew how to write small Ruby programs, I had no knowledge of the way fluent speakers use it. I needed a good example to learn from; luckily for me, I did not really know Rails either. So I began reading through Rails source and finding there was no better teacher about how Ruby really can be fluently spoken. And so, my originally dry presentation began life again as a rich exploration into Ruby’s style and how Rails relies on it.

Now I hope it continues for you. A trip like this is easy enough to start (just run gem unpack rails to save Rails’s gem source to a directory or retrieve the latest version of Rails from the subversion repository); all it takes is a question. So, start asking yourself some questions: How do validations work? Where did they add polymorphism to Rails’s associations? How does the controller really know where to find the view? See where these questions take you. I think you will love the journey.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset