I remember, I have a GoF book back in college about design patterns which helped me a lot with my C and C++ programming, since my jump ship to Rails I was trying to use those design patterns I learned previously, Rails is a relatively new paradigm to me, plurals, verbs, REST, DRY.. Can you give me a recommended book for Rails that I can easily understand what I previously learned back in College.
P.S. I suspect Matz knew about the GoF book, and applied it on Ruby... :-)
Design patterns are typical solutions to common problems in software design. Each pattern is like a customizable blueprint used to solve a particular design problem in your code. They define a language that efficiently improves team communication.
The decorator is a design pattern that allows the behavior to be added to an object, dynamically, without disturbing the behavior of other objects of the same class. Decorators can be useful for cleaning up logic/code written inside the view and controller in an RoR application.
Design patterns are classified as three groups. Creational Patterns. Abstract Factory - Provide an interface for creating families of related or dependent objects without specifying their concrete classes. Factories and products are the key elements to Abstract Factory pattern.
Topics such as REST, DRY etc are not really in the same category as the patterns covered by the Gang of Four. There is a book, Design Patterns in Ruby which you might find useful as it covers how the original GoF patterns apply in Ruby. However, once you start programming in dynamic languages like Ruby you often find you don't need patterns in same the same way as you did in languages like C++ and Java.
I would also take a look at The Ruby Way (for general Ruby programming), Agile Web Development with Rails (for a good introduction to Rails) and The Pragmatic Programmer (which covers many of the general practices such as Don't Repeat Yourself.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With