SlideShare a Scribd company logo
1 of 29
Introduction to Aspect-Oriented-Programming
TOPICS

 -   What is bad and good design ?
 -   Problem statement.
 -   What is AOP ?
 -   Demo
WHAT IS BAD DESIGN ?
WHAT IS BAD DESIGN ?

-the system is rigid: it's hard to change a part of the system
without affecting too many other parts of the system

-the system is fragile: when making a change, unexpected
parts of the system break

- the system or component is immobile: it is hard to reuse it in
another application because it cannot be disentangled from
the current application
class GarbageService
{
     public void Transfer(int sourceID, int destinationID, int size)
     {
         Storage source = Storage.GetById(sourceID);
         Storage destination = Storage.GetById(destinationID);

        var garbage = source.GetGarbage(size);
        destination.PutGarbage(garbage);
    }
}
class GarbageService
{
     public void Transfer(int sourceID, int destinationID, int size)
     {
            Trace.TraceInformation("Entering GarbageService.Transfer(
                sourceID={0},destinationID={1})", sourceID, destinationID);

           try
           {
                 Storage source = Storage.GetById(sourceID);
                 Storage destination = Storage.GetById(destinationID);

                 var garbage = source.GetGarbage(size);
                 destination.PutGarbage(garbage);
           }
           catch (Exception ex)
           {
               Trace.TraceError("Exception: GarbageService.Transfer(
               sourceID = {0}, destinationID = {1}) failed : {2}“,
                                sourceID, destinationID, ex.Message);
               throw;
           }
    }
}
class GarbageService
{
        public void Transfer(int sourceID, int destinationID, int size)
        {
            Trace.TraceInformation("Entering GarbageService.Transfer(sourceID = {0}, destinationID =
                                     {1})", sourceID, destinationID);

           if (sourceID <= 0)
           {
               throw new ArgumentOutOfRangeException("sourceID");
           }
           if (destinationID <= 0)
           {
               throw new ArgumentOutOfRangeException("destinationID");
           }
           if (size <= 0)
           {
               throw new ArgumentOutOfRangeException("size");
           }

           try
           {
                 Storage source = Storage.GetById(sourceID);
                 Storage destination = Storage.GetById(destinationID);

                 var garbage = source.GetGarbage(size);
                 destination.PutGarbage(garbage);
           }
           catch (Exception ex)
           {
               Trace.TraceError("Exception: GarbageService.Transfer(sourceID = {0}, destinationID = {1})
                                 failed : {2}“, sourceID, destinationID, ex.Message);
               throw;
           }
       }
}
REQUIREMENTS
• Functional Requirements
    • Line-of-business




• Non functional requirements
    • Logging
    • Caching
    • Transaction
    • Validation
    • Exception Handling
    • Thread Sync
    • GUI Binding
    • … and a lot more!
WHAT IS AOP ?
AOP - is a programming paradigm which aims to increase modularity by allowing the
       separation of cross-cutting concerns.


AOP - an approach that extends OOP and addresses the issue of cross-cutting
      concerns:
        • Encapsulate cross-cutting concerns into Aspects.
        • Improves code reusability, modularity and separation of concerns.
        • Reduces defects by reducing boiler – plate code.


With AOP, you still define the common functionality in one
place, but you can declaratively define how and where this
functionality is applied without having
to modify the class to which you are applying the new
feature.
AOP
• doesn’t solve any new problem
• it’s just another tool in your toolbox
• the main goal is nice separation of concerns
• a decrease in development costs and software
delivery time;
• an increase in application maintainability.
• reduce noise in source == more clean model
AOP TERMINOLOGY
• Join Point
   • place where behavior can be added
• Advice
   • code that can be injected at join points
• Point Cut
   • join points where advices should be applied
AOP WEAVING
• Compile time weaving
   • Source-Level Weaving
   • Modifying the MSIL code

• Run-Time weaving
   • Dynamic Proxy
PostSharp                               is the most

                comprehensive aspect-oriented framework for .NET



Gael Fraiteur
Demo
Philip Laureano
   Comparing Aspect Frameworks
      STATIC VS DYNAMIC AOP
                                       Spring.NET
PostSharp                 LinFu        Castle
                                       MS Unity/PIAB




Build-Time:               Hybrid       Run-Time:
Very Expressive                        Less Expressive
Robust Model                           Brittle Model
Not Invasive                           Invasive
Static                                 Dynamic
   Comparing Aspect Frameworks
EXPRESSIVENESS
What can you do with the framework?

                                          Spring.NET
                      PostSharp   Linfu                Unity/PIAB
                                            Castle
Method Interception      Yes      Yes        Yes          Yes
Private/Sealed
                         Yes      Yes
Member Interception
Event Interception       Yes
Member Introduction      Yes
We need Aspects!
We have
great frameworks!

More Related Content

What's hot

Distributed Objects: CORBA/Java RMI
Distributed Objects: CORBA/Java RMIDistributed Objects: CORBA/Java RMI
Distributed Objects: CORBA/Java RMIelliando dias
 
Lecture4 corba
Lecture4   corbaLecture4   corba
Lecture4 corbapoovi117
 
Adapter 2pp
Adapter 2ppAdapter 2pp
Adapter 2pprajjani
 
50+ java interview questions
50+ java interview questions50+ java interview questions
50+ java interview questionsSynergisticMedia
 
Corba in power system
Corba in power systemCorba in power system
Corba in power systemPROTIM PAUL
 
CORBA Basic and Deployment of CORBA
CORBA Basic and Deployment of CORBACORBA Basic and Deployment of CORBA
CORBA Basic and Deployment of CORBAPriyanka Patil
 
CORBA - Introduction and Details
CORBA - Introduction and DetailsCORBA - Introduction and Details
CORBA - Introduction and Detailsdgsdg2websd
 
Apache Harmony: An Open Innovation
Apache Harmony: An Open InnovationApache Harmony: An Open Innovation
Apache Harmony: An Open InnovationTim Ellison
 
Java interview-questions-and-answers
Java interview-questions-and-answersJava interview-questions-and-answers
Java interview-questions-and-answersbestonlinetrainers
 
Corba concepts & corba architecture
Corba concepts & corba architectureCorba concepts & corba architecture
Corba concepts & corba architecturenupurmakhija1211
 
Massively Scalable Applications - TechFerry
Massively Scalable Applications - TechFerryMassively Scalable Applications - TechFerry
Massively Scalable Applications - TechFerryTechFerry
 

What's hot (20)

Distributed Objects: CORBA/Java RMI
Distributed Objects: CORBA/Java RMIDistributed Objects: CORBA/Java RMI
Distributed Objects: CORBA/Java RMI
 
Corba model ppt
Corba model pptCorba model ppt
Corba model ppt
 
Common Object Request Broker Architecture
Common Object Request Broker ArchitectureCommon Object Request Broker Architecture
Common Object Request Broker Architecture
 
Intel open mp
Intel open mpIntel open mp
Intel open mp
 
Chapter 17 corba
Chapter 17 corbaChapter 17 corba
Chapter 17 corba
 
Api and Fluency
Api and FluencyApi and Fluency
Api and Fluency
 
Lecture4 corba
Lecture4   corbaLecture4   corba
Lecture4 corba
 
Corba
CorbaCorba
Corba
 
Sc11 presentation 2001_06_28
Sc11 presentation 2001_06_28Sc11 presentation 2001_06_28
Sc11 presentation 2001_06_28
 
Adapter 2pp
Adapter 2ppAdapter 2pp
Adapter 2pp
 
50+ java interview questions
50+ java interview questions50+ java interview questions
50+ java interview questions
 
Corba in power system
Corba in power systemCorba in power system
Corba in power system
 
CORBA Basic and Deployment of CORBA
CORBA Basic and Deployment of CORBACORBA Basic and Deployment of CORBA
CORBA Basic and Deployment of CORBA
 
CORBA - Introduction and Details
CORBA - Introduction and DetailsCORBA - Introduction and Details
CORBA - Introduction and Details
 
Apache Harmony: An Open Innovation
Apache Harmony: An Open InnovationApache Harmony: An Open Innovation
Apache Harmony: An Open Innovation
 
Unit iv
Unit ivUnit iv
Unit iv
 
Java interview-questions-and-answers
Java interview-questions-and-answersJava interview-questions-and-answers
Java interview-questions-and-answers
 
Corba
CorbaCorba
Corba
 
Corba concepts & corba architecture
Corba concepts & corba architectureCorba concepts & corba architecture
Corba concepts & corba architecture
 
Massively Scalable Applications - TechFerry
Massively Scalable Applications - TechFerryMassively Scalable Applications - TechFerry
Massively Scalable Applications - TechFerry
 

Similar to AOP in C# 2013

Crafting Evolvable Api Responses
Crafting Evolvable Api ResponsesCrafting Evolvable Api Responses
Crafting Evolvable Api Responsesdarrelmiller71
 
Java 7 - New Features - by Mihail Stoynov and Svetlin Nakov
Java 7 - New Features - by Mihail Stoynov and Svetlin NakovJava 7 - New Features - by Mihail Stoynov and Svetlin Nakov
Java 7 - New Features - by Mihail Stoynov and Svetlin NakovSvetlin Nakov
 
Slicing, Dicing, And Linting OpenAPI
Slicing, Dicing, And Linting OpenAPISlicing, Dicing, And Linting OpenAPI
Slicing, Dicing, And Linting OpenAPIlestrrat
 
Scaling Big Data Mining Infrastructure Twitter Experience
Scaling Big Data Mining Infrastructure Twitter ExperienceScaling Big Data Mining Infrastructure Twitter Experience
Scaling Big Data Mining Infrastructure Twitter ExperienceDataWorks Summit
 
Rapid, Scalable Web Development with MongoDB, Ming, and Python
Rapid, Scalable Web Development with MongoDB, Ming, and PythonRapid, Scalable Web Development with MongoDB, Ming, and Python
Rapid, Scalable Web Development with MongoDB, Ming, and PythonRick Copeland
 
Swift Micro-services and AWS Technologies
Swift Micro-services and AWS TechnologiesSwift Micro-services and AWS Technologies
Swift Micro-services and AWS TechnologiesSimonPilkington8
 
Drilling Cyber Security Data With Apache Drill
Drilling Cyber Security Data With Apache DrillDrilling Cyber Security Data With Apache Drill
Drilling Cyber Security Data With Apache DrillCharles Givre
 
Writing Hadoop Jobs in Scala using Scalding
Writing Hadoop Jobs in Scala using ScaldingWriting Hadoop Jobs in Scala using Scalding
Writing Hadoop Jobs in Scala using ScaldingToni Cebrián
 
Introduction to Apache Flink - Fast and reliable big data processing
Introduction to Apache Flink - Fast and reliable big data processingIntroduction to Apache Flink - Fast and reliable big data processing
Introduction to Apache Flink - Fast and reliable big data processingTill Rohrmann
 
Cannibalising The Google App Engine
Cannibalising The  Google  App  EngineCannibalising The  Google  App  Engine
Cannibalising The Google App Enginecatherinewall
 
introduction to node.js
introduction to node.jsintroduction to node.js
introduction to node.jsorkaplan
 
Bug bites Elephant? Test-driven Quality Assurance in Big Data Application Dev...
Bug bites Elephant? Test-driven Quality Assurance in Big Data Application Dev...Bug bites Elephant? Test-driven Quality Assurance in Big Data Application Dev...
Bug bites Elephant? Test-driven Quality Assurance in Big Data Application Dev...inovex GmbH
 
Microservices Application Tracing Standards and Simulators - Adrians at OSCON
Microservices Application Tracing Standards and Simulators - Adrians at OSCONMicroservices Application Tracing Standards and Simulators - Adrians at OSCON
Microservices Application Tracing Standards and Simulators - Adrians at OSCONAdrian Cockcroft
 
Hadoop: Big Data Stacks validation w/ iTest How to tame the elephant?
Hadoop:  Big Data Stacks validation w/ iTest  How to tame the elephant?Hadoop:  Big Data Stacks validation w/ iTest  How to tame the elephant?
Hadoop: Big Data Stacks validation w/ iTest How to tame the elephant?Dmitri Shiryaev
 
Exploring Java Heap Dumps (Oracle Code One 2018)
Exploring Java Heap Dumps (Oracle Code One 2018)Exploring Java Heap Dumps (Oracle Code One 2018)
Exploring Java Heap Dumps (Oracle Code One 2018)Ryan Cuprak
 
Breaking Parser Logic: Take Your Path Normalization Off and Pop 0days Out!
Breaking Parser Logic: Take Your Path Normalization Off and Pop 0days Out!Breaking Parser Logic: Take Your Path Normalization Off and Pop 0days Out!
Breaking Parser Logic: Take Your Path Normalization Off and Pop 0days Out!Priyanka Aash
 
"The OpenCV Open Source Computer Vision Library: Latest Developments," a Pres...
"The OpenCV Open Source Computer Vision Library: Latest Developments," a Pres..."The OpenCV Open Source Computer Vision Library: Latest Developments," a Pres...
"The OpenCV Open Source Computer Vision Library: Latest Developments," a Pres...Edge AI and Vision Alliance
 
Quick and Easy Development with Node.js and Couchbase Server
Quick and Easy Development with Node.js and Couchbase ServerQuick and Easy Development with Node.js and Couchbase Server
Quick and Easy Development with Node.js and Couchbase ServerNic Raboy
 
Middy.js - A powerful Node.js middleware framework for your lambdas​
Middy.js - A powerful Node.js middleware framework for your lambdas​ Middy.js - A powerful Node.js middleware framework for your lambdas​
Middy.js - A powerful Node.js middleware framework for your lambdas​ Luciano Mammino
 
owasp lithuania chapter - exploit vs anti-exploit
owasp lithuania chapter - exploit vs anti-exploitowasp lithuania chapter - exploit vs anti-exploit
owasp lithuania chapter - exploit vs anti-exploitKęstutis Meškonis
 

Similar to AOP in C# 2013 (20)

Crafting Evolvable Api Responses
Crafting Evolvable Api ResponsesCrafting Evolvable Api Responses
Crafting Evolvable Api Responses
 
Java 7 - New Features - by Mihail Stoynov and Svetlin Nakov
Java 7 - New Features - by Mihail Stoynov and Svetlin NakovJava 7 - New Features - by Mihail Stoynov and Svetlin Nakov
Java 7 - New Features - by Mihail Stoynov and Svetlin Nakov
 
Slicing, Dicing, And Linting OpenAPI
Slicing, Dicing, And Linting OpenAPISlicing, Dicing, And Linting OpenAPI
Slicing, Dicing, And Linting OpenAPI
 
Scaling Big Data Mining Infrastructure Twitter Experience
Scaling Big Data Mining Infrastructure Twitter ExperienceScaling Big Data Mining Infrastructure Twitter Experience
Scaling Big Data Mining Infrastructure Twitter Experience
 
Rapid, Scalable Web Development with MongoDB, Ming, and Python
Rapid, Scalable Web Development with MongoDB, Ming, and PythonRapid, Scalable Web Development with MongoDB, Ming, and Python
Rapid, Scalable Web Development with MongoDB, Ming, and Python
 
Swift Micro-services and AWS Technologies
Swift Micro-services and AWS TechnologiesSwift Micro-services and AWS Technologies
Swift Micro-services and AWS Technologies
 
Drilling Cyber Security Data With Apache Drill
Drilling Cyber Security Data With Apache DrillDrilling Cyber Security Data With Apache Drill
Drilling Cyber Security Data With Apache Drill
 
Writing Hadoop Jobs in Scala using Scalding
Writing Hadoop Jobs in Scala using ScaldingWriting Hadoop Jobs in Scala using Scalding
Writing Hadoop Jobs in Scala using Scalding
 
Introduction to Apache Flink - Fast and reliable big data processing
Introduction to Apache Flink - Fast and reliable big data processingIntroduction to Apache Flink - Fast and reliable big data processing
Introduction to Apache Flink - Fast and reliable big data processing
 
Cannibalising The Google App Engine
Cannibalising The  Google  App  EngineCannibalising The  Google  App  Engine
Cannibalising The Google App Engine
 
introduction to node.js
introduction to node.jsintroduction to node.js
introduction to node.js
 
Bug bites Elephant? Test-driven Quality Assurance in Big Data Application Dev...
Bug bites Elephant? Test-driven Quality Assurance in Big Data Application Dev...Bug bites Elephant? Test-driven Quality Assurance in Big Data Application Dev...
Bug bites Elephant? Test-driven Quality Assurance in Big Data Application Dev...
 
Microservices Application Tracing Standards and Simulators - Adrians at OSCON
Microservices Application Tracing Standards and Simulators - Adrians at OSCONMicroservices Application Tracing Standards and Simulators - Adrians at OSCON
Microservices Application Tracing Standards and Simulators - Adrians at OSCON
 
Hadoop: Big Data Stacks validation w/ iTest How to tame the elephant?
Hadoop:  Big Data Stacks validation w/ iTest  How to tame the elephant?Hadoop:  Big Data Stacks validation w/ iTest  How to tame the elephant?
Hadoop: Big Data Stacks validation w/ iTest How to tame the elephant?
 
Exploring Java Heap Dumps (Oracle Code One 2018)
Exploring Java Heap Dumps (Oracle Code One 2018)Exploring Java Heap Dumps (Oracle Code One 2018)
Exploring Java Heap Dumps (Oracle Code One 2018)
 
Breaking Parser Logic: Take Your Path Normalization Off and Pop 0days Out!
Breaking Parser Logic: Take Your Path Normalization Off and Pop 0days Out!Breaking Parser Logic: Take Your Path Normalization Off and Pop 0days Out!
Breaking Parser Logic: Take Your Path Normalization Off and Pop 0days Out!
 
"The OpenCV Open Source Computer Vision Library: Latest Developments," a Pres...
"The OpenCV Open Source Computer Vision Library: Latest Developments," a Pres..."The OpenCV Open Source Computer Vision Library: Latest Developments," a Pres...
"The OpenCV Open Source Computer Vision Library: Latest Developments," a Pres...
 
Quick and Easy Development with Node.js and Couchbase Server
Quick and Easy Development with Node.js and Couchbase ServerQuick and Easy Development with Node.js and Couchbase Server
Quick and Easy Development with Node.js and Couchbase Server
 
Middy.js - A powerful Node.js middleware framework for your lambdas​
Middy.js - A powerful Node.js middleware framework for your lambdas​ Middy.js - A powerful Node.js middleware framework for your lambdas​
Middy.js - A powerful Node.js middleware framework for your lambdas​
 
owasp lithuania chapter - exploit vs anti-exploit
owasp lithuania chapter - exploit vs anti-exploitowasp lithuania chapter - exploit vs anti-exploit
owasp lithuania chapter - exploit vs anti-exploit
 

Recently uploaded

Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DaySri Ambati
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 

Recently uploaded (20)

Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 

AOP in C# 2013

  • 2.
  • 3. TOPICS - What is bad and good design ? - Problem statement. - What is AOP ? - Demo
  • 4. WHAT IS BAD DESIGN ?
  • 5. WHAT IS BAD DESIGN ? -the system is rigid: it's hard to change a part of the system without affecting too many other parts of the system -the system is fragile: when making a change, unexpected parts of the system break - the system or component is immobile: it is hard to reuse it in another application because it cannot be disentangled from the current application
  • 6.
  • 7.
  • 8.
  • 9. class GarbageService { public void Transfer(int sourceID, int destinationID, int size) { Storage source = Storage.GetById(sourceID); Storage destination = Storage.GetById(destinationID); var garbage = source.GetGarbage(size); destination.PutGarbage(garbage); } }
  • 10. class GarbageService { public void Transfer(int sourceID, int destinationID, int size) { Trace.TraceInformation("Entering GarbageService.Transfer( sourceID={0},destinationID={1})", sourceID, destinationID); try { Storage source = Storage.GetById(sourceID); Storage destination = Storage.GetById(destinationID); var garbage = source.GetGarbage(size); destination.PutGarbage(garbage); } catch (Exception ex) { Trace.TraceError("Exception: GarbageService.Transfer( sourceID = {0}, destinationID = {1}) failed : {2}“, sourceID, destinationID, ex.Message); throw; } } }
  • 11. class GarbageService { public void Transfer(int sourceID, int destinationID, int size) { Trace.TraceInformation("Entering GarbageService.Transfer(sourceID = {0}, destinationID = {1})", sourceID, destinationID); if (sourceID <= 0) { throw new ArgumentOutOfRangeException("sourceID"); } if (destinationID <= 0) { throw new ArgumentOutOfRangeException("destinationID"); } if (size <= 0) { throw new ArgumentOutOfRangeException("size"); } try { Storage source = Storage.GetById(sourceID); Storage destination = Storage.GetById(destinationID); var garbage = source.GetGarbage(size); destination.PutGarbage(garbage); } catch (Exception ex) { Trace.TraceError("Exception: GarbageService.Transfer(sourceID = {0}, destinationID = {1}) failed : {2}“, sourceID, destinationID, ex.Message); throw; } } }
  • 12. REQUIREMENTS • Functional Requirements • Line-of-business • Non functional requirements • Logging • Caching • Transaction • Validation • Exception Handling • Thread Sync • GUI Binding • … and a lot more!
  • 13. WHAT IS AOP ? AOP - is a programming paradigm which aims to increase modularity by allowing the separation of cross-cutting concerns. AOP - an approach that extends OOP and addresses the issue of cross-cutting concerns: • Encapsulate cross-cutting concerns into Aspects. • Improves code reusability, modularity and separation of concerns. • Reduces defects by reducing boiler – plate code. With AOP, you still define the common functionality in one place, but you can declaratively define how and where this functionality is applied without having to modify the class to which you are applying the new feature.
  • 14. AOP • doesn’t solve any new problem • it’s just another tool in your toolbox • the main goal is nice separation of concerns • a decrease in development costs and software delivery time; • an increase in application maintainability. • reduce noise in source == more clean model
  • 15. AOP TERMINOLOGY • Join Point • place where behavior can be added • Advice • code that can be injected at join points • Point Cut • join points where advices should be applied
  • 16.
  • 17.
  • 18.
  • 19.
  • 20. AOP WEAVING • Compile time weaving • Source-Level Weaving • Modifying the MSIL code • Run-Time weaving • Dynamic Proxy
  • 21. PostSharp is the most comprehensive aspect-oriented framework for .NET Gael Fraiteur
  • 22. Demo
  • 23.
  • 25. Comparing Aspect Frameworks STATIC VS DYNAMIC AOP Spring.NET PostSharp LinFu Castle MS Unity/PIAB Build-Time: Hybrid Run-Time: Very Expressive Less Expressive Robust Model Brittle Model Not Invasive Invasive Static Dynamic
  • 26. Comparing Aspect Frameworks EXPRESSIVENESS What can you do with the framework? Spring.NET PostSharp Linfu Unity/PIAB Castle Method Interception Yes Yes Yes Yes Private/Sealed Yes Yes Member Interception Event Interception Yes Member Introduction Yes
  • 27.