Don’t add unnecessary checks to your code, pretty please!

Defensive programming suggests that we should add various checks to our code to ensure the presence and proper shape and type of data. But there is one important rule – only add a check if you know that thing can really happen. Don’t add random checks just to be sure – because you are misleadingContinue reading “Don’t add unnecessary checks to your code, pretty please!”

Most interesting links of Mars ’13

Recommended Readings A lot of stuff this month since I have finally got time to review some older articles. Quite a few articles by Fowler. Few really great (yet short) talks on agile & SW development. Top Agile in a Nutshell (originally Agile Product Ownership in a Nutshell) by Henrik Kniberg – the best explanationContinue reading “Most interesting links of Mars ’13”

Most interesting links of February ’13

Recommended Readings Øyvind Bakksjø: The inverse of IoC is Control – a well-founded criticism of the (over)use of inversion-of-control containers such as Spring and Guice. Bakksjø isn’t against dependency injection in general but he prefers to do it manually, instead of magically, in a main method, using Java instead of an obscure DSL/XML. The dependenciesContinue reading “Most interesting links of February ’13”

What Is Clean Code? – In Quotes

What is actually good, clean code? Why does it matter? Marry Poppendieck has, in her excellent talk Deliberate Practice in Software Development (slides), quoted a couple of leading figures of our industry on what is clean code. (Emphasis is mine.) Bjarne Stroustrup, inventor of C++: I like my code to be elegant and efficient. TheContinue reading “What Is Clean Code? – In Quotes”

Programming Like Kent Beck

Republished from blog.iterate.no with the permission of my co-authors Stig Bergestad and Krzysztof Grodzicki. Three of us, namely Stig, Krzysztof, and Jakub, have had the pleasure of spending a week with Kent Beck during Iterate Code Camp 2012, working together on a project and learning programming best practices. We would like to share the valuableContinue reading “Programming Like Kent Beck”

Help, My Code Isn’t Testable! Do I Need to Fix the Design?

Our code is often untestable because there is no easy way to “sense1” the results in a good way and because the code depends on external data/functionality without making it possible to replace or modify these during a test (it’s missing a seam2, i.e. a place where the behavior of the code can be changedContinue reading “Help, My Code Isn’t Testable! Do I Need to Fix the Design?”

Book Review: Implementation Patterns

Implementation Patterns, Kent Beck, 2007, ISBN 0321413091. Summary: Should you read the book? Yes, the chapter on principles and values is trully enlightening. The book in general contains pearls of wisdom hidden in the mud of “I know that already, man.” I would thus recommend skimming through the book and reading only the pieces matching yourContinue reading “Book Review: Implementation Patterns”

Bad Code: Too Many Object Conversions Between Application Layers And How to Avoid Them

Have you ever worked with an application where you had to copy data from one object to another and another and so on before you actually could do something with it? Have you ever written code to convert data from XML to a DTO to a Business Object to a JDBC Statement? Again and againContinue reading “Bad Code: Too Many Object Conversions Between Application Layers And How to Avoid Them”

Quiz: What’s the Best Test Method Name?

Which of the following names of test methods do you think to be the best? (Notice that we could leave out “payment_” from the last name if it is clear from the context, i.e. from the fixture [a fancy name for test class] name.) According to the holy book of Clean Code, the code shouldContinue reading “Quiz: What’s the Best Test Method Name?”

Most interesting links of September

Recommended Readings J. Yip: It’s Not Just Standing Up: Patterns for Daily Standup Meetings – it isn’t easy to make stand-up meetings short, focused, energizing, and centered around continuous improvements and team spirit. This description of an example good standup, the meeting’s goals, and especially the “patterns” and “bad smells” can be pretty useful to get andContinue reading “Most interesting links of September”