advertisement
Premier Club Log In/Registration
  Include Code  Search Tips
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   SKILLBUILDING  |   TIP BANK  |   SOURCEBANK  |   FORUMS  |   NEWSLETTERS
Browse DevX
Partners & Affiliates
advertisement
advertisement
advertisement
Average Rating: 5/5 | Rate this item | 4 users have rated this item.
Email this articleEmail this article
 
Explore Model Driven Architecture and Aspect-oriented Programming, Birds of a Feather
In recent years, two new trends in software engineering have been established—Aspect-oriented Programming (AOP) was developed to extend and ease programming, and the Model Driven Architecture (MDA) was introduced to take full advantage of the power of modeling. Many people are confused when confronted with both AOP and MDA. This article provides a crash-course on both topics and explains the differences and similarities between the two.  

 
advertisement
lthough AOP and MDA were developed from very different viewpoints: programming vs. modeling; weaving many inputs into one output vs. creating many outputs from one input, there is a great deal of common ground between them and both techniques are used for identical purposes. There is no need to choose between them. They complement each other and can be used together successfully.

One very positive aspect of both AOP and MDA is that they have brought our attention back to issues like modularization and abstraction; issues that were considered to be very important in the 1980s, but slipped away in the 1990s. You should not forget that the attention to these issues was very fruitful—it was the driving force behind the advent of object-oriented programming and object-oriented modeling, and as such, has brought us the UML. It will be very interesting to see what it will bring us in the 21st century. It may be called MDA, AOP, or it may have a completely different name, but it will no doubt be an important step forward for the industry.

Aspect-oriented Programming
The key to AOP is modularization. Each program contains aspects that are not specific for that application domain. For instance, the way error handling, logging, or tracing is handled is often identical over multiple domains. AOP tells us that these aspects should be contained in different modules, and indeed aspect is the name used for such a module. The modules that contain the application-specific code and the non-specific aspect module, or modules, are then woven together to create the application. (See Figure 1.)

Figure 1. Aspect Weaving: Application code and aspects are woven together to get the finished product in AOP.
The application-specific code and the aspects can be developed independently. The application-specific code need not know what aspects will be added, leaving the developer to concentrate on implementing the required functionality—the business logic. Likewise, the author of the aspects does not need to know the application-specific code. The only knowledge necessary for writing aspects would be the join points. Join points are identifiable events in the execution of a program. The developer of a logging aspect, for instance, would have to know about method calls and the aspect would specify that whenever a method is called, a message would be added to the log.

Join points can be identified by the aspect using pointcut expressions. Pointcut expressions specify join points, much as classes specify object instances. In the example below, the pointcut publicMethods is defined to include all methods of any class in the package org.apache.cactus or any of its subpackages. Before execution of such a method the Logger.entry() method is called, and after execution a call to the Logger.exit() method is placed.
 public aspect AutoLog{
    pointcut publicMethods() :
            execution(public * org.apache.cactus..*(..));
    before() : publicMethods(){
        Logger.entry(thisJoinPoint.getSignature().toString());
    }
    after() : publicMethods(){
        Logger.exit(thisJoinPoint.getSignature().toString());
    }
} 
Another term you need is advice, this is the set of statements that should be executed whenever a join point occurs. In the AutoLog example above, there are two advices: the before and after advice. The last term that you should be familiar with is crosscutting concerns. This is behavior that cuts across the typical divisions of responsibility, such as logging. Aspects are most-often used to define such crosscutting concerns.

There are different forms of AOP. The Java-based AspectJ is probably the best-known aspect-oriented language. Other well-known examples are Spring AOP and AspectC++. See AOSD.net for more tools and aspect-oriented languages.

In short, AOP takes two or more disjointed parts of an application and weaves them together to produce the final result. The link between the parts is formed by join points, which are specified by pointcuts. Aspects are commonly used for logging, tracing, debugging, and profiling, or performance monitoring or testing of diagnostic systems, and to display updated notifications, mainly security, context passing, and error handling.

  Next Page: Model Driven Architecture
Page 1: Aspect-oriented ProgrammingPage 3: Bringing AOP and MDA Together
Page 2: Model Driven Architecture 
advertisement
Advertising Info  |   Member Services  |   Permissions  |   Contact Us  |   Help  |   Feedback  |   Site Map  |   Network Map  |   About


JupiterOnlineMedia

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info


Legal Notices, Licensing, Reprints, & Permissions, Privacy Policy.

Advertise | Newsletters | Tech Jobs | Shopping | E-mail Offers

Solutions
Whitepapers and eBooks
IBM Whitepaper: Innovative Collaboration to Advance Your Business
Internet.com eBook: Real Life Rails
Avaya Article: Call Control XML - Powerful, Standards-Based Call Control
Internet.com eBook: The Pros and Cons of Outsourcing
Go Parallel Article: Scalable Parallelism with Intel(R) Threading Building Blocks
Internet.com eBook: Best Practices for Developing a Web Site
IBM CXO Whitepaper: The 2008 Global CEO Study "The Enterprise of the Future"
Avaya Article: Call Control XML in Action - A CCXML Auto Attendant
Go Parallel Article: James Reinders on the Intel Parallel Studio Beta Program
IBM CXO Whitepaper: Unlocking the DNA of the Adaptable Workforce--The Global Human Capital Study 2008
Adobe Acrobat Connect Pro: Web Conferencing and eLearning Whitepapers
Go Parallel Article: Getting Started with TBB on Windows
HP eBook: Storage Networking , Part 1
MORE WHITEPAPERS, EBOOKS, AND ARTICLES
Webcasts
Go Parallel Video: Intel(R) Threading Building Blocks: A New Method for Threading in C++
HP Video: Is Your Data Center Ready for a Real World Disaster?
Microsoft Partner Portal Video: Microsoft Gold Certified Partners Build Successful Practices
HP On Demand Webcast: Virtualization in Action
Go Parallel Video: Performance and Threading Tools for Game Developers
Rackspace Hosting Center: Customer Videos
Intel vPro Developer Virtual Bootcamp
HP Disaster-Proof Solutions eSeminar
HP On Demand Webcast: Discover the Benefits of Virtualization
MORE WEBCASTS, PODCASTS, AND VIDEOS
Downloads and eKits
Microsoft Download: Silverlight 2 Software Development Kit Beta 2
30-Day Trial: SPAMfighter Exchange Module
Red Gate Download: SQL Toolbelt
Iron Speed Designer Application Generator
Microsoft Download: Silverlight 2 Beta 2 Runtime
MORE DOWNLOADS, EKITS, AND FREE TRIALS
Tutorials and Demos
IBM IT Innovation Article: Green Servers Provide a Competitive Advantage
Microsoft Article: Expression Web 2 for PHP Developers--Simplify Your PHP Applications
Featured Algorithm: Intel Threading Building Blocks - parallel_reduce
MORE TUTORIALS, DEMOS AND STEP-BY-STEP GUIDES