Wednesday, December 28, 2011

Changes

In the last 6 months I've learned more about software development than I have in my entire life.  In my opinion, the most fundamental aspect of software development is being able to prove the code you've written does what you claim it does.  This is achieved through writing a complete test suite that executes every line of your code, providing known inputs and checking the return value against expected results.  Aside from being able to know your code is behaving as expected, this also allows you to instantly identify when your code stops working.  Because you have a complete test suite that hits every line of code, with any change you simply execute your tests and any bug that was introduced to the environment will be exposed.  Being able to guarantee the quality of your code allows you to program at ease and try out new ideas with out the fear of ruining your existing functionality or having to spend hours (if not days) making sure your new change didn't break anything unintended.

This is the premise of Test Driven Development and Behavior Driven Development.  A contractor that is working for us right now dropped me a little note which was the catalyst for this post:

"when I started programming in rails, by default, I would implement all the default actions in a controller with the assumption that it would be used in the future. with cucumber however, it forces you to implement only the actions needed. this works out because you just implement the actions that are needed to complete that feature. it is surprising, because by writing so much less code, you make the app more secure and also the app does exactly what is needed by the business (no more and no less) A pleasant side effect of BDD"

1 comment: