Posts in category 'coding'

  

Running Java Unit and Integration Tests Separately

Eclipse and Maven are not designed from the ground up to run automated integration tests separately from unit tests. This is a problem because integration tests typically take longer to run, so when coding, especially if doing test-driven development, there is the need to frequently run just the unit test suite from Eclipse. Maven by […]

Getting Started with WebSphere Configuration Scripting

Deploying Java EE applications into a WebSphere application server typically requires configuration within WebSphere of settings such as data sources, thread pool sizes, and maximum heap size. The WebSphere Administration Console provides a graphical user interface for easily doing this setup, but the fatal flaw of this approach is that it is manual – repeating […]

Most Disturbing Code

One question I often ask when giving job interviews is “What do you find most disturbing when reviewing code?” The answers I receive are especially interesting when compared to the interviewee’s results doing an actual code review: it is rare for them to identify the problems they consider the most disturbing. This lack of congruence […]

Why Coding is not Enough

If the goal of software development is to produce working software then developers need to know more than just how to code – they need to know how to prevent or eliminate functional and non-functional defects. Too many developers think their job is complete once a feature has been coded. Sometimes they think that it […]

Using To Do Comments in Code

I am a big proponent of using to do comments – comments prefixed by a specific identifier such as “TODO” – in a code base to indicate outstanding tasks or issues with the code. I have encountered developers who are either unfamiliar with the practice or who do not follow it as deliberately as I […]

Use Understood Methods Rule

Over the years I have refined the approach I use to write code. Recently I codified a key aspect of this approach as a practice I call the Use Understood Methods Rule. The basic formulation of the rule is quite simple: when coding a method only invoke other methods whose behavior you clearly understand and […]

Test Driven Development – Benefits, Limitations, and Techniques

I wrote previously about the process I went through in adopting test driven development (TDD). In this article I discuss my experience with TDD: the benefits, the limitations, and the techniques I use when doing TDD. Benefits This section covers the benefits, as I see them, of doing TDD. This does not include the benefits […]

Adopting Test Driven Development

I have always been keen on using automated unit tests since I first heard about them almost a decade ago. I have known about test driven development (TDD) for almost as long but the practice of writing tests first before writing production code never really clicked for me when I first tried it years ago. […]

My Definition of Done

I recently wrote about why you need a definition of done, and it only seems logical to follow this up by presenting what I use for a definition of done for developing software. I use two guiding principles as the basis for constructing my definition. Potentially releasable: Ideally the software can be released (or shipped) […]

How to Handle Null Values in Code

One fairly common coding style I have seen from more experienced developers is what I will call highly-aggressive null checking. Such developers have most likely been burned by null pointer exceptions in the past and hence have evolved a style of coding which confirms that parameters or fields are non-null before using them. The code […]

Strategies for Effective Code Reviews

Code reviews are an important practice for improving the quality of your software and ensuring that it is ready for release. Software engineering research has found that reviews (or inspections) are a powerful QA practice and have many advantages over testing: A higher percentage of defects are found when using reviews – as high as […]

Why You Should Polish Your Code

When are you done writing a piece of code? Is it when you have implemented the necessary functionality? When you have tested it? I believe there is more to professional-quality code than just getting it to function properly. What else is there? Making sure the code is maintainable – well designed and understandable. I use […]

Are You Doing Enough Coding?

My previous article discussed the question how much do you code?. After thinking more about this, I realized that a more important question is whether you are doing enough coding. How much is enough versus too little? This depends on the reasons why you code. For myself, I can think of several reasons why I […]

How Much Do You Code?

As a software developer, how much time do you actually spend writing code? I recently have discussed this topic with both junior and senior coworkers, from which I have realized that this is a very important question for many developers. The amount of time the average developer actually spends coding can be surprisingly small, and […]

My Defect Fixing Process

What’s your process for fixing a defect? What do you do when you are informed that a feature you developed isn’t working to the users’ satisfaction, or even worse fails to work at all? Here’s what I do. Initial investigation. My goal is to reproduce the reported problem in the application in my development environment. […]

Local Variable Declarations

When coding in Java, I prefer to declare local variables at their point of use. On a recent project, I have encountered developers who have been taught in their computing science course(s) to put local variable declarations at the start of the method (when using Java). Back in the days of C this was a […]