Category: Tutorial

Stop struggling with conditional logic: meet the State Pattern

State Pattern is like a transforming robot

Finite state machines are a common way to structure a program. But do you know how to build an efficient one while benefiting plainly from Object Oriented Programming best practices?

(more…)

Refactoring: Fix your bugs before they even occur

The death star

It always feels good when we nail down a nasty bug, doesn’t it? But it is always a painful experience when our user discover new ones. So what about solving them ‘by design’, before they even get in production?

(more…)

Test Driven Development, a practical start

Automated testing, sometimes clumsily referred as unit testing (because unit tests are a part of the broader concept of automated tests), is a practice in development in which I’m really interested. Its point is to have code that inspect your code, to see if the former behave like you expect. While it obviously makes you write more code, its goal is to pay back the time you’ve invested into writing your test code by helping you discovering the bugs you may introduce during your development iterations.

More specifically, what I will demonstrate in this post is how to start using a quite rigorous approach of this practice which is called Test Driven Development. This specific way of thought advocates to write your tests before you start writing your production code. This might seems a little weird when you hear about it the first time, because you will basically be testing something that doesn’t exist yet. So I will use a practical case where I implemented it to let you understand how it works and how it benefited me.

(more…)

Start versioning everything with git

Growing a tree

In the software industry, every software goes through several versions during it’s lifecycle. But how to efficiently keep track of changes and provide older versions for compatibility purpose? Sure, we can keep a large collection of .zip files, but there is a better way of doing it, it could apply to a lot more domains than the software industry:

(more…)