Blog Stats
  • Posts - 99
  • Articles - 5
  • Comments - 43
  • Trackbacks - 108

 

AOP Presentation Mar 27th

I will be giving an AOP presentation to the Atlanta .NET user group the 27th at the Microsoft offices in Alpharetta http://www.atlantadotnet.org/. The following is a description of the presentation.

Joe Engineer has been following established concepts for quite some time, he uses TDD, refactors his code often, and even uses design patterns to help reduce coupling within his code. One day in looking at his code Joe came accross the following code ...
 
public class Customer : MyObjectBase, ISavableObject, IDeletableObject {
     private string m_FirstName;
     private string m_LastName;

     public string FirstName {
          get { return m_FirstName; }
          set { m_FirstName = value; RegisterDirty(this);}
     }
 
     public string LastName {
          get { return m_LastName; }
          set { m_LastName = value; RegisterDirty(this);}
     }
 
     public void Save() {
          MyORMapper.Save(this);
     }
 
     public void Delete() {
          MyORMapper.Delete(this);
     }
}
 
He gives a quick smirk, looks pretty good seems very well factorred ... then he flips over to his order class.
 
public class Order : MyObjectBase, ISavableObject, IDeletableObject {
     private DateTime m_Date;
     private string m_LastName;

     public string Date{
          get { return m_Date; }
          set { m_Date = value; RegisterDirty(this);}
     }
 
     public void Save() {
          MyORMapper.Save(this);
     }
 
     public void Delete() {
          MyORMapper.Delete(this);
     }
}
 
Joe flips back and forth between these classes for about ten minutes, then he starts flipping to the rest of the domain's classes which look oddly similar. "Something ... smells ... There must be some way to refactor this!" ... Joe the loyal XP'er runs to the kitchen to get some snacks to attract team members to come assist him with his quandry.
 
"Where have we gone wrong? In looking at the customer class I thought it was very well factorred but when I look at the customer in conjuction with the order I start to smell alot of funny things".
 
"It seems that we have these little one liners sprinkled through out our entire model, what happens if we need to change how the delete, save or registerdirty works? We have hundreds if not thousands of places doing this; we seem to have fallen prey to copy/paste re-use!"
 
This presentation includes snacks and is a continuation of Joe's discussion with the team which leads participants through a discovery based learning experience ending up with Aspect Oriented Programming.

Feedback

# re: AOP Presentation Mar 27th

Gravatar Are your past presentations currently posted somewhere that I can access them?

I would definetely be interested in the AOP presentation if you can tape it.

I guess the manager methodology is not too bad. As our software grows our domain object increases, and there is usually a manager per domain object. Whenever a new manager gets created, DRY principle always comes to mind.

Applying Domain-Driven Design and Patterns sounds like an interesting book, I will definetely check it out. Thanks for the recommendation. 3/22/2006 4:30 PM | Aaron Feng

# re: AOP Presentation Mar 27th

Gravatar here is the Power Point from a more nuts and bolts AOP one (focuses on the dynamic proxy portion and how it works) http://www.atlantacsharp.org/presentations/AOP.ppt

3/22/2006 4:40 PM | Greg Young

Post a comment





 

Please add 7 and 8 and type the answer here:

 

 

Copyright © Greg Young