Refactoring conditionals out of your code
Using inheritance and OOP to remove complexity
Today I will be doing something a little different.
I have prepared some Ruby code to show how conditionals can breed like rabbits, and how to spay and neuter those bunnies before it gets out of control.
Along with the code, there is a screencast or as I will call it, a RubyLovecast. In the video, I will walk you through several revisions of the code, first showing how conditionals grow, then how to take a weedwacker to them.
I am looking for feedback, so tweet that shit at @thatrubylove and hit me hard. My plan is to take a weeks worth of feedback and then ‘reshoot’ the screencast, taking your input into account.
So until next week’s rubylovecast…. love and hacking