SlideShare une entreprise Scribd logo
1  sur  50
#1 best‐selling pattern‐aware compiler extension to C#/VB
• Lack of support for patterns in C# and VB resulting in boilerplate code
• Consequences:
• High development effort
• Poor quality of produced software
• Difficulty to add/modify functionality 
after first release
• Slow ramp‐up of new team members
Problem
• How can we produce high‐quality software with less development 
effort... without having to replace your existing compiler?
• You may want to consider…
The Big Question
• Add support for patterns
• No more pattern hand‐coding 
resulting in boilerplate!
Pattern‐Aware Compiler Extensions
• Four main reasons to consider pattern‐aware compiler 
extensions:
1. Stop writing boilerplate code and deliver faster
2. Build more reliable software
3. Easier to add/modify functionality after first release
4. New members contribute quicker
Pattern‐Aware Compiler Extensions
• Fewer lines of code means fewer hours of 
work
• Outsource repetitive work to compiler and 
save time and costs immediately
1) Stop Writing Boilerplate and Deliver Faster
• Cleaner code means fewer defects 
• Reliability becomes much more 
affordable
• Cheaper to implement reliability features
• The “right” tool
2) Build More Reliable Software
• Cleaner and shorter code is easier to 
understand
• Focus on business logic and save time trying to 
understand the code
• Better architecture is future‐proof
• Define features such as logging, exception 
handling or transactions in one place and make 
their modification easy and fast
3) Easier to Modify Functionality 
• Better division of labor 
• New team members can focus on business logic 
without worrying about complex architectural structures  
• Implement a tighter feedback loop 
• Validate hand‐written code against 
your defined rules at build time 
and detect bugs as quickly
4) New Team Members Contribute Quicker
Consider…
#1 best‐selling pattern‐aware compiler extension to C#/VB
• Trusted by over 50,000 satisfied developers worldwide
• Over 1,000 of the world’s largest corporations
• More than 10% of all Fortune 500 companies rely on PostSharp
Used by World’s Largest Corporations
• Five main reasons to consider PostSharp
1. Get more productive in minutes
2. Automate more complex patterns and remove boilerplate
3. Build thread‐safe apps‐‐without a PhD
4. Maintain your existing codebase in C# or Visual Basic
5. Benefit from much better run‐time performance
Best Solution
• INotifyPropertyChanged Pattern
• Eliminate repetition and go from 3 lines of 
code per property to 1 attribute per base class 
• Undo/Redo Pattern
• Add the feature easily without writing large 
amounts of code
• Code Contracts
• Protect your code from invalid inputs 
• Logging Pattern
• Trace everything you need in minutes without 
cluttering your code
1) Get More Productive in Minutes 
• PostSharp Aspect Framework
• Define your own patterns and automate their 
implementation
• Largest choice of possible transformations 
• Dynamic aspect/advice providers 
• Aspect inheritance
• Relieves you from implementing the aspects 
manually and ensures that all derived classes using 
this aspect's logic is correct
• Architecture framework 
• Validate you source code against your custom 
pattern guidelines
2) Automate Complex Patterns & Remove Boilerplate
• Seven different threading models
• Address multi‐threading at high‐level of 
abstraction
• Decrease lines of code, defects and reduce costs –
without expertise in multi‐threading.
• Includes Immutable, Freezable, Synchronized, 
Reader‐Writer Synchronized, Actor, Thread Affine 
and Thread Unsafe
3) Build Thread‐Safe Apps – without a PhD
• Model validation
• Catches most defects during build or during single‐
threaded test coverage
• Thread dispatching patterns
• Dispatch work to background or UI threads
• Deadlock detection
• Get an easy‐to‐diagnose exception in case of 
deadlock instead of allowing the application to 
freeze 
3) Build Thread‐Safe Apps – without a PhD
• Plain C# and VB
• Get the benefits of F#, Scala, Nemerle, Python, 
Ruby or JavaScript in C# and VB
• Cross‐platform
• Supports .NET Framework, Windows Phone, 
WinRT, Xamarin and Portable Class Libraries
• Standard skillset
• No complex API. Reuse what you already know 
from C# and System.Reflection
4) Maintain Existing Codebase in C# and VB
• Build‐time code generation
• Code modification at build time 
• No reflection at run‐time
• Build‐time initialization
• Analyze the target code at build‐time and don’t 
waste time on analysis at run‐time 
5) Much Better Run‐Time Performance
Now let me prove how you can 
1. Get more productive in minutes
2. Automate more complex patterns and 
remove more boilerplate
3. Build thread‐safe apps without a PhD 
… all without having to change your 
existing compiler
Let’s see the product…
Show Me The Product
• Will I be able to understand my code?
• Yes. Thanks to PostSharp’s Visual Studio tooling, you’ll easily understand 
where and how patterns are used in your code
• Can I keep using my existing compiler?
• Yes. PostSharp is 100% compatible with your existing Microsoft compiler
• Compilation will be slower
• Possibly. PostSharp introduces additional steps into the compilation, there is a 
performance cost. However, PostSharp is highly optimized several times faster 
than FxCop, etc.
What’s Holding You Back?
“The new code is much less complex and much easier to maintain.” 
Daniel Wolf, Project Manager, mobileX AG
Testimonials
“…a pretty amazing piece of software...whole point of what 
the computer is supposed to do…” 
Scott Hanselman, Principal Program Manager, Microsoft
“…very easy to use… helps my team complete features faster.” 
Bernd Hengelein, Software Architect, Siemens Audiology
“It has reduced thousands of lines of code.”
Kshitij Deshmukh, Software Development Manager, Mitchell International
How Does It Compare?
#1 best‐
selling 
pattern‐
aware 
compiler 
extension 
to C#/VB
• Each line of code costs $14. Including boilerplate.
• A developer typically produces 600 lines of code per 
month.
• Average cost for 1 developer is $100k a year ‐ at least.
• PostSharp pays off after he/she saves first 50 lines of 
code
• PostSharp reduces source code size by up to 20%
• If it reduces by only 5% ‐ saves $5,000 per developer
• Recoup your investment as soon as within 45‐days of 
usage
• PostSharp has one of the highest ROI: 
15 to 55 times the investment
• You never lose – you always win
Return on Investment
• Cost of PostSharp is 35% below the 
average price of software development 
tools (e.g. Resharper, DevCraft or DevExpress
Universal)
Return on Investment
• Trusted by over 50,000 satisfied developers worldwide
• Over 1,000 of the world’s largest corporations
• More than 10% of all Fortune 500 companies rely on PostSharp
Over 50,000 Developers – World’s Largest Corporations
All trust…
• No more copying and pasting blocks of code to 
add a functionality
• No more spending hours trying to understand the 
business logic of the code
• No more hiring an expensive specialists to build 
thread‐safe applications
• Cut development and maintenance costs
• Go to market faster
• Produce high‐quality, easy‐to‐maintain software 
that has fewer bugs – with less development 
effort
Picture this
Life is Good!
• Sign up for free trial
• Go to www.postsharp.net
• Read case studies and testimonials
• Attend a free live webinar
• Get the price or request a quote
• Contact us with any questions
Let’s Get Started!
Questions?
#1 best‐selling pattern‐aware compiler extension to C#/VB
CASE STUDY:
Siemens Audiology
“Within the code of our presentation layer (mainly ViewModels and XAML
code) we saved about 15% just by using the ViewModelAspect.”
Bernd Hengelein
Software Architect
Siemens Audiology
2
Summary
When the team at Siemens Audiology, a business unit of Siemens Sector
Healthcare, started development on a new WPF implementation for two
of its existing hearing system software applications it chose PostSharp to
deliver a decrease in boilerplate code and software defects – saving them
15% within their presentation layer code.
Team to deliver new WPF implementation
for existing apps
Siemens Audiology, a business unit of Siemens Sector Healthcare,
develops and distributes hearing devices to hearing care professionals
worldwide.
The company’s development team began looking into aspect-oriented
programming and PostSharp as they started development on a new
WPF implementation for two of its existing hearing system software
applications.
“The WPF applications that we are developing are based on the MVVM
(Model-View-ViewModel) pattern for its testability and powerful
data binding capabilities,” says Bernd Hengelein, the software
architect behind Siemens Audiology’s development team.“There are
some repetitive tasks involved when writing ViewModels, such as
implementing INotifyPropertyChanged for each property, and creating
DelegateCommand for each method on the ViewModel that you want to
bind to a UI element.”
Why Siemens Audiology chose PostSharp
Recognizing the importance of removing boilerplate code, the team
began developing PostSharp aspects to do all the repetitive work for
them.
“For standard use cases, PostSharp is very easy to use” says Bernd,“for
instance, implementing a simple tracing aspect is a piece of cake. We
chose PostSharp, rather than alternatives like transparent proxy solutions,
because we wanted to have maximum performance during runtime.”
“We chose PostSharp,
rather than alternatives
like transparent proxy
solutions, because
we wanted to have
maximum performance
during runtime.”
Bernd Hengelein
Software Architect
Siemens Audiology
Siemens Audiology
A leading supplier of hearing devices saves from
having to write INotifyPropertyChanged and creating
ICommand properties needed for data binding.
3
Build and inject custom aspects
into existing applications
Using PostSharp, the Siemens Hearing Instruments team built a number
of aspects to cover some interesting use cases including ViewModel,
Threading, and Localization.
ViewModelAspect
The most complex of all the aspects used by the team, it saves writing
time for developers implementing ViewModels and increases source code
readability by removing boilerplate code. While the aspect was primarily
built to handle INotifyPropertyChanged , ease refactoring and avoid
typos – it also saves the team from having to implement all the delegate
commands in their MVVM implementation.
“The aspect is created automatically for each public void method, and
creates a delegate command together with a new property of type
ICommand that can be bound to the UI,” says Bernd.“This makes it
very easy for us when new ViewModels are developed. We just put our
ViewModelAspect on it, write the public methods – which can be bound
to the UI - and all the INotifyPropertyChanged and command stuff is done
instantly.”
Threading Aspect
The aspect is used by the team to execute long-running business
operations within a separate thread and keeps them focused on
implementing relevant business logic instead of threading issues.
“We have two solutions,” says Bernd,“in the first we add an attribute
to a method and it’s executed in a worker thread. Later we added a
business thread - where all the business operations take place – so we
add it to a method and the aspect takes care of routing the call into the
business thread and executing it. Then, with an additional aspect we call
AsyncCallback, we indicate that it’s a callback method and it’s routed back
to the UI thread using the dispatcher in WPF.”
“Within the code of
our presentation layer
(mainly ViewModels and
XAML code) we saved
about 15% just by using
the ViewModelAspect.”
Bernd Hengelein
Software Architect
Siemens Audiology
4
Localization Aspect
This aspect is part of the company’s localization infrastructure and
relieves developers from manually having to trigger it for complex texts
within ViewModels.“We have to be able to change the language of our
applications during runtime so when a new language is selected the UI
adapts,” says Bernd.“The team has two approaches to the localization
requirement. For static texts, found in the XAML file, we use custom
markup extensions, which are added to the text, and the localization
manager takes care of the localization. Dynamic texts, which are
enhanced from information in the business logic, are handled inside
ViewModels. These more complex texts are built by enhancing a text
snippet with the information from the business logic and, calling on the
localization manager, we simply add LocalizeAspect to a string property.
The aspect takes care of the string you provide with the property then
goes to the localization manager, does the localization, then returns the
localized string.”
PostSharp reduces code duplication and adds
maintenance
“Within the code of our presentation layer (mainly ViewModels and XAML
code) we saved about 15% just by using the ViewModelAspect” says
Bernd.
One of the most cited benefits of AOP and PostSharp is time saved in
reading and writing by the removal of boilerplate code. The team at
Siemens Audiology experienced the time savings first hand.
“Releasing developers from writing boilerplate or infrastructure code
helps my team to complete features faster,“ says Bernd.“While total cost
savings may be difficult to quantify, we definitely saved coding time.
We were relieved from writing the code for INotifyPropertyChanged
and creating ICommand properties needed for data binding. We also
avoided errors/bugs which would have occurred by forgetting to raise the
appropriate PropertyChanged events.”
SharpCrafters s.r.o.
Namesti 14 rijna, 1307/2
150 00 Prague 5
Czech Republic
US: +1 866 576 5361
CZ: +420 270 007 790
www.postsharp.net
info@postsharp.net
CASE STUDY:
mobileX AG
“Sure, we achieved some considerable savings in terms of LOC. But more
importantly, the new code is much less complex and much easier to
maintain. This is what really saves time and money in the long run.”
Daniel Wolf
Project Manager
mobileX AG
2
Summary
When the lead developers at mobileX began a huge refactoring
project – migrating the company’s codebase to the .NET 3.5 framework
then rewriting their flagship application from WinForms to WPF – the
biggest challenge was to improve code maintainability by reducing code
complexity. They chose PostSharp for its out-of-the-box solutions that
eliminate code repetition without changing application architecture.
Lead developers migrate main app to .NET 3.5
framework
After struggling with the company’s main product, an application that
grew into a monolith over the years, the lead developers at mobileX
received approval from management to upgrade to the .NET 3.5
framework and take advantage of higher-level APIs like WPF to improve
client-facing customizations.
“We just arrived at a point where many things needed improvement,” says
Daniel Wolf, Project Manager at mobileX.“It was far too hard to change
individual bits of it for our individual customers. At that point we got
permission to spend about half a year completely redoing much of the
main part of the application and another half a year reworking what we
already had and refactoring it.”
Custom application extensions required a lot of
repetitive code
Daniel’s team builds the front end of the company’s main application.
His team also develops custom extensions for clients and the logic
behind them can be quite complex depending on the number of
dependencies and validation rules between values controlled by different
parts of the UI.
As the number of diverse dependencies between inputs rises they often
become multi-layered, where the input in control A determines the
number of input selections available for controls B and C. So, when the
value of control A is changed, controls B and C need to be updated in
exactly the right order to avoid erroneous results.
“We just wanted some
out of the box solutions
we could apply to some
classes and not others
without a huge change
to our existing code
base.”
Daniel Wolf
Project Manager
mobileX AG
mobileX AG
A mobile workforce management solutions provider
reduces code complexity and improves code
maintainability in its applications with PostSharp.
3
Using a traditional approach, the team had to be very careful with any
implementation, attaching and later detaching, event handlers. Because
attaching and detaching takes place at different times, it was easy for
team members to forget to detach – leading to memory leaks.
Why mobileX chose PostSharp
During that time, Daniel and the other lead developers looked at
several technologies they had not used before. They soon came to the
conclusion that Aspect-Oriented Programming was the best solution for
the job at hand but they weren’t keen on how dynamic proxies forced
developers into their architecture rather than adapting to the developer’s
architecture.
That’s when they discovered PostSharp and the benefits of compile-time
weaving.
“There was no other product on the market that could do what we
wanted to do,” says Daniel.“We wanted aspect orientation to be one tool
among others in our toolbox. We didn’t want to have to change anything
to use it,” he said.“We just wanted some solutions that were out of the
box and that we could just apply to some classes and not apply to other
classes, and they would not mean a huge change to our existing code
base.”
How mobileX implements PostSharp
Using PostSharp, the team at mobileX built a number of custom aspects
to cover important use cases including INotifyPropertyChanged,
AutoWiring and Const.
INotifyPropertyChanged
In GUI programming, one very repetitive task is implementing the
INotifyPropertyChanged interface and making sure all relevant properties
throw an event when changed. This simple aspect can be applied to any
read-write property and will automatically add the required glue code,
including the test if the new value actually differs from the old one.
“This attribute takes care of those hundreds of simple properties without
too much logic in them,” says Daniel.“It is a clean solution that allows
us to write succinct code and it dramatically improves readability, since
it allows us to use automatic properties most of the time. Without it, all
those properties would have to be implemented explicitly. In the past, the
required backing fields used to clutter our code without adding any value.
4
AutoWiring
This aspect is the “bigger brother” of the INotifyPropertyChanged
aspect. You apply it to a property and tell it which values the property
depends on by giving it a list of binding-style property paths. It then
tracks changes to all properties along those paths, much the same way
WPF does. If any of these input values change, the property value is re-
evaluated, and a change event is raised if appropriate.
“Handling change notifications used to be a real challenge,” says Daniel,
“especially in those cases where changes to one property need to trigger
a change in another property, which again needs to trigger changes
elsewhere. We used to end up with lots of hard-coded dependencies,
where one property would raise change events for a whole bunch of
other properties that depended on it. It was hard to get right and a
maintenance nightmare afterwards. Now, with AutoWiring, we simply
declare what values a property depends on. And it just works – no matter
how complex the dependencies.”
If the team were to refactor the code, it would consider using ready-made
aspects shipped with PostSharp:
“It seems PostSharp Model Patterns Library now offers a similar feature
out-of-the-box, with even less manual work. Unfortunately, the feature
was still in development when we needed it” says Juan, a colleague of
Daniel.
Const
This attribute can be applied to any property that only has a getter. On
first access, it caches the return value. On every subsequent access, it
simply returns the cached value.
“This aspect may seem trivial at first, but turns out to be a real asset when
it comes to writing efficient code,” says Daniel.“Many properties need
to perform expensive operations to calculate their value. In the past we
either pre-computed and assigned these values in the constructor, which
meant a delay even if the property was never actually accessed, or we
calculated the value within the property getter, which helped initial load
time but meant an additional delay on each property access – even for
properties we knew would not change. If we really wanted to maximize
performance, we had to use additional backing fields to implement lazy
loading. Now, we simply put all the logic into the property’s getter and
decorate it with the Const attribute. And just like that, we get lazy loading
and optimal performance.”
“Sure, we achieved some
considerable savings
in terms of LOC. But
more importantly, the
new code is much less
complex and much easier
to maintain. This is what
really saves time and
money in the long run.”
Daniel Wolf
Project Manager
mobileX AG
5
SharpCrafters s.r.o.
Namesti 14 rijna, 1307/2
150 00 Prague 5
Czech Republic
US: +1 866 576 5361
CZ: +420 270 007 790
www.postsharp.net
info@postsharp.net
Simpler code that’s easier to maintain
The team calculated a total savings of over ten thousand lines of code
(LOC) on the project by using PostSharp, but believes the real savings
come from reduced code complexity and improved maintainability.
“Can I look at some piece of code and immediately understand what it
does and how it works? Is it easy to spot errors and fix them without
breaking code elsewhere? That’s what really counts. And this is where
PostSharp shines,” says Daniel.“Sure, we achieved some considerable
savings in terms of LOC. But more importantly, the new code is much less
complex and much easier to maintain. This is what really saves time and
money in the long run.”
CASE STUDY:
Gamesys
“If we were able to continuously develop and operate several high-
volume games in production with such a small team, it was partly thanks
to PostSharp.”
Yan Cui
Senior Backend Developer
Gamesys
2
Overview
Gamesys serves around one million daily active users across its social
games. Their backend services handle more than 250 million requests per
day. Despite its massive scale, this distinctive service is being maintained
by a remarkably small development team of just seven super-productive
individuals. They chose PostSharp to automate the implementation of
their design patterns, outsourcing mundane tasks to the compiler so they
can focus on what matters.
Small team, big challenges
Although Gamesys employs more than 1,000 people globally and
operates in a number of markets across the UK, Europe and the US,
the Social team’s backend services are overseen by a small team of
developers. As such, it is critical that the team minimize inconveniences
and concentrate on tasks that are essential to the work at hand.
“With a small team of seven developers who are responsible for
everything that happens on the back end, it’s imperative that we allow
them to focus on things that add value to our players and maximise
their productivity,” says Yan Cui, Senior Backend Developer at Gamesys’s
Social team.
The team is responsible for building scalable backend services to support
Gamesys’ social games on mobile devices and Facebook. Across the
company’s range of social games, it has around one million daily active
users, and its backend services receive around 250 million requests per
day. This requires the team to deliver high-quality solutions that will
enable the backend team to work at peak efficiency.
The team has worked on several projects that presented various
challenges and called for comprehensive problem-solving approaches:
1.	 Performance monitoring;
2.	 Error handling; and
3.	 Localization.
“Thanks to PostSharp, we
were able to localize over
95 percent of the game
with just one line of
code and save potentially
hundreds of man hours
over the lifetime of
the game.”
Yan Cui
Senior Backend
Developer
Gamesys
Gamesys
The market leader in the field of real money gaming
improves productivity and reduces development and
maintenance costs with PostSharp.
3
Why Gamesys chose PostSharp
The team chose PostSharp over alternative solutions for a number
of reasons:
•	 PostSharp offers the most complete support of features they have
been looking for, such as:
𐐬𐐬 The ability to multicast aspects using filters, therefore targeting
several methods employing a single line of code;
𐐬𐐬 The ability to intercept events; and
𐐬𐐬 The ability to introduce members dynamically.
•	 PostSharp provides the best runtime performance, as most of the work
is done at compile time.
•	 PostSharp works consistently across public, private and static members
and does not depend on an object that is constructed by the
IOC container.
•	 PostSharp enables developers to automatically verify at build time
how aspects are being used, failing the build if an aspect has been
applied to an inadequate method.
“When I first joined Gamesys in 2010, our code base was littered with
cross-cutting concerns such as exception handling and validation, and in
general the control flows were so convoluted that it was difficult to see
what the application was actually doing a lot of the time,” says Yan.“So
when I encapsulated those repeated patterns into several aspects and
cleaned up our code base using PostSharp, it was all the motivation and
convincing everyone needed.”
Performance Monitoring: Solved
For Gamesys, it is essential to have visibility of both what and how their
application is doing. Therefore, the company needed a solution that
would make it easy for its developers to track execution time and count
of service entry points, IO operations, and CPU-intensive methods.
Taking a traditional approach to solve this would have led to a lot of
boilerplate code and would have cluttered the company’s code base.
With PostSharp, the team created a pair of aspects – LogExecutionTime
and LogExecutionCount – to track the execution time and the count of any
performance-sensitive method.
4
The pair of aspects records execution metrics pertaining to these
methods and funnels them to an in-memory aggregator that aggregates
the per-instance metrics and publishes them to Amazon CloudWatch
periodically.
LogExecutionTime
OnEntry
OnSuccess
MetricsAggregator
Amazon
Cloudwatch
Start timer
Invoke method
Record metric
End timer
Error Handling: Solved
Effective error handling presented a real challenge for Gamesys, as the
company had hundreds of specific errors for each of its games.
Every request to the company’s client-facing services has a matching
response object, which derives from a BaseResponse class that looks like
the following:
	 public abstract BaseResponse
	{
	 public int? ErrorCode { get; set; }
	 public string ErrorMessage { get; set; }
	}
When a request fails for whatever reason (e.g., a player tries to buy a
Broadaxe but has run out of space in his or her backpack), they always
return a response object back to the client with an ErrorCode so that the
client can address it depending on the type of error.
The team created a custom PostSharp aspect, an ExceptionHandler, which
provides team members with desired functionality, and which is now a
core piece in the company’s infrastructure.
“Over the years,
Postsharp has helped
us to save over tens of
thousands lines of code .”
Yan Cui
Senior Backend
Developer
Gamesys
5
The team multicast the aspect to all methods that are service entry
points so that anytime an exception is thrown and bubbles up, the
aspect will:
1.	 Capture the exception information;
2.	 Log it with Gamesys’ logging infrastructure;
a.	 Record all exceptions in the ElasticSearch cluster;
b.	 Push critical (all the custom exceptions specify a SeverityLevel)
exceptions that warrant more urgent attention to Sentry, which
sends notifications to the relevant team members;
3.	 Create a response object of the correct type;
4.	 Populate the ErrorCode and ErrorMessage properties; and
5.	 Return the dynamically created response object.
“This simple aspect is reused in every project and plays an important role
in our infrastructure,” says Yan.
ElasticSearch Sentry
Logger
ExceptionHandler
Log
Client
OnException
Log ExceptionGenerate
response
object
Localization: Solved
“It was something of a mammoth task when we decided to localize the
game Here Be Monsters for Flash and iOS clients, as we have more than
3,500 items and 1,500 quests in the game, with more text than the first
three Harry Potter books combined,” says Yan.
With the conventional approach, the client would consume a gettext
file containing all of the translations, and anywhere some text needs
to display, the gettext file would substitute the original text with the
localized text.
6
This would lead to several issues:
•	 A large number of code files need to change during implementation.
•	 Maintenance overhead - all future changes need to take localization
into account.
•	 Duplicated efforts - need to replicate changes across client platforms.
•	 Hard to scale - complicates implementation and testing; easy for
regression to creep in during frequent release cycles.
To localize the game Here Be Monsters for Flash and iOS clients, the team
created custom aspects with PostSharp and performed localization on
the server as part of the pipeline that validates and publishes the data
(quests, achievements, items, etc.) captured in their custom CMS.
CMS Publisher
Generates platform
specific data
iOS
Flash
Server
Localise here
Requires localisation
As part of its solution, the Publisher would:
1.	 Ingest the gettext translation file.
2.	 Use the Localize aspect (see a simplified version here) to intercept
string property setters on DTOs to replace the input string with the
localized version.
3.	 Repeat for each language to generate a language-specific version of
the DTOs.
To automatically apply localization to all present and future DTO types,
they simply multicast the attribute and target all types that follow our
naming convention for DTOs:
	 [assembly: Localize(AttributeTargetTypes = "*DTO")]
“With one line of code, we were able to localize over 95 percent of the
game and save potentially hundreds of man hours over the lifetime of the
game,” says Yan.
“If we were able to
continuously develop
and operate several
high-volume games in
production with such a
small team, it was partly
thanks to PostSharp.”
Yan Cui
Senior Backend
Developer
Gamesys
7
Summary
The team at Gamesys is pleased with the results from using PostSharp:
•	 Improved productivity thanks to more concise and maintainable code;
•	 Less code to write, read and maintain, resulting in reduced
development and maintenance costs; and
•	 Fewer bugs.
“It’s difficult to measure how many lines of code and how much
development and maintenance costs PostSharp has helped us to save, but
over the years, we could have easily saved over tens of thousands lines
of code,” says Cui.“The fact that we are able to continuously develop and
operate several high-volume games in production with such a small team
is in part thanks to PostSharp.”
SharpCrafters s.r.o.
Namesti 14 rijna, 1307/2
150 00 Prague 5
Czech Republic
US: +1 866 576 5361
CZ: +420 270 007 790
www.postsharp.net
info@postsharp.net
CASE STUDY:
Mitchell International
“PostSharp was especially good when we needed to transfer data
between applications. We would have had to write a lot of code if not for
PostSharp and now we don’t even think about it. It made life a lot easier
now from a development point of view.”
Kshitij Deshmukh Rensfield
Software Development Manager
Mitchell International
2
Summary
When the team at Mitchell International was asked to deliver a new suite
of client-facing applications, one of its greatest challenges was to keep
code repetition to a minimum. After evaluating a number of solutions, the
development team at Mitchell chose PostSharp to deliver a significant
decrease in boilerplate code and software defects – saving them from
having to write tens of thousands of lines of code.
Engineers to deliver a new suite of client-facing
software
As North America’s leading provider of property & casualty claims
management solutions, Mitchell International processes more than 50
million transactions annually for over 300 insurance companies and
claims payers, and over 30,000 car collision repair shops.
The development team at Mitchell was tasked with delivering a new
suite of client-facing software packages to:
1.	 simplify the company’s claims management processes; and
2.	 accelerate the company’s collision repair processes.
The new suite of applications, to be developed using the latest .NET
technologies, had to be combined with disparate applications that have
been in the marketplace for many years. This integration added a lot of
complexity to the project.
Integration requires a lot of repetitive code
At the start of the project the development manager and principal
engineer assessed Mitchell’s existing client-facing software and
discovered a mix of old Windows-based applications written in a variety
of different technologies.“Visual C++, Visual Basic and WinForms just to
name a few,” says Kshitij Deshmukh, Mitchell’s Software Development
Manager.
Mitchell International
North America’s leading provider of property & casualty
claims management solutions saves from having to
write tens of thousands of lines of code with PostSharp.
3
The biggest challenge involved a huge C++ application that served as the
main engine and revenue generator for their business:
•	 the application was 20 year old; and
•	 almost 2 million lines of code.
Rather than confront the daunting task of rewriting the application from
the ground up, the team chose to break it into smaller components and
tackle each of them separately. Continuing to use the C++ application as
the main engine, the team set about rewriting all of its peripheral pieces
one-by-one using .NET 4.0 and Windows Presentation Foundation as part
of the new suite, visually embedding the old application in the center of
the new one.
“As part of that process, we found that some of the existing patterns had
a lot of repetition in them,” says Kshitij,“especially in MVVM where you
have to bind to all of the controls in XAML. There was a lot of code that
you had to just continually keep writing all the time.”
Why Mitchell chose PostSharp
The senior team began looking into run-time solutions to handle
repetitive code.“We tried Spring.NET and CastleWindsor,” says Kshitij,“but
we soon discovered that there was a lot of run-time expense to incur
with these frameworks. That’s when we started looking at compile-time
solutions.”
Having previously tried PostSharp years earlier, Kshitij and his team
evaluated version 2.1 and gave it high marks for:
•	 Visual Studio and MSBuild integration;
•	 high run-time performance;
•	 compile-time performance improvements over earlier versions.
Having chosen PostSharp to handle repetitive code in their new suite of
software, it was now up to Tony Rensfield, Principal Engineer at Mitchell,
to determine how to best implement the framework into the project.
“In the beginning of project, Kshitij and I were both writing code and
did a lot of the up-front work for many of the aspects that we needed,
including some small proof of concepts and their implementations,” says
Tony. The proof of concepts served as templates for developers coming
in to the project so that, after just a few questions, they could understand
how the aspects were applied and go about their day-to-day work of
rewriting the peripherals.
“PostSharp was
especially good when we
needed to transfer data
between applications. We
would have had to write
a lot of code if not for
PostSharp and now we
don’t even think about it.
It made life a lot easier
now from a development
point of view.”
Kshitij Deshmukh
Software Development
Manager
Mitchell International
4
Build and inject custom aspects into applications
Additionally to a few standard aspects, the team built several aspects to
facilitate integration between the new and the old application:
•	 Activity Logging
•	 Exception Handling
•	 Performance Counter
•	 Thread Dispatching
•	 Data Sync
Thread Dispatching – A custom aspect was built for pushing threads and
calls back onto the GUI thread.“We have events that come from the old
application and the new application, and they talk back and forth.” says
Tony.“Depending upon when and on what thread those events come in,
you might end up making calls that need to be pushed back up to the GUI
thread. We have an aspect for that, so if you have a method that might
need that, you basically apply that aspect, and it keeps you from having to
write all the code to invoke or push it back to the dispatcher.”
Activity Logging Aspect – A subset of logging, this custom aspect was
built and applied to very specific methods so, when a milestone step is
taken in the new application, the team is notified and has the option
to push the logs up to their servers or display specific information or
instructions to the end user.
Data Sync Aspect – A custom aspect was built to assure the applications
stay synchronized with each other.“Approximately 30% of properties in
the new applications are exact replications of the properties that exist in
the old application”, says Tony,“so we wrap these properties in an aspect
that basically transfers the changes to the other application through an
API. As the user is changing those properties live, these changes get
transferred so that the two applications stay synchronized.”
“The fact that none of
our 18 developers have
ever had to write an
exception handler or
even one logging line
in this project is a huge
win for us. Using aspects
prevents a lot of user
error and in that way
PostSharp has been
amazing for us.”
Anthony Rensfield
Principal Engineer
Mitchell International
5
SharpCrafters s.r.o.
Namesti 14 rijna, 1307/2
150 00 Prague 5
Czech Republic
US: +1 866 576 5361
CZ: +420 270 007 790
www.postsharp.net
info@postsharp.net
PostSharp reduces tens of thousands
of lines of code
The team at Mitchell is pleased with the results from using PostSharp:
• reduced boilerplate code
• code is more readable
• code is easier to maintain
“It has reduced thousands of lines of code,” says Kshitij.“You apply an
aspect and it takes care of everything without having to mess around
with each and every property or method. Now we can just look at
business logic without actually having to worry about all the rest of the
bookkeeping that needs to happen around it.”
Kshitij and Tony are also pleased with how PostSharp makes enforcing
good architecture practices easy.“You enforce a certain methodology so
that you don’t get team members doing things they’re not supposed to
and doing so helps to clean up everything and keep it that way.” says Tony.
“PostSharp has saved us from writing so many lines of code that it’s hard
to even quantify. The fact that none of our developers have ever had to
write an exception handler or even one logging line in this project is a
huge win for us. Using aspects prevents a lot of user error and in that way
PostSharp has been amazing for us.”

Contenu connexe

Plus de Cheer Chain Enterprise Co., Ltd.

Focused Analysis of #Qualitative #Interviews with #MAXQDA Step by Step - #免費 ...
Focused Analysis of #Qualitative #Interviews with #MAXQDA Step by Step - #免費 ...Focused Analysis of #Qualitative #Interviews with #MAXQDA Step by Step - #免費 ...
Focused Analysis of #Qualitative #Interviews with #MAXQDA Step by Step - #免費 ...Cheer Chain Enterprise Co., Ltd.
 
Maxqda 2020 質性分析及混合研究理論應用軟體完整使用手冊(英文版)
Maxqda 2020 質性分析及混合研究理論應用軟體完整使用手冊(英文版)Maxqda 2020 質性分析及混合研究理論應用軟體完整使用手冊(英文版)
Maxqda 2020 質性分析及混合研究理論應用軟體完整使用手冊(英文版)Cheer Chain Enterprise Co., Ltd.
 
Getting started-guide-maxqda2018 MAXQDA 2018 質性分析軟體 中英文快速入門手冊
Getting started-guide-maxqda2018 MAXQDA 2018 質性分析軟體 中英文快速入門手冊Getting started-guide-maxqda2018 MAXQDA 2018 質性分析軟體 中英文快速入門手冊
Getting started-guide-maxqda2018 MAXQDA 2018 質性分析軟體 中英文快速入門手冊Cheer Chain Enterprise Co., Ltd.
 
NativeJ screenshot - NativeJ is a powerful Java EXE maker!
NativeJ screenshot - NativeJ is a powerful Java EXE maker!NativeJ screenshot - NativeJ is a powerful Java EXE maker!
NativeJ screenshot - NativeJ is a powerful Java EXE maker!Cheer Chain Enterprise Co., Ltd.
 
Edraw Max Pro 使用者手冊 - All-In-One Diagram Software!!
Edraw Max Pro  使用者手冊 - All-In-One Diagram Software!!Edraw Max Pro  使用者手冊 - All-In-One Diagram Software!!
Edraw Max Pro 使用者手冊 - All-In-One Diagram Software!!Cheer Chain Enterprise Co., Ltd.
 
Nvidia gpu-application-catalog TESLA K80 GPU應用程式型錄
Nvidia gpu-application-catalog TESLA K80 GPU應用程式型錄Nvidia gpu-application-catalog TESLA K80 GPU應用程式型錄
Nvidia gpu-application-catalog TESLA K80 GPU應用程式型錄Cheer Chain Enterprise Co., Ltd.
 
Atlas.ti 8 質性分析軟體新功能介紹_祺荃企業有限公司
Atlas.ti 8 質性分析軟體新功能介紹_祺荃企業有限公司Atlas.ti 8 質性分析軟體新功能介紹_祺荃企業有限公司
Atlas.ti 8 質性分析軟體新功能介紹_祺荃企業有限公司Cheer Chain Enterprise Co., Ltd.
 
Maxqda12 features -detailed feature comparison for more information about eac...
Maxqda12 features -detailed feature comparison for more information about eac...Maxqda12 features -detailed feature comparison for more information about eac...
Maxqda12 features -detailed feature comparison for more information about eac...Cheer Chain Enterprise Co., Ltd.
 
CABRI® 3D V2 - 革命性的數學工具(中文操作手冊)
CABRI® 3D V2 - 革命性的數學工具(中文操作手冊)CABRI® 3D V2 - 革命性的數學工具(中文操作手冊)
CABRI® 3D V2 - 革命性的數學工具(中文操作手冊)Cheer Chain Enterprise Co., Ltd.
 
全新 Veeam Availability Suite v9包括 Veeam Backup & Replication 和 Veeam ONE 備份解決方...
全新 Veeam Availability Suite v9包括 Veeam Backup & Replication 和 Veeam ONE 備份解決方...全新 Veeam Availability Suite v9包括 Veeam Backup & Replication 和 Veeam ONE 備份解決方...
全新 Veeam Availability Suite v9包括 Veeam Backup & Replication 和 Veeam ONE 備份解決方...Cheer Chain Enterprise Co., Ltd.
 
AVG 2016 business edition customer deck - 屢獲殊榮的防毒軟體保護您的企業免於最新的威脅與病毒
AVG 2016 business edition customer deck - 屢獲殊榮的防毒軟體保護您的企業免於最新的威脅與病毒AVG 2016 business edition customer deck - 屢獲殊榮的防毒軟體保護您的企業免於最新的威脅與病毒
AVG 2016 business edition customer deck - 屢獲殊榮的防毒軟體保護您的企業免於最新的威脅與病毒Cheer Chain Enterprise Co., Ltd.
 
德國 combit List & label 21 報表設計工具軟體新功能介紹
德國 combit List & label 21 報表設計工具軟體新功能介紹德國 combit List & label 21 報表設計工具軟體新功能介紹
德國 combit List & label 21 報表設計工具軟體新功能介紹Cheer Chain Enterprise Co., Ltd.
 
Visual paradigm 13 and ArchiMetric feature comparison 完整功能比較表
Visual paradigm 13 and ArchiMetric feature comparison 完整功能比較表Visual paradigm 13 and ArchiMetric feature comparison 完整功能比較表
Visual paradigm 13 and ArchiMetric feature comparison 完整功能比較表Cheer Chain Enterprise Co., Ltd.
 
德國 Maxqda 12 質性分析軟體 入門及完整參考手冊
德國 Maxqda 12 質性分析軟體 入門及完整參考手冊德國 Maxqda 12 質性分析軟體 入門及完整參考手冊
德國 Maxqda 12 質性分析軟體 入門及完整參考手冊Cheer Chain Enterprise Co., Ltd.
 

Plus de Cheer Chain Enterprise Co., Ltd. (20)

Focused Analysis of #Qualitative #Interviews with #MAXQDA Step by Step - #免費 ...
Focused Analysis of #Qualitative #Interviews with #MAXQDA Step by Step - #免費 ...Focused Analysis of #Qualitative #Interviews with #MAXQDA Step by Step - #免費 ...
Focused Analysis of #Qualitative #Interviews with #MAXQDA Step by Step - #免費 ...
 
Maxqda 2020 質性分析及混合研究理論應用軟體完整使用手冊(英文版)
Maxqda 2020 質性分析及混合研究理論應用軟體完整使用手冊(英文版)Maxqda 2020 質性分析及混合研究理論應用軟體完整使用手冊(英文版)
Maxqda 2020 質性分析及混合研究理論應用軟體完整使用手冊(英文版)
 
#Acunetix #product #presentation
#Acunetix #product #presentation#Acunetix #product #presentation
#Acunetix #product #presentation
 
DEA SolverPro Newsletter19
DEA SolverPro Newsletter19DEA SolverPro Newsletter19
DEA SolverPro Newsletter19
 
#Riverflow2 d gpu tests 2019
#Riverflow2 d gpu tests 2019#Riverflow2 d gpu tests 2019
#Riverflow2 d gpu tests 2019
 
DEA-Solver-Pro Version 14d- Newsletter17
DEA-Solver-Pro Version 14d- Newsletter17DEA-Solver-Pro Version 14d- Newsletter17
DEA-Solver-Pro Version 14d- Newsletter17
 
Doctor web Company profile 防毒軟體公司簡介
Doctor web Company profile 防毒軟體公司簡介Doctor web Company profile 防毒軟體公司簡介
Doctor web Company profile 防毒軟體公司簡介
 
Getting started-guide-maxqda2018 MAXQDA 2018 質性分析軟體 中英文快速入門手冊
Getting started-guide-maxqda2018 MAXQDA 2018 質性分析軟體 中英文快速入門手冊Getting started-guide-maxqda2018 MAXQDA 2018 質性分析軟體 中英文快速入門手冊
Getting started-guide-maxqda2018 MAXQDA 2018 質性分析軟體 中英文快速入門手冊
 
NativeJ screenshot - NativeJ is a powerful Java EXE maker!
NativeJ screenshot - NativeJ is a powerful Java EXE maker!NativeJ screenshot - NativeJ is a powerful Java EXE maker!
NativeJ screenshot - NativeJ is a powerful Java EXE maker!
 
Edraw Max Pro 使用者手冊 - All-In-One Diagram Software!!
Edraw Max Pro  使用者手冊 - All-In-One Diagram Software!!Edraw Max Pro  使用者手冊 - All-In-One Diagram Software!!
Edraw Max Pro 使用者手冊 - All-In-One Diagram Software!!
 
Nvidia gpu-application-catalog TESLA K80 GPU應用程式型錄
Nvidia gpu-application-catalog TESLA K80 GPU應用程式型錄Nvidia gpu-application-catalog TESLA K80 GPU應用程式型錄
Nvidia gpu-application-catalog TESLA K80 GPU應用程式型錄
 
Atlas.ti 8 質性分析軟體新功能介紹_祺荃企業有限公司
Atlas.ti 8 質性分析軟體新功能介紹_祺荃企業有限公司Atlas.ti 8 質性分析軟體新功能介紹_祺荃企業有限公司
Atlas.ti 8 質性分析軟體新功能介紹_祺荃企業有限公司
 
Maxqda12 features -detailed feature comparison for more information about eac...
Maxqda12 features -detailed feature comparison for more information about eac...Maxqda12 features -detailed feature comparison for more information about eac...
Maxqda12 features -detailed feature comparison for more information about eac...
 
CABRI® 3D V2 - 革命性的數學工具(中文操作手冊)
CABRI® 3D V2 - 革命性的數學工具(中文操作手冊)CABRI® 3D V2 - 革命性的數學工具(中文操作手冊)
CABRI® 3D V2 - 革命性的數學工具(中文操作手冊)
 
MAXQDA 12 質性(定性)分析軟體中文入門指南
MAXQDA 12 質性(定性)分析軟體中文入門指南MAXQDA 12 質性(定性)分析軟體中文入門指南
MAXQDA 12 質性(定性)分析軟體中文入門指南
 
全新 Veeam Availability Suite v9包括 Veeam Backup & Replication 和 Veeam ONE 備份解決方...
全新 Veeam Availability Suite v9包括 Veeam Backup & Replication 和 Veeam ONE 備份解決方...全新 Veeam Availability Suite v9包括 Veeam Backup & Replication 和 Veeam ONE 備份解決方...
全新 Veeam Availability Suite v9包括 Veeam Backup & Replication 和 Veeam ONE 備份解決方...
 
AVG 2016 business edition customer deck - 屢獲殊榮的防毒軟體保護您的企業免於最新的威脅與病毒
AVG 2016 business edition customer deck - 屢獲殊榮的防毒軟體保護您的企業免於最新的威脅與病毒AVG 2016 business edition customer deck - 屢獲殊榮的防毒軟體保護您的企業免於最新的威脅與病毒
AVG 2016 business edition customer deck - 屢獲殊榮的防毒軟體保護您的企業免於最新的威脅與病毒
 
德國 combit List & label 21 報表設計工具軟體新功能介紹
德國 combit List & label 21 報表設計工具軟體新功能介紹德國 combit List & label 21 報表設計工具軟體新功能介紹
德國 combit List & label 21 報表設計工具軟體新功能介紹
 
Visual paradigm 13 and ArchiMetric feature comparison 完整功能比較表
Visual paradigm 13 and ArchiMetric feature comparison 完整功能比較表Visual paradigm 13 and ArchiMetric feature comparison 完整功能比較表
Visual paradigm 13 and ArchiMetric feature comparison 完整功能比較表
 
德國 Maxqda 12 質性分析軟體 入門及完整參考手冊
德國 Maxqda 12 質性分析軟體 入門及完整參考手冊德國 Maxqda 12 質性分析軟體 入門及完整參考手冊
德國 Maxqda 12 質性分析軟體 入門及完整參考手冊
 

Dernier

Xen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfXen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfStefano Stabellini
 
PREDICTING RIVER WATER QUALITY ppt presentation
PREDICTING  RIVER  WATER QUALITY  ppt presentationPREDICTING  RIVER  WATER QUALITY  ppt presentation
PREDICTING RIVER WATER QUALITY ppt presentationvaddepallysandeep122
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesPhilip Schwarz
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfAlina Yurenko
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024StefanoLambiase
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanyChristoph Pohl
 
Cyber security and its impact on E commerce
Cyber security and its impact on E commerceCyber security and its impact on E commerce
Cyber security and its impact on E commercemanigoyal112
 
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)jennyeacort
 
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Angel Borroy López
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Velvetech LLC
 
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdf
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdfInnovate and Collaborate- Harnessing the Power of Open Source Software.pdf
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdfYashikaSharma391629
 
Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)Ahmed Mater
 
Powering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsPowering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsSafe Software
 
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...confluent
 
Comparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfComparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfDrew Moseley
 
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...Akihiro Suda
 
VK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web DevelopmentVK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web Developmentvyaparkranti
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesŁukasz Chruściel
 
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Natan Silnitsky
 
UI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptxUI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptxAndreas Kunz
 

Dernier (20)

Xen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfXen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdf
 
PREDICTING RIVER WATER QUALITY ppt presentation
PREDICTING  RIVER  WATER QUALITY  ppt presentationPREDICTING  RIVER  WATER QUALITY  ppt presentation
PREDICTING RIVER WATER QUALITY ppt presentation
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a series
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
 
Cyber security and its impact on E commerce
Cyber security and its impact on E commerceCyber security and its impact on E commerce
Cyber security and its impact on E commerce
 
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
 
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...
 
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdf
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdfInnovate and Collaborate- Harnessing the Power of Open Source Software.pdf
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdf
 
Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)
 
Powering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsPowering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data Streams
 
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
 
Comparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfComparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdf
 
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
 
VK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web DevelopmentVK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web Development
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New Features
 
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
 
UI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptxUI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptx
 

PostSharp - the #1 best-selling pattern-aware extension to C# and VB. 產品介紹及應用凡例 2015(cce)

  • 2. • Lack of support for patterns in C# and VB resulting in boilerplate code • Consequences: • High development effort • Poor quality of produced software • Difficulty to add/modify functionality  after first release • Slow ramp‐up of new team members Problem
  • 5. • Four main reasons to consider pattern‐aware compiler  extensions: 1. Stop writing boilerplate code and deliver faster 2. Build more reliable software 3. Easier to add/modify functionality after first release 4. New members contribute quicker Pattern‐Aware Compiler Extensions
  • 6. • Fewer lines of code means fewer hours of  work • Outsource repetitive work to compiler and  save time and costs immediately 1) Stop Writing Boilerplate and Deliver Faster
  • 7. • Cleaner code means fewer defects  • Reliability becomes much more  affordable • Cheaper to implement reliability features • The “right” tool 2) Build More Reliable Software
  • 8. • Cleaner and shorter code is easier to  understand • Focus on business logic and save time trying to  understand the code • Better architecture is future‐proof • Define features such as logging, exception  handling or transactions in one place and make  their modification easy and fast 3) Easier to Modify Functionality 
  • 9. • Better division of labor  • New team members can focus on business logic  without worrying about complex architectural structures   • Implement a tighter feedback loop  • Validate hand‐written code against  your defined rules at build time  and detect bugs as quickly 4) New Team Members Contribute Quicker
  • 11. • Trusted by over 50,000 satisfied developers worldwide • Over 1,000 of the world’s largest corporations • More than 10% of all Fortune 500 companies rely on PostSharp Used by World’s Largest Corporations
  • 12. • Five main reasons to consider PostSharp 1. Get more productive in minutes 2. Automate more complex patterns and remove boilerplate 3. Build thread‐safe apps‐‐without a PhD 4. Maintain your existing codebase in C# or Visual Basic 5. Benefit from much better run‐time performance Best Solution
  • 13. • INotifyPropertyChanged Pattern • Eliminate repetition and go from 3 lines of  code per property to 1 attribute per base class  • Undo/Redo Pattern • Add the feature easily without writing large  amounts of code • Code Contracts • Protect your code from invalid inputs  • Logging Pattern • Trace everything you need in minutes without  cluttering your code 1) Get More Productive in Minutes 
  • 14. • PostSharp Aspect Framework • Define your own patterns and automate their  implementation • Largest choice of possible transformations  • Dynamic aspect/advice providers  • Aspect inheritance • Relieves you from implementing the aspects  manually and ensures that all derived classes using  this aspect's logic is correct • Architecture framework  • Validate you source code against your custom  pattern guidelines 2) Automate Complex Patterns & Remove Boilerplate
  • 15. • Seven different threading models • Address multi‐threading at high‐level of  abstraction • Decrease lines of code, defects and reduce costs – without expertise in multi‐threading. • Includes Immutable, Freezable, Synchronized,  Reader‐Writer Synchronized, Actor, Thread Affine  and Thread Unsafe 3) Build Thread‐Safe Apps – without a PhD
  • 16. • Model validation • Catches most defects during build or during single‐ threaded test coverage • Thread dispatching patterns • Dispatch work to background or UI threads • Deadlock detection • Get an easy‐to‐diagnose exception in case of  deadlock instead of allowing the application to  freeze  3) Build Thread‐Safe Apps – without a PhD
  • 17. • Plain C# and VB • Get the benefits of F#, Scala, Nemerle, Python,  Ruby or JavaScript in C# and VB • Cross‐platform • Supports .NET Framework, Windows Phone,  WinRT, Xamarin and Portable Class Libraries • Standard skillset • No complex API. Reuse what you already know  from C# and System.Reflection 4) Maintain Existing Codebase in C# and VB
  • 18. • Build‐time code generation • Code modification at build time  • No reflection at run‐time • Build‐time initialization • Analyze the target code at build‐time and don’t  waste time on analysis at run‐time  5) Much Better Run‐Time Performance
  • 19. Now let me prove how you can  1. Get more productive in minutes 2. Automate more complex patterns and  remove more boilerplate 3. Build thread‐safe apps without a PhD  … all without having to change your  existing compiler Let’s see the product… Show Me The Product
  • 20. • Will I be able to understand my code? • Yes. Thanks to PostSharp’s Visual Studio tooling, you’ll easily understand  where and how patterns are used in your code • Can I keep using my existing compiler? • Yes. PostSharp is 100% compatible with your existing Microsoft compiler • Compilation will be slower • Possibly. PostSharp introduces additional steps into the compilation, there is a  performance cost. However, PostSharp is highly optimized several times faster  than FxCop, etc. What’s Holding You Back?
  • 21. “The new code is much less complex and much easier to maintain.”  Daniel Wolf, Project Manager, mobileX AG Testimonials “…a pretty amazing piece of software...whole point of what  the computer is supposed to do…”  Scott Hanselman, Principal Program Manager, Microsoft “…very easy to use… helps my team complete features faster.”  Bernd Hengelein, Software Architect, Siemens Audiology “It has reduced thousands of lines of code.” Kshitij Deshmukh, Software Development Manager, Mitchell International
  • 23. • Each line of code costs $14. Including boilerplate. • A developer typically produces 600 lines of code per  month. • Average cost for 1 developer is $100k a year ‐ at least. • PostSharp pays off after he/she saves first 50 lines of  code • PostSharp reduces source code size by up to 20% • If it reduces by only 5% ‐ saves $5,000 per developer • Recoup your investment as soon as within 45‐days of  usage • PostSharp has one of the highest ROI:  15 to 55 times the investment • You never lose – you always win Return on Investment
  • 25. • Trusted by over 50,000 satisfied developers worldwide • Over 1,000 of the world’s largest corporations • More than 10% of all Fortune 500 companies rely on PostSharp Over 50,000 Developers – World’s Largest Corporations All trust…
  • 26. • No more copying and pasting blocks of code to  add a functionality • No more spending hours trying to understand the  business logic of the code • No more hiring an expensive specialists to build  thread‐safe applications • Cut development and maintenance costs • Go to market faster • Produce high‐quality, easy‐to‐maintain software  that has fewer bugs – with less development  effort Picture this Life is Good!
  • 27. • Sign up for free trial • Go to www.postsharp.net • Read case studies and testimonials • Attend a free live webinar • Get the price or request a quote • Contact us with any questions Let’s Get Started!
  • 30. CASE STUDY: Siemens Audiology “Within the code of our presentation layer (mainly ViewModels and XAML code) we saved about 15% just by using the ViewModelAspect.” Bernd Hengelein Software Architect Siemens Audiology
  • 31. 2 Summary When the team at Siemens Audiology, a business unit of Siemens Sector Healthcare, started development on a new WPF implementation for two of its existing hearing system software applications it chose PostSharp to deliver a decrease in boilerplate code and software defects – saving them 15% within their presentation layer code. Team to deliver new WPF implementation for existing apps Siemens Audiology, a business unit of Siemens Sector Healthcare, develops and distributes hearing devices to hearing care professionals worldwide. The company’s development team began looking into aspect-oriented programming and PostSharp as they started development on a new WPF implementation for two of its existing hearing system software applications. “The WPF applications that we are developing are based on the MVVM (Model-View-ViewModel) pattern for its testability and powerful data binding capabilities,” says Bernd Hengelein, the software architect behind Siemens Audiology’s development team.“There are some repetitive tasks involved when writing ViewModels, such as implementing INotifyPropertyChanged for each property, and creating DelegateCommand for each method on the ViewModel that you want to bind to a UI element.” Why Siemens Audiology chose PostSharp Recognizing the importance of removing boilerplate code, the team began developing PostSharp aspects to do all the repetitive work for them. “For standard use cases, PostSharp is very easy to use” says Bernd,“for instance, implementing a simple tracing aspect is a piece of cake. We chose PostSharp, rather than alternatives like transparent proxy solutions, because we wanted to have maximum performance during runtime.” “We chose PostSharp, rather than alternatives like transparent proxy solutions, because we wanted to have maximum performance during runtime.” Bernd Hengelein Software Architect Siemens Audiology Siemens Audiology A leading supplier of hearing devices saves from having to write INotifyPropertyChanged and creating ICommand properties needed for data binding.
  • 32. 3 Build and inject custom aspects into existing applications Using PostSharp, the Siemens Hearing Instruments team built a number of aspects to cover some interesting use cases including ViewModel, Threading, and Localization. ViewModelAspect The most complex of all the aspects used by the team, it saves writing time for developers implementing ViewModels and increases source code readability by removing boilerplate code. While the aspect was primarily built to handle INotifyPropertyChanged , ease refactoring and avoid typos – it also saves the team from having to implement all the delegate commands in their MVVM implementation. “The aspect is created automatically for each public void method, and creates a delegate command together with a new property of type ICommand that can be bound to the UI,” says Bernd.“This makes it very easy for us when new ViewModels are developed. We just put our ViewModelAspect on it, write the public methods – which can be bound to the UI - and all the INotifyPropertyChanged and command stuff is done instantly.” Threading Aspect The aspect is used by the team to execute long-running business operations within a separate thread and keeps them focused on implementing relevant business logic instead of threading issues. “We have two solutions,” says Bernd,“in the first we add an attribute to a method and it’s executed in a worker thread. Later we added a business thread - where all the business operations take place – so we add it to a method and the aspect takes care of routing the call into the business thread and executing it. Then, with an additional aspect we call AsyncCallback, we indicate that it’s a callback method and it’s routed back to the UI thread using the dispatcher in WPF.” “Within the code of our presentation layer (mainly ViewModels and XAML code) we saved about 15% just by using the ViewModelAspect.” Bernd Hengelein Software Architect Siemens Audiology
  • 33. 4 Localization Aspect This aspect is part of the company’s localization infrastructure and relieves developers from manually having to trigger it for complex texts within ViewModels.“We have to be able to change the language of our applications during runtime so when a new language is selected the UI adapts,” says Bernd.“The team has two approaches to the localization requirement. For static texts, found in the XAML file, we use custom markup extensions, which are added to the text, and the localization manager takes care of the localization. Dynamic texts, which are enhanced from information in the business logic, are handled inside ViewModels. These more complex texts are built by enhancing a text snippet with the information from the business logic and, calling on the localization manager, we simply add LocalizeAspect to a string property. The aspect takes care of the string you provide with the property then goes to the localization manager, does the localization, then returns the localized string.” PostSharp reduces code duplication and adds maintenance “Within the code of our presentation layer (mainly ViewModels and XAML code) we saved about 15% just by using the ViewModelAspect” says Bernd. One of the most cited benefits of AOP and PostSharp is time saved in reading and writing by the removal of boilerplate code. The team at Siemens Audiology experienced the time savings first hand. “Releasing developers from writing boilerplate or infrastructure code helps my team to complete features faster,“ says Bernd.“While total cost savings may be difficult to quantify, we definitely saved coding time. We were relieved from writing the code for INotifyPropertyChanged and creating ICommand properties needed for data binding. We also avoided errors/bugs which would have occurred by forgetting to raise the appropriate PropertyChanged events.” SharpCrafters s.r.o. Namesti 14 rijna, 1307/2 150 00 Prague 5 Czech Republic US: +1 866 576 5361 CZ: +420 270 007 790 www.postsharp.net info@postsharp.net
  • 34. CASE STUDY: mobileX AG “Sure, we achieved some considerable savings in terms of LOC. But more importantly, the new code is much less complex and much easier to maintain. This is what really saves time and money in the long run.” Daniel Wolf Project Manager mobileX AG
  • 35. 2 Summary When the lead developers at mobileX began a huge refactoring project – migrating the company’s codebase to the .NET 3.5 framework then rewriting their flagship application from WinForms to WPF – the biggest challenge was to improve code maintainability by reducing code complexity. They chose PostSharp for its out-of-the-box solutions that eliminate code repetition without changing application architecture. Lead developers migrate main app to .NET 3.5 framework After struggling with the company’s main product, an application that grew into a monolith over the years, the lead developers at mobileX received approval from management to upgrade to the .NET 3.5 framework and take advantage of higher-level APIs like WPF to improve client-facing customizations. “We just arrived at a point where many things needed improvement,” says Daniel Wolf, Project Manager at mobileX.“It was far too hard to change individual bits of it for our individual customers. At that point we got permission to spend about half a year completely redoing much of the main part of the application and another half a year reworking what we already had and refactoring it.” Custom application extensions required a lot of repetitive code Daniel’s team builds the front end of the company’s main application. His team also develops custom extensions for clients and the logic behind them can be quite complex depending on the number of dependencies and validation rules between values controlled by different parts of the UI. As the number of diverse dependencies between inputs rises they often become multi-layered, where the input in control A determines the number of input selections available for controls B and C. So, when the value of control A is changed, controls B and C need to be updated in exactly the right order to avoid erroneous results. “We just wanted some out of the box solutions we could apply to some classes and not others without a huge change to our existing code base.” Daniel Wolf Project Manager mobileX AG mobileX AG A mobile workforce management solutions provider reduces code complexity and improves code maintainability in its applications with PostSharp.
  • 36. 3 Using a traditional approach, the team had to be very careful with any implementation, attaching and later detaching, event handlers. Because attaching and detaching takes place at different times, it was easy for team members to forget to detach – leading to memory leaks. Why mobileX chose PostSharp During that time, Daniel and the other lead developers looked at several technologies they had not used before. They soon came to the conclusion that Aspect-Oriented Programming was the best solution for the job at hand but they weren’t keen on how dynamic proxies forced developers into their architecture rather than adapting to the developer’s architecture. That’s when they discovered PostSharp and the benefits of compile-time weaving. “There was no other product on the market that could do what we wanted to do,” says Daniel.“We wanted aspect orientation to be one tool among others in our toolbox. We didn’t want to have to change anything to use it,” he said.“We just wanted some solutions that were out of the box and that we could just apply to some classes and not apply to other classes, and they would not mean a huge change to our existing code base.” How mobileX implements PostSharp Using PostSharp, the team at mobileX built a number of custom aspects to cover important use cases including INotifyPropertyChanged, AutoWiring and Const. INotifyPropertyChanged In GUI programming, one very repetitive task is implementing the INotifyPropertyChanged interface and making sure all relevant properties throw an event when changed. This simple aspect can be applied to any read-write property and will automatically add the required glue code, including the test if the new value actually differs from the old one. “This attribute takes care of those hundreds of simple properties without too much logic in them,” says Daniel.“It is a clean solution that allows us to write succinct code and it dramatically improves readability, since it allows us to use automatic properties most of the time. Without it, all those properties would have to be implemented explicitly. In the past, the required backing fields used to clutter our code without adding any value.
  • 37. 4 AutoWiring This aspect is the “bigger brother” of the INotifyPropertyChanged aspect. You apply it to a property and tell it which values the property depends on by giving it a list of binding-style property paths. It then tracks changes to all properties along those paths, much the same way WPF does. If any of these input values change, the property value is re- evaluated, and a change event is raised if appropriate. “Handling change notifications used to be a real challenge,” says Daniel, “especially in those cases where changes to one property need to trigger a change in another property, which again needs to trigger changes elsewhere. We used to end up with lots of hard-coded dependencies, where one property would raise change events for a whole bunch of other properties that depended on it. It was hard to get right and a maintenance nightmare afterwards. Now, with AutoWiring, we simply declare what values a property depends on. And it just works – no matter how complex the dependencies.” If the team were to refactor the code, it would consider using ready-made aspects shipped with PostSharp: “It seems PostSharp Model Patterns Library now offers a similar feature out-of-the-box, with even less manual work. Unfortunately, the feature was still in development when we needed it” says Juan, a colleague of Daniel. Const This attribute can be applied to any property that only has a getter. On first access, it caches the return value. On every subsequent access, it simply returns the cached value. “This aspect may seem trivial at first, but turns out to be a real asset when it comes to writing efficient code,” says Daniel.“Many properties need to perform expensive operations to calculate their value. In the past we either pre-computed and assigned these values in the constructor, which meant a delay even if the property was never actually accessed, or we calculated the value within the property getter, which helped initial load time but meant an additional delay on each property access – even for properties we knew would not change. If we really wanted to maximize performance, we had to use additional backing fields to implement lazy loading. Now, we simply put all the logic into the property’s getter and decorate it with the Const attribute. And just like that, we get lazy loading and optimal performance.” “Sure, we achieved some considerable savings in terms of LOC. But more importantly, the new code is much less complex and much easier to maintain. This is what really saves time and money in the long run.” Daniel Wolf Project Manager mobileX AG
  • 38. 5 SharpCrafters s.r.o. Namesti 14 rijna, 1307/2 150 00 Prague 5 Czech Republic US: +1 866 576 5361 CZ: +420 270 007 790 www.postsharp.net info@postsharp.net Simpler code that’s easier to maintain The team calculated a total savings of over ten thousand lines of code (LOC) on the project by using PostSharp, but believes the real savings come from reduced code complexity and improved maintainability. “Can I look at some piece of code and immediately understand what it does and how it works? Is it easy to spot errors and fix them without breaking code elsewhere? That’s what really counts. And this is where PostSharp shines,” says Daniel.“Sure, we achieved some considerable savings in terms of LOC. But more importantly, the new code is much less complex and much easier to maintain. This is what really saves time and money in the long run.”
  • 39. CASE STUDY: Gamesys “If we were able to continuously develop and operate several high- volume games in production with such a small team, it was partly thanks to PostSharp.” Yan Cui Senior Backend Developer Gamesys
  • 40. 2 Overview Gamesys serves around one million daily active users across its social games. Their backend services handle more than 250 million requests per day. Despite its massive scale, this distinctive service is being maintained by a remarkably small development team of just seven super-productive individuals. They chose PostSharp to automate the implementation of their design patterns, outsourcing mundane tasks to the compiler so they can focus on what matters. Small team, big challenges Although Gamesys employs more than 1,000 people globally and operates in a number of markets across the UK, Europe and the US, the Social team’s backend services are overseen by a small team of developers. As such, it is critical that the team minimize inconveniences and concentrate on tasks that are essential to the work at hand. “With a small team of seven developers who are responsible for everything that happens on the back end, it’s imperative that we allow them to focus on things that add value to our players and maximise their productivity,” says Yan Cui, Senior Backend Developer at Gamesys’s Social team. The team is responsible for building scalable backend services to support Gamesys’ social games on mobile devices and Facebook. Across the company’s range of social games, it has around one million daily active users, and its backend services receive around 250 million requests per day. This requires the team to deliver high-quality solutions that will enable the backend team to work at peak efficiency. The team has worked on several projects that presented various challenges and called for comprehensive problem-solving approaches: 1. Performance monitoring; 2. Error handling; and 3. Localization. “Thanks to PostSharp, we were able to localize over 95 percent of the game with just one line of code and save potentially hundreds of man hours over the lifetime of the game.” Yan Cui Senior Backend Developer Gamesys Gamesys The market leader in the field of real money gaming improves productivity and reduces development and maintenance costs with PostSharp.
  • 41. 3 Why Gamesys chose PostSharp The team chose PostSharp over alternative solutions for a number of reasons: • PostSharp offers the most complete support of features they have been looking for, such as: 𐐬𐐬 The ability to multicast aspects using filters, therefore targeting several methods employing a single line of code; 𐐬𐐬 The ability to intercept events; and 𐐬𐐬 The ability to introduce members dynamically. • PostSharp provides the best runtime performance, as most of the work is done at compile time. • PostSharp works consistently across public, private and static members and does not depend on an object that is constructed by the IOC container. • PostSharp enables developers to automatically verify at build time how aspects are being used, failing the build if an aspect has been applied to an inadequate method. “When I first joined Gamesys in 2010, our code base was littered with cross-cutting concerns such as exception handling and validation, and in general the control flows were so convoluted that it was difficult to see what the application was actually doing a lot of the time,” says Yan.“So when I encapsulated those repeated patterns into several aspects and cleaned up our code base using PostSharp, it was all the motivation and convincing everyone needed.” Performance Monitoring: Solved For Gamesys, it is essential to have visibility of both what and how their application is doing. Therefore, the company needed a solution that would make it easy for its developers to track execution time and count of service entry points, IO operations, and CPU-intensive methods. Taking a traditional approach to solve this would have led to a lot of boilerplate code and would have cluttered the company’s code base. With PostSharp, the team created a pair of aspects – LogExecutionTime and LogExecutionCount – to track the execution time and the count of any performance-sensitive method.
  • 42. 4 The pair of aspects records execution metrics pertaining to these methods and funnels them to an in-memory aggregator that aggregates the per-instance metrics and publishes them to Amazon CloudWatch periodically. LogExecutionTime OnEntry OnSuccess MetricsAggregator Amazon Cloudwatch Start timer Invoke method Record metric End timer Error Handling: Solved Effective error handling presented a real challenge for Gamesys, as the company had hundreds of specific errors for each of its games. Every request to the company’s client-facing services has a matching response object, which derives from a BaseResponse class that looks like the following: public abstract BaseResponse { public int? ErrorCode { get; set; } public string ErrorMessage { get; set; } } When a request fails for whatever reason (e.g., a player tries to buy a Broadaxe but has run out of space in his or her backpack), they always return a response object back to the client with an ErrorCode so that the client can address it depending on the type of error. The team created a custom PostSharp aspect, an ExceptionHandler, which provides team members with desired functionality, and which is now a core piece in the company’s infrastructure. “Over the years, Postsharp has helped us to save over tens of thousands lines of code .” Yan Cui Senior Backend Developer Gamesys
  • 43. 5 The team multicast the aspect to all methods that are service entry points so that anytime an exception is thrown and bubbles up, the aspect will: 1. Capture the exception information; 2. Log it with Gamesys’ logging infrastructure; a. Record all exceptions in the ElasticSearch cluster; b. Push critical (all the custom exceptions specify a SeverityLevel) exceptions that warrant more urgent attention to Sentry, which sends notifications to the relevant team members; 3. Create a response object of the correct type; 4. Populate the ErrorCode and ErrorMessage properties; and 5. Return the dynamically created response object. “This simple aspect is reused in every project and plays an important role in our infrastructure,” says Yan. ElasticSearch Sentry Logger ExceptionHandler Log Client OnException Log ExceptionGenerate response object Localization: Solved “It was something of a mammoth task when we decided to localize the game Here Be Monsters for Flash and iOS clients, as we have more than 3,500 items and 1,500 quests in the game, with more text than the first three Harry Potter books combined,” says Yan. With the conventional approach, the client would consume a gettext file containing all of the translations, and anywhere some text needs to display, the gettext file would substitute the original text with the localized text.
  • 44. 6 This would lead to several issues: • A large number of code files need to change during implementation. • Maintenance overhead - all future changes need to take localization into account. • Duplicated efforts - need to replicate changes across client platforms. • Hard to scale - complicates implementation and testing; easy for regression to creep in during frequent release cycles. To localize the game Here Be Monsters for Flash and iOS clients, the team created custom aspects with PostSharp and performed localization on the server as part of the pipeline that validates and publishes the data (quests, achievements, items, etc.) captured in their custom CMS. CMS Publisher Generates platform specific data iOS Flash Server Localise here Requires localisation As part of its solution, the Publisher would: 1. Ingest the gettext translation file. 2. Use the Localize aspect (see a simplified version here) to intercept string property setters on DTOs to replace the input string with the localized version. 3. Repeat for each language to generate a language-specific version of the DTOs. To automatically apply localization to all present and future DTO types, they simply multicast the attribute and target all types that follow our naming convention for DTOs: [assembly: Localize(AttributeTargetTypes = "*DTO")] “With one line of code, we were able to localize over 95 percent of the game and save potentially hundreds of man hours over the lifetime of the game,” says Yan. “If we were able to continuously develop and operate several high-volume games in production with such a small team, it was partly thanks to PostSharp.” Yan Cui Senior Backend Developer Gamesys
  • 45. 7 Summary The team at Gamesys is pleased with the results from using PostSharp: • Improved productivity thanks to more concise and maintainable code; • Less code to write, read and maintain, resulting in reduced development and maintenance costs; and • Fewer bugs. “It’s difficult to measure how many lines of code and how much development and maintenance costs PostSharp has helped us to save, but over the years, we could have easily saved over tens of thousands lines of code,” says Cui.“The fact that we are able to continuously develop and operate several high-volume games in production with such a small team is in part thanks to PostSharp.” SharpCrafters s.r.o. Namesti 14 rijna, 1307/2 150 00 Prague 5 Czech Republic US: +1 866 576 5361 CZ: +420 270 007 790 www.postsharp.net info@postsharp.net
  • 46. CASE STUDY: Mitchell International “PostSharp was especially good when we needed to transfer data between applications. We would have had to write a lot of code if not for PostSharp and now we don’t even think about it. It made life a lot easier now from a development point of view.” Kshitij Deshmukh Rensfield Software Development Manager Mitchell International
  • 47. 2 Summary When the team at Mitchell International was asked to deliver a new suite of client-facing applications, one of its greatest challenges was to keep code repetition to a minimum. After evaluating a number of solutions, the development team at Mitchell chose PostSharp to deliver a significant decrease in boilerplate code and software defects – saving them from having to write tens of thousands of lines of code. Engineers to deliver a new suite of client-facing software As North America’s leading provider of property & casualty claims management solutions, Mitchell International processes more than 50 million transactions annually for over 300 insurance companies and claims payers, and over 30,000 car collision repair shops. The development team at Mitchell was tasked with delivering a new suite of client-facing software packages to: 1. simplify the company’s claims management processes; and 2. accelerate the company’s collision repair processes. The new suite of applications, to be developed using the latest .NET technologies, had to be combined with disparate applications that have been in the marketplace for many years. This integration added a lot of complexity to the project. Integration requires a lot of repetitive code At the start of the project the development manager and principal engineer assessed Mitchell’s existing client-facing software and discovered a mix of old Windows-based applications written in a variety of different technologies.“Visual C++, Visual Basic and WinForms just to name a few,” says Kshitij Deshmukh, Mitchell’s Software Development Manager. Mitchell International North America’s leading provider of property & casualty claims management solutions saves from having to write tens of thousands of lines of code with PostSharp.
  • 48. 3 The biggest challenge involved a huge C++ application that served as the main engine and revenue generator for their business: • the application was 20 year old; and • almost 2 million lines of code. Rather than confront the daunting task of rewriting the application from the ground up, the team chose to break it into smaller components and tackle each of them separately. Continuing to use the C++ application as the main engine, the team set about rewriting all of its peripheral pieces one-by-one using .NET 4.0 and Windows Presentation Foundation as part of the new suite, visually embedding the old application in the center of the new one. “As part of that process, we found that some of the existing patterns had a lot of repetition in them,” says Kshitij,“especially in MVVM where you have to bind to all of the controls in XAML. There was a lot of code that you had to just continually keep writing all the time.” Why Mitchell chose PostSharp The senior team began looking into run-time solutions to handle repetitive code.“We tried Spring.NET and CastleWindsor,” says Kshitij,“but we soon discovered that there was a lot of run-time expense to incur with these frameworks. That’s when we started looking at compile-time solutions.” Having previously tried PostSharp years earlier, Kshitij and his team evaluated version 2.1 and gave it high marks for: • Visual Studio and MSBuild integration; • high run-time performance; • compile-time performance improvements over earlier versions. Having chosen PostSharp to handle repetitive code in their new suite of software, it was now up to Tony Rensfield, Principal Engineer at Mitchell, to determine how to best implement the framework into the project. “In the beginning of project, Kshitij and I were both writing code and did a lot of the up-front work for many of the aspects that we needed, including some small proof of concepts and their implementations,” says Tony. The proof of concepts served as templates for developers coming in to the project so that, after just a few questions, they could understand how the aspects were applied and go about their day-to-day work of rewriting the peripherals. “PostSharp was especially good when we needed to transfer data between applications. We would have had to write a lot of code if not for PostSharp and now we don’t even think about it. It made life a lot easier now from a development point of view.” Kshitij Deshmukh Software Development Manager Mitchell International
  • 49. 4 Build and inject custom aspects into applications Additionally to a few standard aspects, the team built several aspects to facilitate integration between the new and the old application: • Activity Logging • Exception Handling • Performance Counter • Thread Dispatching • Data Sync Thread Dispatching – A custom aspect was built for pushing threads and calls back onto the GUI thread.“We have events that come from the old application and the new application, and they talk back and forth.” says Tony.“Depending upon when and on what thread those events come in, you might end up making calls that need to be pushed back up to the GUI thread. We have an aspect for that, so if you have a method that might need that, you basically apply that aspect, and it keeps you from having to write all the code to invoke or push it back to the dispatcher.” Activity Logging Aspect – A subset of logging, this custom aspect was built and applied to very specific methods so, when a milestone step is taken in the new application, the team is notified and has the option to push the logs up to their servers or display specific information or instructions to the end user. Data Sync Aspect – A custom aspect was built to assure the applications stay synchronized with each other.“Approximately 30% of properties in the new applications are exact replications of the properties that exist in the old application”, says Tony,“so we wrap these properties in an aspect that basically transfers the changes to the other application through an API. As the user is changing those properties live, these changes get transferred so that the two applications stay synchronized.” “The fact that none of our 18 developers have ever had to write an exception handler or even one logging line in this project is a huge win for us. Using aspects prevents a lot of user error and in that way PostSharp has been amazing for us.” Anthony Rensfield Principal Engineer Mitchell International
  • 50. 5 SharpCrafters s.r.o. Namesti 14 rijna, 1307/2 150 00 Prague 5 Czech Republic US: +1 866 576 5361 CZ: +420 270 007 790 www.postsharp.net info@postsharp.net PostSharp reduces tens of thousands of lines of code The team at Mitchell is pleased with the results from using PostSharp: • reduced boilerplate code • code is more readable • code is easier to maintain “It has reduced thousands of lines of code,” says Kshitij.“You apply an aspect and it takes care of everything without having to mess around with each and every property or method. Now we can just look at business logic without actually having to worry about all the rest of the bookkeeping that needs to happen around it.” Kshitij and Tony are also pleased with how PostSharp makes enforcing good architecture practices easy.“You enforce a certain methodology so that you don’t get team members doing things they’re not supposed to and doing so helps to clean up everything and keep it that way.” says Tony. “PostSharp has saved us from writing so many lines of code that it’s hard to even quantify. The fact that none of our developers have ever had to write an exception handler or even one logging line in this project is a huge win for us. Using aspects prevents a lot of user error and in that way PostSharp has been amazing for us.”