PostSharp Technologies

A shared passion for clean code.

High-level meta-programming frameworks for C# that help you fight boilerplate and architecture erosion with aspect-oriented programming, coded architecture verification and custom code fixes.

What are boilerplate and architecture erosion costing you?

A Total Waste of Your Time

 

Manually writing boilerplate is not only boring and frustrating, it is a total waste of your time. Why do manually what a machine can do better and faster?

Although allowing architecture to erode initially saves time, but as it progressively accumulates, it makes everybody on the team less productive.

Excessive Complexity

 

Your business logic is unreadable because it is littered with boilerplate and the source code becomes so complex that your brain can no longer make sense of it.

As source code derives from the original architecture, more and more exceptions to the rule are committed, and the conceptual complexity of the source code increases.

Avoidable Defects

 

Boilerplate is littered with bugs because it’s created by copy-paste programming and mostly remains untested. Production-readiness features such as logging or caching are neglected because they are too expensive to build without the proper tooling.

As your codebase complexity increases its overall quality suffers: end-users experience bugs and performance degrades.

Expensive Maintenance

 

With both boilerplate and architecture erosion increasing complexity, it becomes more and more expensive to make small changes in your application. A bigger refactoring becomes completely impossible, and you need to rewrite your whole codebase from scratch.

Smart use of meta-programming could extend the lifetime of your codebase by several years.

 

 

Our approach: simple, robust meta-programming

Meta-programming is the practice of creating code that generates, modifies, or validates other code, streamlining repetitive tasks and making code review more efficient.

With a focus on simplicity and safety, we have reimagined aspect-oriented programming (AOP) for modern .NET applications.

Aspects and fabrics are special C# classes that execute inside the compiler or the IDE and:

  • generate repetitive code at compile-time — your source code remaining crystal clear;
  • verify source code against patterns and architecture rules, and report errors in real time;
  • suggest code fixes and refactorings and provide guidance to developers.

Do it by your rules. Create your own code templates and verification rules easily and safely.

 

 

The result: clean, concise code

adhering to architecture guidelines and design patterns.

 

A shared passion for clean code.

 

A modern Roslyn-based meta-programming framework to improve your code quality and productivity in C#.

Metalama is the only C# code quality & productivity tool
that allows you to:

  • Write and maintain less code by eliminating boilerplate, generating it dynamically during compilation, typically reducing code lines and bugs by 15%.
  • Validate your codebase against your own rules in real-time to enforce adherence to your architecture, patterns, and conventions. No need to wait for code reviews.
  • Provide coding assistance straight from the IDE with bespoke code fixes and save time on hesitations, documentation lookups, and typing.

Hello, world!
How Does It Work?

1. Add a Package to Your Project

Add the Metalama.Framework package to your project.

Optionally, you can install Metalama Tools for Visual Studio for an enhanced development experience.

 

2. Create an Aspect Class or Use an Open-Source One

Aspects are meta classes that transform code using simple C#-based templates. They can also report warnings and errors or suggest code fixes.

Here is an aspect that automatically adds logging to a method:

 

It looks simplistic, and it is. Dozens of open-source aspects are available for you to use or fork.

3a. Add Aspects to Your Business Code One at a Time

You can apply each aspect individually using a custom attribute.

 

 

3b. Apply Aspects in Bulk

Alternatively, you can apply aspects in bulk using compile-time LINQ-like code.

 

 

4. You’re Done!

Upon compilation, Metalama merges the aspect template with your business code, doing so on the fly to ensure your source code remains crystal-clear.

 

 

Aspects can also report errors and suggest code fixes, although covering this in detail would be beyond the scope of a simple Hello, world! example.

 

The result: consistently clean code.

Boosting Development Efficiency

Metalama streamlines software development, reducing code by 10-50% and allowing developers to focus on meaningful tasks. It enhances job satisfaction by eliminating repetitive low-level code and frustrating reviews and acts as a talent multiplier, empowering architects and senior developers to address architectural challenges. New team members can contribute effectively without burdening themselves with low-level technical details.

 

Taming Code Complexity

Separating technical details from business logic results in cleaner, more readable code, enabling team members to work efficiently. Adherence to initial architecture and design patterns minimizes complexity, ensuring a manageable, well-structured codebase. This approach prevents excessive rules and violations, whether unintentional or due to unwarranted creativity, maintaining overall simplicity and integrity.

 

Elevating Application Reliability

Aspects boost codebase readability and maintainability by separating technical and business logic. Meta-programming promotes consistency and streamlines reviews, reducing developer oversights and unwanted creativity. Aspects also improve software modularity, preventing duplication and enhancing reusability, adaptability, and efficiency.

 

Streamlining Maintenance

Metalama’s ultimate advantage is reducing maintenance costs and prolonging codebase lifespan. With maintenance constituting 55%-95% of software system costs, low complexity is crucial for post-release team member productivity. As developers spend 70% of their time understanding code, maintaining simplicity greatly benefits the maintenance team’s efficiency.

Software Sources Ltd. is PostSharp’s Reseller.