RubyOnRails

MVC Antipatterns : Models Antipatterns

Here are some excepts from Rails Antipattern book that I have reading lately. Even though the examples are specific to rails, the fundamental principles applies to pretty much any MVC framework. In this post, I list out various Model Antipatterns & their potential solutions. I would be writing about other anti-patterns in next posts …

Antipattern # 1 : Voyeuristic Models

  • Solution: Follow the Law of Demeter

  • Solution: Push All find() Calls into Finders on the Model

  • Solution: Keep Finders on Their Own Model

AntiPattern # 2 : Fat Models

  • Solution: Delegate Responsibility to New Classes

  • Solution: Make Use of Modules

  • Solution: Reduce the Size of Large Transaction Blocks

AntiPattern # 3 : Spaghetti SQL

  • Solution: Use Your Active Record Associations and Finders Effectively

  • Solution: Learn and Love the Scope Method

  • Solution: Use a Full-Text Search Engine

Advertisements
RubyOnRails, Technology and Software

Complexity is the biggest enemy of successful projects

Curiosity killed the cat & complexity killed the project !!

2008-03-17-curiosity-killed-the-catThe importance of simplicity in application development is paramount. Complexity is the number-one killer of projects today, and it comes into an application in many ways, including through excitement over new features, overly clever developers, and unfamiliarity with the Ruby on Rails framework.