Skip to main content

6 posts tagged with ".NET"

.NET framework, runtime and the cross-platform ecosystem

View All Tags

More on Design by Contract - Assertions and Inheritance

· 4 min read
Kenny Pflug
Kenny Pflug
Engineering Manager at TELIS/GWVS, Conference Speaker, Consultant

My previous two posts about Bertrand Meyer's Design by Contract (DbC) were mainly introductions to pre- and post-conditions and class invariants and how they can be implemented in C# – in this one we'll check out what implications DbC has if it is combined with the inheritance mechanism of object-oriented programming languages.

Stronger-Typed Resource Dictionaries in XAML

· 6 min read
Kenny Pflug
Kenny Pflug
Engineering Manager at TELIS/GWVS, Conference Speaker, Consultant

If you’ve ever programmed in XAML-based technologies, you know Resource Dictionaries: these XAML files usually contain the styles and templates you want to share across different views, or provide the default styles for Custom Controls you’ve written.

If you want to merge Resource Dictionaries into others (like e.g. within your App.xaml file), you normally use so-called PACK URIs to reference them. However, there is another way: you can combine your XAML file with a code-behind file to create a subclass of ResourceDictionary and reference it via its class name. This is what I call Stronger-Typed Resource Dictionaries.

More on Design by Contract – Class Invariants

· 10 min read
Kenny Pflug
Kenny Pflug
Engineering Manager at TELIS/GWVS, Conference Speaker, Consultant

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 semantic meaning to methods on our objects.

In this post, we will go one step further and discuss what class invariants are.

About Guard Clauses, Automated Tests, and Design by Contract

· 9 min read
Kenny Pflug
Kenny Pflug
Engineering Manager at TELIS/GWVS, Conference Speaker, Consultant

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 being even ten years older) – what could I learn from it, especially in a field like software development where things change relatively fast?