Week of PostSharp, Day 4 – Beyond meta-programming, Design Pattern Automation

by Gael Fraiteur on 22 Aug 2013

The 'Week of PostSharp' is a joint promotion with Manning Publications where we highlight a new book each day that is special to us and hand-picked by the PostSharp team – with a small introduction about how it connects to what we are doing. We also collaborated with Manning to select a second book for each day of the week, and will be offering our choices at a 50% discount on their site! You can even read excerpts from some of the books online for free by clicking on the links below.

We hope you enjoy the deals! We’ll be adding new posts with the daily discount code throughout the week, so stay tuned.

Design patterns are now universally accepted and have significantly improved the way we design software. However, they had relatively little impact on how we implement it. Except rare exceptions like the ‘using’ or ‘lock’ keywords, most patterns must still be implemented by hand, resulting in large quantities of boilerplate code that must be validated by peer review. However, smarter compilers and development tools could do a better job by automatically implementing part of the pattern and automatically validating the part that was implemented manually. We call this design pattern automation. At PostSharp Technologies, we believe that design pattern automation, as it raises the abstraction level of source code, will make it easier to build good software.

If Design Pattern Automation is the objective, meta-programming and aspect-oriented programming are the tools. Meta-programming refers to the ability to alter a program either at build- or run-time. Aspect-oriented programming (AOP) is a paradigm that allows to add features to existing code without directly editing this code. Although AOP is not purely meta-programming, these concepts largely blend together. PostSharp, for instance, relies on AOP to alter applications but on meta-programming to select elements of code that must be altered.

Developers like technical quarrels, and meta-programming has been no exception. At PostSharp, we believe that a technology is good if it makes it easier to write good software – for an average development team. It does not help if the best developers are getting a little productivity gain whereas the rest of the team pains at understanding the code. While doing meta-programming, we should be obsessed by this question: did I make it easier for my team to write good software?

Today, we're recommending the following books that you can buy with a 50% discount until August 23rd, 12 midnight EST:


Metaprogramming in .NET is a practical introduction to the use of metaprogramming to improve the performance and maintainability of your code. This book avoids abstract theory and instead teaches you solid practices you'll find useful immediately. It introduces core concepts like code generation and application composition in clear, easy-to-follow language, and then it takes you on a deep dive into the tools and techniques that will help you implement them in your .NET applications.

Download Free Chapter (PDF)   |   Purchase with 50% discount using the code pswkd4


DSLs in Boo shows you how to design, extend, and evolve DSLs for .NET by focusing on approaches and patterns. You learn to define an app in terms that match the domain, and to use Boo to build DSLs that generate efficient executables. And you won't deal with the awkward XML-laden syntax many DSLs require. The book concentrates on writing internal (textual) DSLs that allow easy extensibility of the application and framework. And if you don't know Boo, don't worry—you'll learn right here all the techniques you need.

Download Free Chapter (PDF)   |   Purchase with 50% discount using the code pswkd4