Best Practices & Quality

Why less mocking can improve everyone’s testing experience

There’s some confusion in the community concerning the use of mocks for unit testing. Mocking is creating objects that simulate the behaviour of real objects. I personally don’t mock class dependencies by default but use real objects and test doubles via dependency injection. Despite the success of this approach, many developers are still plagued by concerns that the…
Read more

Form Validation vs Model Validation

This is a follow-up on Why I’m using a separate layer for input data validation that explains the key differences between client-side, input value (form) and model validation. In general, model validation operates on trusted data (internal system state) and should ideally be repeatable at any point in time while input validation explicitly operates once on…
Read more

Why I’m using a separate layer for input data validation

While some developers seem to prefer to implement their user data validation rules directly in the model layer (or even worse, the ORM entity layer), this very often leads to problems as described by Stefan Priebsch in his blog post on How to Validate Data. In addition to the many issues he mentioned, you should consider the following…
Read more

Written requirements in the age of agile development

Many of today’s agile software projects are characterized by a lack of written requirements and other documentation. The rationale behind this is that requirements change “too often” to be written down. Project management might also be afraid that writing documents consumes too much time of developers and stakeholders. However, my personal experience is that projects with…
Read more

What to document in agile projects?

A posting in the Agile and Lean Software Development group on LinkedIn inspired me to think about the amount and type of documentation that should be created in agile projects. It is a misconception, if developers think that agile methods do not require any written documents. Here are a few (I think the most important)…
Read more

David Parnas: Most of the software we see or buy is ugly

Nevertheless, in spite of such helpful articles and many textbooks on software design, software jewels remain rare. Most of the software we see or buy is ugly, unreliable, hard to change, and certainly not something that [Niklaus] Wirth or [Edsger] Dijkstra would admire. If published papers contain the secret of success for software, shouldn’t we…
Read more

Niklaus Wirth about complexity

On both sides of this fence, complexity has and will maintain a strong fascination for many people. It is true that we live in a complex world and strive to solve inherently complex problems, which often do require complex mechanisms. However, this should not diminish our desire for elegant solutions, which convince by their clarity…
Read more

Howto: Become a great Software Engineer

After working in the industry for over a decade, this is my personal summary of the key elements for a successful and satisfying career as software engineer (and a reminder to myself): Contribute to open-source projects – ideally applications or libraries you already use yourself. Don’t blame me, if you end up “working” in your spare time. Read…
Read more

Using SQL fixtures for database related unit tests

This is a short tutorial to show how to use fixtures for database related unit tests. The inspiration for this post came from a conversation I had at the recent PHP Unconference in Hamburg, Germany. From my experience, the usual way to test database related classes is to use a special test database, that needs…
Read more