Wednesday, December 4, 2013

OOP is a state of mind

  During the last few days of Launch Academy we've been on the topic of Object Oriented Programming.  Until now, all the applications I've built have been done procedurally, that is, line by line and in order.

  The first day of "OOP I", I pair programmed with someone who's skills were a little ahead of mine.  While the pairing experience as a whole was extremely beneficial, I missed out on deeply understanding some core concepts.  All the reading in the world will only prepare you for building real applications, however, to really grasp subjects as diverse as OOP, you really need to build, get stuck, pull hair out, cry, take a walk, have a revelation and refactor your code; not necessarily in that order.

  The second day of studying OOP,  I realized I had some shortcomings, so I built what we call "OOP II", procedurally.  I did this step in preparation for what was to come.  I wanted proof that I could take a moderately complex application and build it from the ground up in Ruby, as long as it didn't have Classes and very few methods.  You can see the result here: https://gist.github.com/bitsculpt/7780901
The code could be better, but nonetheless, after I finished writing it, I was proud of myself.  Things were surely going to be impossible the next day, when I forced myself to write the same application object oriented.

  Sitting alone today, away from people, away from the chaos some call learning, away from the whiteboards with people collaborating, I GOT IT.  Methods, Classes, and Instance Variables were just some of the concepts that were very fuzzy to me just a short 24 hours ago from the time of this blog post.  You can find my refactored code here: https://gist.github.com/bitsculpt/7797540#file-payroll2-rb

  Today was an incredible day.  Tomorrow I look forward to buzzing around the classroom teaching a few other's the concepts I was able to grasp today.  It's time to sleep, because tomorrow will be the start of Test Driven Development, something I will either love or hate, but either way learn to accept it.