woensdag 22 mei 2013

Be a Pragmatist, not an Evangelist.



A couple of weeks ago, during a code retreat, I was pairing up to start a new coding session.  As I wanted to write the first test, my partner said that I should avoid the word ‘should’ in my test names.  I kindly nodded my head but the first thought that crossed my mind was: here we go again.  As it appears, the word ‘should’ implies that my test might do something without any certainty that it will do something… Granted, it’s not wrong what I was told, still I was wondering: how much time and sometimes even money are developers wasting participating in these kind of über developer sensei discussions?

Don’t get me wrong, I find discussions about code intriguing and I love learning from my fellow developers.  But… aren’t we sometimes pushing these kind of discussions into the ridicules? An industry as infantile as ours (not necessarily by age) should be worrying about larger problems.

It seems kind of trivial that this gets me going, but just think about how many times developers are wasting time and are overengineering their code because of silly discussions like these. 

For example, take the one assert per test rule.  How many evangelistic developers have I seen taking this rule to the extreme.  Testing a simple 1 on 1 mapper property by property.  And for what reason?  Because there is a golden rule that tells you that you must do this or you're not writing clean code?  Why not be more pragmatic? In many cases you have a beautiful set of testing tools! Use them to send messages to your test runner.  Extend your tools to make life easier.

Extremism can be a good thing to! Take Robert C. Martin, he’s one of my favorite speakers and is my favorite writer.  Yet, he is the Osama Bin Laden of clean code.  I can’t imagine anyone taking it more to the extreme than him.  In his case, good! We need magnets like these pulling developers away from the dark side of procedural spaghetti code.  Just as long as these developers still have a mind of their own, and know that the only golden rule is that there isn’t a golden rule.

Strive for Perfection, Settle for Excellence.

zaterdag 5 januari 2013

Writing code on the Windows RT


So I've got this Surface RT thing sitting on my coffee table and I don't know what to do with it.  The first thought that crosses a developer's mind is: can I write some code on this?  At the moment of writing there are is no IDE or compiler available for Windows RT.
So this is going to be a bit harder than I thought.  I don't have enough free time (not to mention intelligence), to start writing my own compiler so let's forgo languages that need to be compiled to either intermediate language or machine language.  So scripting it is then.  Powershell is an option, but then I'd have to come up with some kind of way to start unit testing this stuff.  Do I want to write scripts in powershell beyond automation?  I want to write code that can be written in a TDD fashion and be represented in a fancy way.

Then it struck me, I already know how to do this... html and javascript.  Next thing I did was set up a small javascript and html project with Qunit and the html5 canvas.   This turned out to work pretty well.  The only pain I felt then was the lack of a descent enough IDE beyond notepad.  I searched the store and bought a texteditor with syntaxhighlighting.  There are some bugs that need to be ironed out but it suits my needs pretty well. 

Now I just snap my browser on the left side of my screen to use it as testrunner and on the right side of the screen I can code.  Just refresh the left side to watch your tests run.



So If the surface RT is your only device at the moment and you want to write some code, then I encourage you to download this startup project, a syntax highlighting texteditor and start coding!

Have fun!