Recently, one of my former students contacted me about a problem he had with the WPF Combo Box. He wanted to display a hint that a wrong value is currently selected. I thought this is an easy answer because WPF supports Error Templates that can be used to display additional UI Elements on the WPF Adorner Layer. But of course, the answer was not that easy.
In one of my last posts, I discussed the basics of Bertrand Meyer’s Design by Contract, namely pre- and post-conditions on methods. These Boolean assertions are used to check if the caller supplied valid arguments and performed the call while the target object was in a valid state, as well as to verify that the method produced the correct return value and/or side effects after it executed completely. This allows us to give semantical meaning to methods on our objects.
In one of his recent posts, Mark Seemann argued that you should not use the internal modifier for types and their members, because this decreases the testability of your code. While I totally agree with him on the subject, I want to highlight another reason for not using internal: the extensibility of your reusable code bases.
In my video series on the Dependency Inversion Principle that you can watch on YouTube now, I talk a lot about object-oriented abstractions and how we can use them to structure our code in a loosely coupled way. But I didn’t really specify what ‘Abstraction’ actually means in terms of Computer Science.
During the past weeks, I have been releasing videos on the Dependency Inversion Principle (DIP) which was originally published by Uncle Bob in 1996. I’m happy to announce that my video series is finished – you can watch it on YouTube now.
I’m currently reading Bertrand Meyer’s “Object-Oriented Software Construction” (finally, I should say) and I’m absolutely amazed. Part of the reason I haven’t touched this book yet is its age: the second edition was released in 1998. A book that is now 17 years old (the first edition is even ten years older) – what could I learn from it, especially in a field like software development where things change relatively fast?
Well, I was totally wrong. Not only are the topics Bertrand Meyer addresses in his book still relevant for OOP today, but more importantly he describes concepts that are not fully supported by popular object-oriented languages like C++, C#, or Java, although they are deemed necessary to achieve the main goals of software quality with OOP according to Meyer.
One of these concepts is Design by Contract. And the best thing is that you probably apply it in your daily programming already, although not to such an extend as Meyer intends you to. So let’s check what Design by Contract actually means.
I finished my newest video series called “Beginning TDD” and you can watch it on YouTube now.