NCSoft China PD Dept. training - Session 4 -- Lance Zhang

Slides:



Advertisements
Similar presentations
Jim McKeeth | Podcast at Delphi.org
Advertisements

Tridion 5.3 Templates.
Introduction to .NET Framework
Apache Struts Technology
Aspect Oriented Programming. AOP Contents 1 Overview 2 Terminology 3 The Problem 4 The Solution 4 Join point models 5 Implementation 6 Terminology Review.
©Ian Sommerville 2006Software Engineering, 8th edition. Chapter 32 Slide 1 Aspect-oriented Software Development.
Aspect-Oriented Programming using Phoenix Marc Eaddy MSR Intern Columbia University.
Fast Track to ColdFusion 9. Getting Started with ColdFusion Understanding Dynamic Web Pages ColdFusion Benchmark Introducing the ColdFusion Language Introducing.
Kashif Jalal CA-240 (072) Web Development Using ASP.NET CA – 240 Kashif Jalal Welcome to week – 2 of…
Software Factory Assembling Applications with Models, Patterns, Frameworks and Tools Anna Liu Senior Architect Advisor Microsoft Australia.
Spring.Net Steinar Dragsnes steinar.dragsnes at viz.no.
Review David Rabinowitz. March 3rd, 2004 Object Oriented Design Course 2 Review What have we done during the course? Which topics we have not discussed?
Peoplesoft: Building and Consuming Web Services
Lecture 2 - Struts ENTERPRISE JAVA. 2 Contents  Servlet Deployment  Servlet Filters  Model View Controllers  Struts  Dependency Injection.
A Free sample background from © 2001 By Default!Slide 1.NET Overview BY: Pinkesh Desai.
Introduction to the Enterprise Library. Sounds familiar? Writing a component to encapsulate data access Building a component that allows you to log errors.
1 INTRO TO BUSINESS COMPONENTS FOR JAVA (BC4J) Matt Fierst Computer Resource Team OracleWorld Session
1 Introduction to.NET Framework. 2.NETFramework Internet COM+ Orchestration Orchestration Windows.NET Enterprise ServersBuildingBlockServices Visual Studio.NET.
Spring Overview, Application demo -Midhila Paineni 09/23/2011 Spring Overview, Application demo9/8/20151.
An Introduction to ASP.NET Ed Dunhill blogs.msdn.com/edunhill SLIDE7.
Introduction to AOP.
RIA Services Master Class Presenter: Kevin Grossnicklaus November 30 th, 2010.
Overview of Previous Lesson(s) Over View  ASP.NET Pages  Modular in nature and divided into the core sections  Page directives  Code Section  Page.
.NET Framework & C#.
Zhonghua Qu and Ovidiu Daescu December 24, 2009 University of Texas at Dallas.
Introduction to Aspect Oriented Programming Presented By: Kotaiah Choudary. Ravipati M.Tech IInd Year. School of Info. Tech.
Aspect Oriented Programming (AOP) in.NET Brent Krueger 12/20/13.
Spring core v3.x Prepared by: Nhan Le. History v3.0 Spring Expression Language Java based bean metadata v3.1 Cache Abstraction Bean Definition Profile.
.NET Framework Danish Sami UG Lead.NetFoundry
Copyright © 2005 Finetix LLC All Rights Reserved 0 SpringFramework.Net Developer Session Chris Donnan The Peer Frameworks Series -.Net and Java.
Composing Adaptive Software Authors Philip K. McKinley, Seyed Masoud Sadjadi, Eric P. Kasten, Betty H.C. Cheng Presented by Ana Rodriguez June 21, 2006.
©Ian Sommerville 2006Software Engineering, 8th edition. Chapter 32 Slide 1 Aspect-oriented Software Development 1.
Sander Hoogendoorn Principal Technology Officer Capgemini The Netherlands SESSION CODE: ARC303.
Aspect-Oriented Refactoring of the Apache Cocoon Shared-Object Resource Allocation System Jeff Dalton February 28th, 2003 Advisor: David G. Hannay Client:
Inversion Of Control & Dependency Injection Break Apart The Dependencies Oren Eini Senior Developer We! Consulting Group
Methodology: The AOP Refactoring Process Aspect-Oriented Refactoring of the Apache Cocoon Shared-Object Resource Allocation System Jeff Dalton Advisor:
AOP-1 Aspect Oriented Programming. AOP-2 Aspects of AOP and Related Tools Limitation of OO Separation of Concerns Aspect Oriented programming AspectJ.
CCC: An Aspect-Oriented Intermediate Language on.Net Platform Yingfei Xiong and Feng Wan University of Electronic Science and Technology of China, China.
Copyright 2007 SpringSource. Copying, publishing or distributing without express written permission is prohibited. Introduction to Spring Remoting Simplifying.
Distribution and components. 2 What is the problem? Enterprise computing is Large scale & complex: It supports large scale and complex organisations Spanning.
Object Oriented Software Development
INTEGRATION OF BACKBONE.JS WITH SPRING 3.1. Agenda New Features and Enhancements in Spring 3.1 What is Backbone.js and why I should use it Spring 3.1.
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University IWPSE 2003 Program.
© FPT SOFTWARE – TRAINING MATERIAL – Internal use 04e-BM/NS/HDCV/FSOFT v2/3 JSP Application Models.
Kansas City Java User’s Group Jason W. Bedell July 12, 2006
问题 Code scattering Blocks of duplicated code Blocks of complementary code, and different modules implementing complementary parts of the concern Code.
Introduction to Yan Cui Aspect Oriented Programming by
Building Custom Controls with ASP.NET and the Microsoft ®.NET Framework Rames Gantanant Microsoft Regional Director, Thailand
Aspect-Oriented Software Development (AOSD)
Singleton Academy, Pune. Course syllabus Singleton Academy Pune – Course Syllabus1.
L’origine dei mali: le dipendenze tra componenti Stefano Leli 14° Workshop DotNetMarche Venerdì 16 aprile
Text 16 de mayo de 2009 Spring Framework Part III. Portable Service Abstractions and Spring MVC Buenos Aires, June 2009.
Intro to MVC5 Bryan Soltis Bit-Wizards - Director of Technology & Research.
Audit API : Hints and Tricks Mehdi BELMEKKI, Consultancy Team Alfresco.
Understanding Dependency Injection… and those pesky containers Miguel A. Castro Architect -
Enterprise Library 3.0 Memi Lavi Solution Architect Microsoft Consulting Services Guy Burstein Senior Consultant Advantech – Microsoft Division.
Leveraging ColdSpring to build a robust Flex applications Chris Scott, Cynergy Systems.
Aspect-oriented programming
Chengyu Sun California State University, Los Angeles
Fody code weaving made fun.
Magento Technical Guidelines Eugene Shakhsuvarov, Software Magento
Creating and Using Classes
Chengyu Sun California State University, Los Angeles
AOP in .NET Business Rules + Plumbing = Enterprise Software
JAsCo an Aspect-Oriented approach tailored for
Aspect-oriented programming
CS520 Web Programming Spring – Aspect Oriented Programming
Leveraging ColdSpring To Make Better Applications
Aspect Oriented Programming
Presentation transcript:

NCSoft China PD Dept. training - Session 4 -- Lance Zhang

Topics What is AOP Existing AOP Frameworks in.NET Introduce PostSharp How does PostSharp work How to use PostSharp Q & A

Suppose We have a System… It Grows… Code Smells similar… Now We've Got A Problem(Ctrl + C/V)… So We Concerns…

Application Concerns Functional Requirements Line-of-business. Non-Functional Concerns Logging Caching Transaction Security Validation Persistence …

Aspects - Reduce noise in source Move plumbing out of source, but keep behaviour the same AOP … doesn’t solve any new problems. is just too complex. adoption is all or nothing. Promotes sloppy design. Aspects … obscure program flow. can’t be unit tested. Debugging with Aspects is hard.

Aspects Lingo Advice The duplicated plumbing code we are removing Typically under 30 lines of code Behaviour that is injected at a join point Join points Places within the code where the Aspect is inserted Examples Entry/Exit of a method or property Class’s Type Definition

Aspects Lingo Point cut Locates Join Points to apply advice Filter driven – Automatic injection Find all Methods, of type Setter, in all classes where Namespace equals “Application.Entities” Attribute driven – Manual injection

Aspects Lingo Weaving Process of injecting functionality back into a component Can be performed by Text post processor – Magic comments can replaced by code Proxy container – Uses decorator pattern/hooks to allow code to be inserted Binary manipulation - Modifying assemblies - by replacing and injecting IL code

Existing AOP Frameworks in.NET AOP with Castle Windsor Dynamic Proxy Dynamic Proxy does the heavy-lifting of the IL generation for us Much easier for most requirements AOP with Spring.NET Can use something other than attributes such as XML configuration. Sorry, but actually I am unfamiliar with them…

AOP with PostSharp Compile-time MSIL Injection - by MSBuild Task Easy to use - like normal Attribute Intercept any method - not only Virtual More Join points - on: field access, exception More controllability - break, change param or return More transparent - no need “new proxy()” Multicasting Custom Attributes - filter  Code quality after injection  Complexity of Debug

That's Great, But I Need Some Code. Originally we write plumbing inline. Then we refector by PostSharp.

Okay, Where Is The Plumbing Code? Attribute for Exception handling Attribute for CachingSharp.

How Do We Go From Attributes To Aspects? We can look at an assembly compiled with PostSharp attributes enabled and disabled to see what happened.

Assembly Before/After Injection Before Injection Atfer Injection

How Can I Implement PostSharp? PostSharp.Laos.dll Handles most every type of AOP use, it’s the root namespace for all the demo code we’ll look at. Can use commercially, custom non-viral licensing. Implemented as a plugin built on the PostSharp.Core framework. PostSharp.Public.dll Support library for PostSharp. PostSharp.AspNet.dll Only if you are in an ASP.NET project.

When Can PostSharp Insert Code? PostSharp.Laos.OnMethodBoundaryAspect OnEntry OnExit OnSuccess OnException PostSharp.Laos.OnMethodInvocationAspect OnInvocation PostSharp.Laos.OnExceptionAspect OnException PostSharp.Laos.OnFieldAccessAspect OnGetValue OnSetValue

Other Aspects PostSharp.Laos.ImplementMethodAspect Replace a method’s content with the advice in the aspect Useful for modifying 3 rd party components PostSharp.Laos.CompositionAspect Allows an interface/state to be injected into a component Used to simulate multiple inheritance Examples include Adding.NET Win Form data binding to a POCO Adding Entity Framework interfaces to a POCO

References PostSharp - David Ross Introduction to AOP with PostSharp - Michael D. Hall What Is PostSharp? - Using AOP and PostSharp to Enhance Your Code: Part A - Doron's.NET Space PostSharp - Lightweight Aspect-Oriented System -

Learn more e/