AOP-IOC made by Vi Quoc Hanh and Vu Cong Thanh in SC Team
Upcoming SlideShare
Loading in...5
×
 

AOP-IOC made by Vi Quoc Hanh and Vu Cong Thanh in SC Team

on

  • 749 views

This presentation made by Vi Quoc Hanh and Vu Cong Thanh in SC Team from eXo Platform SEA.

This presentation made by Vi Quoc Hanh and Vu Cong Thanh in SC Team from eXo Platform SEA.

Statistics

Views

Total Views
749
Views on SlideShare
725
Embed Views
24

Actions

Likes
0
Downloads
11
Comments
0

4 Embeds 24

http://localhost 11
http://plfent-4.0.x-snapshot.acceptance3.exoplatform.org 8
http://plfent-4.0.0-plf-relooking-snapshot.acceptance.exoplatform.org 4
http://int.exoplatform.org 1

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

AOP-IOC made by Vi Quoc Hanh and Vu Cong Thanh in SC Team AOP-IOC made by Vi Quoc Hanh and Vu Cong Thanh in SC Team Presentation Transcript

  • IoC & AOP Vu Cong Thanh Vi Quoc Hanh Social team
  • Agenda
    • IoC - Introduction
    • IoC – Definition & Benefits
    • IoC – Concepts
    • IoC – Design your own IoC.
    • Demo
    • AOP - Introduction
    • AOP - Definition & Benefits
    • AOP - Concepts
    • AOP - How it works?
    • Demo
  • Inversion Of Control (IoC)
  • IoC – Introduction - “Dependencies”
  • IoC – Introduction – Dependency Problems
    • Code is tightly coupled
    • Difficult to isolate when testing
    • Difficult to maintain .
  • IoC – Introduction - WITHOUT IoC
    • Construction by Hand.
    • Factory Pattern.
  • IoC – Definition & Benefits
    • Hollywood principle “Don't call us, we'll call you.”
    • Creating , Assembling and Wiring the dependencies into Object graph.
    • Type of Dependency Injector:
      • Constructor
      • Setter
      • Method
      • Field(Guice)
  • IoC – Definition & Benefits
    • Pros:
      • Loosely Coupled
      • Increases Tesability
      • Separates component clearly.
      • Allows for use of Inversion of Control Container.
    • Cons:
      • Increases code complexity
      • Difficult to understand at First
      • Complicate Debugging at First
      • Complicates following Code Flow.
  • IoC – Concepts – Time launcher
    • Constructed and prepared before it can be used.
      • In the init lifecycle stage of a web application.
      • On startup of a desktop program
  • IoC – Concepts– Time launcher
    • Constructed and prepared before it can be used.
      • On demand , every time it is needed
      • Lazily , when it is first needed
  • IoC – Concepts – Metadata Configuration
    • XML configuration file.
    • Annotations(@Injector, @Singleton, …)
    • Invoking into a programmatic API.
  • IoC – Concepts - Scope
    • Fixed duration of time or method calls in which an object exist. General-purpose scopes: Singleton and No-scope .
    • Web Application:
      • Request , Session and Conversation scope
      • Transaction scope
  • IoC - Concepts - Benefit of Scope
    • Lets injector manage the latent state of your objects
    • Ensures that your services get new instances of dependencies as needed
    • Implicitly separates state by context.
  • Design your own IoC Source Code: Guice: google-guice.googlecode.com/svn/trunk/ Vbox: https://github.com/thanhvc/etk-vbox
  • Design your own IoC – Injector Diagram
  • Design your own IoC – Context Diagram
  • Design your own IoC – State Diagram Start Constructing Finish States: Constructing, Start and Finish http://www.slideshare.net/Thuy_Dang/regular-expression-made-by-to-minh-hoang-portal-team
  • Design your own IoC – State Diagram(Cont)
  • DEMO
  • Aspect Oriented Programming (AOP)
  • Agenda
    • What is IOC?
    • IOC – Time of Injector
    • IOC – Pros & Cons
    • IOC - Scope
    • Demo
    • AOP - Introduction
    • AOP - Definition & Benefits
    • AOP - Concepts
    • AOP - How it works?
    • Demo
  • INTRODUCTION - OOP
    • A set of objects that interact with each other
  • INTRODUCTION - AOP
    • View the system as a set of concerns
  • INTRODUCTION – CONCERNS
    • A particular role , concept or area of interest
  • INTRODUCTION - CROSSCUTTING
  • INTRODUCTION - CROSSCUTTING CONCERNS
    • System level requirements that crosscut many core module level requirements
  • INTRODUCTION – CROSSCUTTING CONCERNS PROBLEMS
    • Code tangling , Code scattering , Less code reuse, More difficult evolution...
    • Face problem in design when requirements growth
  • AOP - DEFINITION
    • Lets you implement individual concerns in a loosely coupled way and combine these implementations to form the final system.
    • Complements object oriented programming.
    • Is not about “patching” pieces of code. About performing an action systematically upon recognition of a behavior in the code. behavior in the code.
  • AOP - BENEFITS
    • Modularized implementation of crosscutting concerns behavior in the code.
    • Easier-to-evolve systems - extensibility behavior in the code.
  • AOP - BENEFITS
    • Late binding of design decision behavior in the code.
    • More code reuse
  • AOP - CONCEPTS
    • Aspect: The merger of advice and pointcuts . All information about where , when and what job is to be done.
    • Advice: The job of an aspect. Defines what and when of an aspect.
    • Pointcut: Pointcuts help narrow down the joinpoints advised by an aspect. Define the where of an aspect.
    • Jointpoint: A point in the execution of an application where an aspect can be plugged in. All the opportunities for advice to be applied. behavior in the code.
  • AOP - CONCEPTS
    • Target: Object being advised.
    • Proxy: The object created after applying advice to the target object.
    • Weaving: Process of applying aspects to a target object to created a new proxied object code.
  • AOP – HOW IT WORKS
    • Decorator Pattern
    • Proxy Pattern Control access to an object
    • Allows for object level access control by acting as a pass through entity or a placeholder object. co
    • d
    • .
  • AOP – HOW IT WORKS
  • AOP – BEHIND THE SCENCES Aspect Object_B Object_A advice Object Oriented Flow Aspect Oriented Flow pointcut = method_B Target Object = Object_B Weaving jointpoint = method invocation Object Oriented Flow
  • AOP – ENGINES & FRAMEWORKS
    • JDK
    • CGLIB really create new class through bytecode manipulation code.
    • ASPECTJ
    • JBOSS AOP
    • SPRING FRAMEWORK c
    • … ........ ode.
    Engines Frameworks (Java)
  • AOP vs OOP - CONCLUSION Object Oriented Aspect Oriented Class – code unit that encapsulates methods and attributes. Aspect – code unit that encapsulates pointcuts, advice, and attributes. Method signatures – define the entry points for the execution of method bodies. Pointcut – define the set of entry points (triggers) in which advice is executed. Method bodies – implementations of the primary concerns. Advice – implementations of the cross cutting concerns. Compiler – converts source code into object code. Weaver – instruments code (source or object) with advice.
  • DEMO
  • Thank you!