Category Archives: Software development practices

Immutable objects

Most of the objects in Java are mutable. It means that their state/fields can be changed after the object was created. The examples of those are: ArrayList, Calendar, StringBuilder. Immutable objects An object is immutable if its state/fields cannot be … Continue reading

Posted in Java, Software development practices | Tagged | Leave a comment

Parameterized unit tests in JUnit

Sometimes you may want to execute a series of tests which differ only by input values and expected results. Instead of writing each test separately, it is much better to abstract the actual tests into a single class and provide … Continue reading

Posted in Java, Software development practices | Tagged , , | 2 Comments

Common exception misuses in Java (and not only)

Exceptions were introduced in many programming languages as a standard method to report and handle errors. If you have ever used functions that return special values (usually -1 or NULL) to indicate an error, you should know how easy it is … Continue reading

Posted in Java, Software development practices | Tagged , | 7 Comments

Definition of Done: or why it is very risky to say that something is done

General meaning of word done may seem obvious to everybody but once you start thinking about this, it becomes clear that done may have different meanings depending on the situation and personal point of view. In this article I would … Continue reading

Posted in Agile, Software development practices | Tagged , | 2 Comments

Using JUnit, JaCoCo and Maven for code coverage

JaCoCo is quite a new tool for measuring and reporting code coverage with full support for Java 7. Currently it supports instruction, branch, line, method and class coverage which is pretty anything you can expect from this kind of tool. … Continue reading

Posted in Code coverage, Java, Maven, Software development practices | Tagged , , , , , | 3 Comments

Assertions in Java

One of the rules of defensive programming is to detect the errors as soon as they appear. The main idea behind this is that we can get precise information about the location of the error and the event which caused … Continue reading

Posted in Defensive programming, Java, Software development practices | Tagged , , , | Leave a comment

Assertions on Android

If you program in Java on Android, you know that Android has its own virtual machine called DalvikVM which is not compatible with JVM from Oracle. In fact, the difference is so big that you cannot run plain Java application … Continue reading

Posted in Defensive programming, Java, Software development practices | Tagged , , , , , | 5 Comments

Test driven development

Test driven development is an important and valued part of agile practices. In test driven  development (in short TDD) developers first write tests for new functionality (e.g. a class) and later they implement it. The order is crucial and I … Continue reading

Posted in Java, Software development practices | Tagged , , , , | 2 Comments