Posts

Showing posts from March, 2013

You are what you code

This is the text of an email I sent last week to Fluid engineering. I wanted to remind and encourage our engineers to do the right thing.   We've all heard "you are what you eat" and we know its true...if not, just eat a diet of junk food for a month and check back with us. Likewise you are what you code. If you are coding junk then you're a junk coder. The fact that you're under a crazy deadline, or someones out sick or the dog ate the homework is a dangerous excuse because challenges like those almost always exist.  The more you practice and apply junk coding, then that becomes how you develop software. That becomes your practice. I've learned the more I practice and apply the best practices of software development the easier and the more natural it becomes (thankfully I've been lucky to work with some good role models to lead the way and help me improve). One such best practice is refactoring code.  I've learned the practice

You must write unit tests for your code

I admit I'm late to this "party" and really only started writing unit tests in the last 2 years. Ok, my bad....because I understand it is critical to write unit tests as you write your code. I get it. And now, so should you if you haven't already. I mentioned the idea of a engineers "prime directives" previously. Well I think writing tests for your code is a prime directive. There's lots of good articles available with benefits, enablers and rationale. Here's some which resonate with me to make the case for writing unit tests. Its easy. There are some great and easy to use testing tools available including Jasmine for browser, which we use on our current project, Mocha which I've used on node.js and Jasmine for node. These tools are very easy to use and simple to get started with. Plus they'll run the tests very quickly. It stops code rot. Unit tests are the key foundation which makes refactoring possible (Please see my previous post