Posts by Lefteris Laskaridis

How to write effective unit tests
Unit testing is an essential practice in software delivery. It builds confidence that our code works and provides a safety net that enables us to change it safely. However, while well written tests provide us with traction and momentum, poorly designed tests often act as impediments that slow us down. This welcomes the question: what "good" unit tests look like? In this article we examine some key properties that separate the wheat from the chaff, driven by a simple example.
Read more

Replacing constructors with factory methods
Simply put, a factory method is any method that encapsulates the logic of how instances of a particular class are created. Considering this loose definition, it might seem at first that to a large extent factory methods are little, if any, different from plain old class constructors. As we shall see however, they are a more powerful option that can help us write cleaner and more maintainable code.
Read more