PostSharp – the #1 pattern-aware extension for C# and VB
It allows developers to eradicate boilerplate by delegating repetitve work to machines. PostSharp contains ready-made implementations of the most common patterns and gives you the tools to build automation for your own.
With conventional programming languages,developers often end up writing boilerplate code. PostSharp extends the C# and VB languages with a notion of pattern. The result: shorter, cleaner code that’s easier to write and understand, contains fewer defects and is less expensive to maintain.
If it’s repetitive, it can be automated.
Think about the following requirements. Have you ever hoped there would be a better way to implement them?
- Code contracts (preconditions)
- Transaction handling
- Exception handling
- Thread dispatching
- Thread synchronization
The problem: existing compilers don’t support patterns
Conventional programming languages lack awareness concept of pattern, therefore patterns are hand-coded and result in boilerplate code, with the following impact:
- High development effort
- Poor quality software
- Difficulty to add/modify functionality
- Slow ramp-up of new team members
High development effort
Large codebases. Some application features require a large amount of repetitive code (boilerplate) when implemented with existing mainstream compiler technologies.
Reinventing the wheel. Solutions to problems like INotifyPropertyChanged are always being reinvented because there is no reusable options within conventional programming languages.
Difficulty to add/modify functionality
Unreadable code that’s difficult to maintain. Business code is often littered with low-level non-functional requirements and is harder to understand and maintain.
Strong coupling. Poor problem decomposition results in duplicate code and strong coupling making it very complex to change the implementation of features. These include logging, exception handling and INotifyPropertyChanged as they are often scattered among thousands of files.
Poor quality software
High number of defects. Every line of code can be defective, but code stemming from copy-paste programming is more likely than other to be buggy because subtle differences are often overlooked.
Multi-threading issues. Object-oriented programming does not deliver much value when it comes to developing multi-threaded applications. This is due to it addressing issues at a low level of abstraction with locks, events or interlocked accesses that can easily result in deadlocks or random data races.
Lack of robustness. Enterprise-grade features such as exception handling or caching are often deliberately omitted. Tis is because of the high amount of source code they imply, unintentionally forbidden in some parts of the applications which are simply left untested and unreliable.
Slow ramp-up of new team members
Too much knowledge required. When new team members come to work on a specific feature, they often must first learn about caching, threading and other highly technical issues before being able to contribute to the business value. This is an example of bad division of labour.
Long feedback loops. Even with small development teams, common patterns like diagnostics, logging, threading, INotifyPropertyChanged and undo/redo can be handled differently by each developer. Architects need to make sure new team members understand and follow the internal design standards and have to spend more time on manual code reviews–delaying progress while new team members wait to get feedback from code review.