When To Abstract
One of the most difficult challenges in a developers life is finding the "right" abstraction, or at least the best one given the current circumstances. The core problem is that abstraction is a bet on...
View ArticleHow To Refactor Without Breaking Things
Refactoring means to change the structure of your code without changing its behavior. Refactoring is an essential part of everyday programming and should become knee-jerk for your whole development...
View ArticleHow To Synchronize a Database With ElasticSearch?
Since search engines like Apache Solr and ElasticSearch are easy to use and setup more and more applications are using them to index their content and make it searchable by the user. After all the...
View ArticleOutside-In Testing and the Adapter and Facade Patterns
Outside-In Testing benefits a lot from the facade and adapter patterns, which will separate your code from third-party libraries and simplify the APIs of your system.
View ArticleScaling Constraints of Languages
Micro-Services or any set of small services are common again right now. While it can make a lot of sense to use a dedicated service for a well defined problem those services are sometimes used just to...
View ArticleIntroduction To Page Objects
A while ago we wrote about writing acceptance tests (end-to-end tests) with Mink and PHPUnit. While this is a great set of tools for various applications such tests tend be susceptible to changes in...
View ArticleDatabase Tests With PHPUnit
Most of us do not use PHPUnit solely for Unit Tests but we also write Integration or Acceptance Tests with PHPUnit. One very common question then is how to interact with the database correctly in those...
View ArticleDatabase Fixture Setup in PHPUnit
We already discussed when and how to reset a database between tests. But on top of that you often need some basic or more complex data to run the tests against. We discuss different variants and their...
View ArticleUsing Traits With PHPUnit
As we already wrote that "Code Reuse By Inheritance" has lots of problems and we consider it a code smell. You should always aim to use Dependency Injection, most likely Constructor Injection. But with...
View ArticleFree eBook For Christmas
This year we do not only have Christmas presents for our customers for all of you. We created a book and an ebook out of the most important articles in our blog. Gave them a sensible order, so that you...
View ArticleGetting Rid of static
When people start (unit-)testing their code one of the worst problems to tackle are static calls. How can we refactor static calls out of an existing application without breaking the code and while...
View ArticleRefactoring Should not Only be a Ticket
In this blog post I would like to elaborate a bit further on why refactoring should never only be a dedicated task on your board. It should be an essential part of every task you work on…
View ArticleRefactoring: Extracting Data Objects
Extracting data objects from your code will make it easier to read and write, easier to test and more forward compatible. This post shows you the two most common cases where introducing a data object...
View ArticleExtended Definition Of Done
When software projects grow it is considered helpful if the software follows an established structure so that every developer finds their way easily. If the used structures and patterns change per...
View ArticleExtract Method
Refactoring is the process of restructuring code without changing its behaviour and the technique "Extract Method" is one of the most important building blocks of refactoring. What do you need to keep...
View ArticleHow to Perform Extract Service Refactoring When You Don't Have Tests
When you are refactoring in a legacy codebase, the goal is often to reduce complexity or separate concerns from classes, methods and functions that do too much work themselves. Primary candidates for...
View ArticleLoving Legacy Code
Many developers want to "rewrite the whole application" and "get rid of all that sh*t". Most of them are pretty blank when I tell them that I really like working on such code bases, even if I just...
View ArticleHow You Can Successfully Ship New Code in a Legacy Codebase
Usually the problems software needs to solve get more complex over time. As the software itself needs to model this increased complexity it is often necessary to replace entire subsystems with more...
View ArticleTesting the Untestable
A long time ago I wrote a blog post about Testing file uploads with PHP where I have used a CGI PHP binary and the PHP Testing Framework (short PHPT), which is still used to test PHP itself and PHP...
View ArticleExtracing Value Objects
Software systems usually get more complex over time. In the beginning a variable starts out to represent something very simple with very few rules and constraints that can are enforced in a single...
View Article