Writing small and easily testable methods can certainly clean things up, but as your application grows your classes start to know too much. Large classes means a large cognitive overhead for understanding how things work, or why they don’t.
Your codebase is getting harder to manage with every feature you add.
Perhaps you even argue about the merits of documenting your code. Sure, you may strive to make your code more readable but actually reading it doesn’t reveal how your application works as obviously as it should, and falling back to documentation isn’t going to change your code. That’s bad news when you’re doing maintenance work and even worse for newly hired developers.
“Your ability to reason about your program is critical to debugging”
— Rich Hickey, Creator of the Clojure programming language.
Your code is getting less and less clear and debugging is becoming a common problem.
Even hiring a new developer means everyone needs to slow down to get him or her oriented with the code.
Object oriented programming is supposed to make this easier.
While following the Model View Controller approach has made your code cleaner, and following conventions have reduced the need for documentation, there’s still plenty of room for improvement and too much time needed to instruct new developers. MVC was meant for reflecting the end user’s mental model but it still makes it too easy to hide the intentions of your program in your code.
Sending developers to read docs, wikis and tests just to understand your system is a time-consuming and oft-ignored task. Ruby code should be readable!
Wouldn’t it be so much better to open up a project and have it fit like a glove?
If there was a way to write code that un-complicated the logic and put it in plain view, that would make things so much clearer. If you could write the business use cases in easy to read Ruby code, you’d be programming with a smile every day knowing all your effort is right where it needs to be.
You can make this happen and “Clean Ruby” will teach you how.
Make your code more obvious and put the logic right where you expect it; read “Clean Ruby” and enhance your MVC design with DCI.
Data, Context, and Interaction (DCI), was created by Trygve Reenskaug (whom you may know as the creator of MVC) to make your code read the way it behaves. Pull everything out of its hiding place with “Clean Ruby” and learn how using the DCI paradigm means readable code and a super fast learning curve for your newest team members.
“The purpose of DCI is to produce code that a person can read and understand and so reason about its correctness”
— Trygve Reenskaug
Write code that announces how it works with the techniques in “Clean Ruby” and your newest developers will be interrupting your instructions with “I know.”
And with that you’ll have a team that understands the business needs better than ever leading to better code, fewer bugs, lower costs, and happier customers.
Jim is the Lead Developer for Radiant CMS and is a prolific contributor to it and many open-source projects. At Saturn Flyer LLC he’s built numerous Radiant sites, custom applications, and award winning graphic design and has had his designs published in HOW Magazine and The Best of LogoLounge. He’s been a co-host of the Ruby 5 podcast, speaker at ArrrrCamp and RubyNation, founder of Arlington Ruby and has been professionally building Ruby and Rails applications since 2006.
What people are saying:
“I’ve seen Jim present on this topic and he’s at the forefront of applying this approach to Rails projects. I’m eagerly looking forward to reading his book.”
— Avdi Grimm, Author of “Exceptional Ruby” and “Objects on Rails”
“I have not come across such a revelatory approach to things since first learning OOP.”
— Mike Pence, Owner at Hayduke Labs, LLC
“Your approach to DCI is the most actionable, most practical explanation I’ve seen so far.”
— Jeremy Weiland, Owner of 6th Density LLC
“Clean Ruby from @saturnflyer http://clean-ruby.com/ will change the way you design your Rails apps. #rails”
— Hector Sansores
“Clean Ruby, by @saturnflyer, is one of the few programming books that caught my attention like this. Very well written, a perfect flow.”
— Alexandre Oliveira
“Really interested to see Clean Ruby from @saturnflyer when it comes out. Bet there’s good info regardless of platform.”
— Jim Holmes, Automated testing guru at Telerik
“Jim is one of those rare people who can crank out award winning site designs, go and implement the backend Rails functionality, and be lead engineer for his project team… all on one project. I’ve seen him do it.
Jim is someone to watch out for, and get on your project if you can. (Especially with his upcoming book, which I think will rock the Ruby on Rails world a little bit, changing how the community thinks about large/complex Rails codebases.).“
— Ryan Wilcox, Owner, Principal Engineer at Wilcox Development Solutions and former co-worker
“Just finished @saturnflyer book: Clean Ruby. So far, a good read. You need to buy this!”
— Rob Evans
“It’s awesome that @saturnflyer writes a book about Ruby and DCI. Finally a book about full OOP and Ruby. "Clean Ruby” http://www.clean-ruby.com/“
— Andrzej Krzywda, Founder gameboxed.com
“Your book helps me raise my game.”
— Jim Finucane
“The current version of Clean Ruby is a great start on a critical topic. Learning how to keep code clear and understandable is useful for any kind of project. I’ve already applied a couple of ideas from the book to keep a project from mumbling in the shadows. I’m excited to see the rest.”
— David Richards, Fleet Ventures