Blog (2 of 14)
-
Refactoring Singleton Usage to get Testable Code
So your code base is littered with singletons and using them? Don't worry, you can start refactoring them out of your code base class by class and introduce increased testability at every step. This strategy is very simple to implement and the propability of breaking your code is very low, especially when you are becoming more experienced with this technique.
Tuesday 11 July 2017Read more ➞ -
Five Tips to Improve Your Unit Testing
After you got the hang of unit testing there is still so much space for improvement. In this post I want to share five tips with advanced testers I have seen to influence testing in the right direction.
Tuesday 13 June 2017Read more ➞ -
Refactoring with the Advanced Boy Scout Rule
When we join teams to coach them with refactoring their legacy code base, many of them are overwhelmed by the sheer mass of code. That typically results in the request for "some refactoring sprints" or even "a complete rewrite". Both is obviously not a solution from the business perspective - feature development and bug fixing needs to go on and the refactoring should not eat up the larges portion of time. But where and how should the team start and how should? What we call the "Advanced Boy Scout Rule" has helped many teams to come over this staleness and reach fast results while continuing to deliver business value.
Tuesday 30 May 2017Read more ➞ -
Extracting 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 location of the code. We will show you how you can use value object extraction to avoid spreading logic everywhere.
Tuesday 16 May 2017Read more ➞ -
Testing 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 extensions. Since the whole topic appears to be still up-to-date, I would like to show a different approach how to test a fileupload in PHP in this post. This time we will use PHP's namespaces instead of a special PHP version to test code that utilizes internal functions.
Tuesday 2 May 2017Read more ➞ -
How 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 efficient or flexible solutions. Instead of starting from scratch whenever this happens (often!), a better solution is to refactor the existing code and therefore reducing the risk of losing existing business rules and knowledge. A good strategy for this kind of change is called "Branch By Abstraction". While the term is certainly clumsy and overloaded, the idea itself is genious. Let's see how it works…
Wednesday 19 April 2017Read more ➞ -
Loving 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 jumped into the code. I recently talked about that to the other Qafoo members and all of them agreed to my views. Therefore I want to explain our love of legacy code in this post.
Tuesday 4 April 2017Read more ➞ -
How 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 refactoring are often controller classes or use-case oriented service classes (such as a UserService). Extracting new service classes is one popular refactoring to separate concerns, but without tests it is dangerous because there are many ways to break your original code – we show you how this can still be done.
Tuesday 21 March 2017Read more ➞ -
Basic Refactoring Techniques: Extract 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 in mind while doing this?
Tuesday 7 March 2017Read more ➞ -
Extended 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 developer or even every couple of months or years it will get really hard to maintain the software. Let's discuss the reason for this and possible fixes.
Tuesday 21 February 2017Read more ➞ -
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 makes sense and how to do it.
Tuesday 7 February 2017Read more ➞ -
Refactoring 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…
Tuesday 24 January 2017Read more ➞
Subscribe to updates
There are multiple ways to stay updated with new posts on my blog: