Domain-specific languages offer the benefits of specialized language constructs for undertaking work in a particular problem domain. We've looked at examples such as Jython for scripting and the rule-based language Jess for defining business logic. This chapter focuses on the use of aspect-oriented programming (AOP), a programming paradigm that offers the ability to effect rapid change across a system's entire code base with surgical precision.
The AOP paradigm brings an extra dimension to the design activity, making it possible to produce highly maintainable and extensible systems. Moreover, AOP introduces a dynamic element to the static nature of conventional software architecture, enabling the swift evolution of applications to accommodate emerging business concerns.
In the last few years, AOP has started to make its way into mainstream development, with J2EE vendors finding AOP ideally suited to the development of enterprise software. A new concept has been born, aspect-oriented middleware, and application server designers are rushing to adopt the lightweight, dynamic model AOP brings to the middle tier. Consequently, J2EE is on the cusp of a completely new approach to developing enterprise software.
This chapter introduces the major concepts of AOP and introduces two popular open source AOP products: AspectJ and AspectWerkz. AspectJ extends the Java language to include AOP constructs, while AspectWerkz adopts a framework-based approach. This chapter examines the merits of both approaches to implementing AOP and looks at how AOP languages and frameworks can complement the services offered by the J2EE platform.
The chapter concludes with some low-risk options for adopting AOP as part of your development toolkit.
First, we cover just why the world needs yet another programming paradigm.