The software we write, most of the times depend on third-party libraries. Take for example Log4Net or a device driver. The problem in many projects is that the third-library libraries are much interwoven with the production code.
Herein lies a number of problems:
- What if you want to change the library you are using?
- What if the structure the library uses does not meet your design?
- How about unit-testing (think of the fact the library might use local resources like physical devices)?
Uncle Bob states in his clean architecture that within a good design, the whole application isn’t aware of these third-party libraries. Think of a plug-in like ReSharper. At Visual Studio they didn’t have to change anything in their code to support the ReSharper plugin. Only the plugin knows about the existent of the other part of the software.
How can we create such an isolation and separate our libraries from our main architecture?
Read More…
Posted in
Design patterns,
Unit testing at December 12th, 2017.
No Comments.
When writing software in the object oriented way, we have components that are in a way related to each other. If the software base grows, these relationships can become more complex each time code is added. The SOLID design patterns, defined by Robert C. Martin a.k.a. Uncle Bob, define a way to build up our components in such a way they can easily be extended and maintained. SOLID stands for:
- Single responsibility principle
- Open/closed principle
- Liskov substitution principle
- Interface segregation principle
- Dependency inversion principle
Read More…
Projects often use third party libraries, which code interfaces to. As the same held for your project, the third part libraries also involve during time. Issues are fixed, new features are added, but also possible new issues will be introduced. Should you update, and keep track of the latest greatest library or use the argument “if it ain’t broken don’t fix it” and stay with the old? What are the pro’s and con’s of each scenario?
Read More…
For my employer I’m currently writing a course of design patterns, which I will give this year to a group of my colleagues. Therefore I was looking at the various design patterns that could be interesting for the people to learn. When I prepare such a course, I try to think what kind of thinking errors the students could make. When you do this, you can deep out your story much more and anticipate on questions that can arise.
Read More…
The singleton pattern is a widely used design pattern, which allows us to have only one instance of a class. Although using a singleton can have its benefits, there also a number of drawbacks which should convince you to use singletons wisely. Due to the drawbacks of the singleton pattern, this pattern is also referred to as a anti-pattern. An anti-pattern is a design pattern, which is in some ways in-effective or has drawbacks.
Posted in
Design patterns at January 8th, 2014.
No Comments.