yan cui n.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
Aspect-oriented programming PowerPoint Presentation
Download Presentation
Aspect-oriented programming

Loading in 2 Seconds...

play fullscreen
1 / 53

Aspect-oriented programming - PowerPoint PPT Presentation


  • 87 Views
  • Uploaded on

Yan Cui. Aspect-oriented programming. Server-side Developer @. “Our mission is to build fun games and game apps that people can play, anywhere, anytime.”. 400k DAU 100m requests/day. Overview Cross-Cutting Concerns AOP What’s in it for you AOP Terminologies AOP and OOP Solutions Q&A.

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'Aspect-oriented programming' - iram


Download Now An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
slide2

Server-side Developer @

“Our mission is to build fun games and game apps that people can play, anywhere, anytime.”

400k DAU

100m requests/day

slide3

Overview

    • Cross-Cutting Concerns
    • AOP
    • What’s in it for you
  • AOP
    • Terminologies
    • AOP and OOP
    • Solutions
  • Q&A
slide5

Cross-Cutting Concerns

Image by Mike Rohde

slide6

Function

Requirements

Non-Functional

Requirements

Production

Code

+

=

slide7

Cuts across multiple abstractions

  • Difficult to decompose
  • High-coupling
  • Boilerplate code
slide8

Code tangling and scattering

    • Poor traceability
    • Lower productivity
    • Less code reuse
    • Harder refactoring
slide10

“AOP is a programming paradigm which aims to increase modularity by allowing the separation of cross-cutting concerns”

- wikipedia

slide11

Coding is HARD

AOP makes it EASY

slide12

AOP

AOP

AOP

AOP

AOP

AOP

AOP

slide15

Centralize concerns implementation

  • Intercept method calls
  • Inject new behaviour
  • More reusable code
  • Cleaner code
slide17

Write less code

  • Read less code
  • More concise and easy to understand
  • More maintainable
slide18

Fewer code =

  • Less boilerplate code
  • More interesting work
  • Increased attention
  • More PRODUCTIVITY!

FEWER DEFECTS!

slide20

Join Point

    • Place where behaviour can be added
  • Advice
    • Code that can be injected at join points
  • Point cut
    • Join points where advice should be applied
  • Aspect
    • Container holding point cuts and advice
  • Weaving
    • Combines advices with point cuts
slide21

AOP is complementary to OOP

  • AOP targets a specific problem
  • Code modularization
    • OOP – Real world objects
    • AOP – Functionalities
slide22

Help you S.O.L.I.Dify your code

    • Single responsibility
    • Open/close
slide23

You can do AOP via:

    • Dynamic Proxies
    • Functional Programming
    • Code Generation
    • Dynamic Languages
    • Static Weaving
slide28

Advantages

    • Can use existing DI framework
    • Some frameworks provides built-in aspects
    • Aspects can be configured after build
slide29

Disadvantages

    • Significant change to base code required to adapt
    • Limited AOP features
    • Do not work on static, non-public methods
    • Do not work on fields, properties, or events
    • Higher run-time overhead
    • No build-time verification
    • Objects must be instantiated using the container
slide30

NOOOO Sir!!

Class, is AOP the same as Dependency Injection?

slide34

Advantages

    • No external dependencies
slide35

Disadvantages

    • Requires modification to every function
    • No support for matching rules
    • Manual aspect composition
slide38

Advantages

    • Easy to generate complex source code
slide39

Disadvantages

    • Input is usually XML
    • Cannot inject new behaviour to existing code
slide42

Advantages

    • Meta-programming is easy
slide43

Disadvantages

    • Switching to a dynamic language can be scary
    • No (limited) Visual Studio tooling
slide45

PostSharp, AspectJ

  • Uses low-level MSIL transformation
  • Compile time
slide46

Requirements

Aspect Decomposition

Aspects

Core program

Aspect Recomposition

Final System

slide47

Aspectual Decomposition

    • Identify primary and cross-cutting concerns
  • Concern Implementation
    • Implement concerns separately
    • Primary concern as Core Component using OO
    • Cross-cutting concerns as aspect
  • Aspectual Recomposition
    • Aspect weaver to weave the separately implemented code into a final system
slide49

Advantages

    • Most complete support of AOP features
    • Aspect usage is verified at build time
    • Better runtime performance
slide50

Disadvantages

    • Increased build time
    • New to many developers
slide51

PostSharp Training

@ SkillsMatter, London

January 19-20, 2012

http://www.sharpcrafters.com/training

slide52

Thank You!

Yan Cui

@theburningmonk

jobs@iwi.com