karldmoore development

A development oriented blog, containing anything I've been working on, reading or thinking about.

Archive for November, 2008

I’m A Software Developer, But I Don’t Work With Computers

Posted by karldmoore on November 12, 2008

Let me set the scene for you. You’re at a friends party and you meet up with some new people. After the opening pleasantries, the conversation soon comes around to your day job. So I start off with the obvious, “I’m a software developer.” This usually leaves people quite puzzled so I try a different approach, “I write computer software.” And it’s at this point you hear those words you dread so much, “ahhhh you work with computers!”.

I’ve always imagined it’s the same situation in lots of professions. You’re a doctor and someone asks you to have a look at a worrying mole they’ve just found. You’re a shop worker and someone wants to know if you’ll be able to get them a discount. You’re an airline worker and someone wants to know if you can get them a free upgrade to business class. You’re a psychologist and someone wants you to guess what they are thinking.

Now it just so happens that if you work with computers, you know everything about anything electrical.
Read the rest of this entry »


Posted in Development, Opinion | Tagged: , , , | 26 Comments »

RefactorMyCode.com: Will It Work?

Posted by karldmoore on November 7, 2008

I recently stumbled across a new site called RefactorMyCode.com. The strapline reads:

“Have you got a method that you’re dying to simplify? A class that’s growing out of control? Or an algorithm that you just can’t get working? Submit it to the new, awesome web app Refactor My Code, and have it refactored.”



That doesn’t all sound like refactoring, but I’m always interested in new resources so I thought I’d have a look.
Read the rest of this entry »

Posted in Opinion, Refactoring | Tagged: , , , | 4 Comments »

Unit Test Assertions: What Could Possibly Go Wrong?

Posted by karldmoore on November 6, 2008

Lots of my development effort is taken up writing unit tests. These tests form a nice warm security blanket for the code that I’ve developed. If the code is broken, typically these tests are the first feedback that something is wrong. Although some people fear the little red bar, it’s become a common part of development. So with this in mind, it’s vitally important that when a test fails, is crystal clear what really went wrong.

Over the past few weeks, I’ve been reading xUnit Test Patterns (review to follow in another post), which covers making tests easier to write, understand and maintain. One important issue it discusses, is the use of assertion methods.

Assertions are a fundamental part of writing unit tests, and are typically very simple to use. Within each test, the expected outcome is expressed using assertions, each of which is boolean expression. The assertion should evaluate to true, so if the evaluation of the assertion instead returns false, the test will be failed. JUnit provides the Assert class to handle various types of common assertion. Although Assert provides a number of very simple methods, I’ve seen these frequently used inappropriately, causing unit test failures to be unnecessarily difficult to track down.
Read the rest of this entry »

Posted in Opinion, Testing | Tagged: , , , , , , , , , | 9 Comments »