| By Jinsong Yang | Article Rating: |
|
| October 24, 2006 02:00 PM EDT | Reads: |
15,594 |
Because all calls are made through the proxy object, the proxy can intercept the calls, wrapping the business methods with cross-cutting concerns. Listings 5, 6, 7, 8, and 9 show a simplified version of these classes. Note that MaterialDAO is just an example of many DAOs.
Note that with this design, the DAOs aren't completely POJOs: Each DAO has to provide an interface and extend the AbstractDAO super-class. The clients are also aware of the concrete implementation class. With this solution, however, we're trying to land somewhere between the pain of living with scattered code and the burden of implementing a complete AOP framework.
Conclusion
In this article, I've just covered a small number of the design issues in our project. It's an even smaller part compared to the real world of software design. The idea is to present our way of thinking of design. We believe this kind of thinking will definitely familiarize the team with IoC and AOP concepts and prepare it for next step forward.
Sidebar
The Open Close Principle
In the OO world, there's this design principle called the Open Close Principle. It says that software should be designed so it's open to extension and closed to modification. Set aside its fancy name, it basically suggests that software should be extensible function-wise (i.e., open to extension) without having to open up existing code and modify it (i.e., closed to modification). Functional extension should be done by creating new modules and plugging them into the existing system.
The consequence is beneficial. After all, you don't want to modify your well-tested code and risk your code to new bugs, which can result in "wreck-a-mole"-style bug fixing (fixing one bug introduces more).
2nd Sidebar
Inversion Of Control
Inversion of Control (IoC), also referred as Dependency Injection (DI), is a powerful pattern that can be applied in software design to reduce coupling between components. It's a key feature in lots of lightweight containers, which help assemble components from different sources into a cohesive application.
IoC comes in three flavors - type 1, type 2, and type 3 IoCs; however, they're more often referred to by their more descriptive names: interface inject, setter injection, and constructor injection, respectively.
Nowadays many IoC container products exist such as Spring and PicoContainer.
3rd Sidebar
The Abstract Factory Pattern
The intent of the Abstract Factory Pattern is to provide an interface for creating families of related or dependent objects without specifying their concrete classes. The benefits of this pattern are that it isolates clients from concrete implementation classes, makes exchanging product families easy, and enforces the use of products from only one family.
4th Sidebar
Aspect-Oriented Programming
Aspect-Oriented Programming (AOP) attempts to aid programmers in the separation of concerns, specifically cross-cutting concerns, as an advance in modularization. The idea is to encapsulate concerns into separate features and minimize their functional overlaps as much as possible.
Compared to procedural programming, OOP methodologies take a significant step towards separation of concerns.But there are concerns when OOP fails to separate, one of which is a concern that cuts across many modules of an application (hence the name cross-cutting concerns).
The following definitions are based on Wikipedia (www.wikipedia.org/).
Advice: describes a certain function, method, or procedure that is to be applied at a given join point of a program.
Join point: a point in the flow of a program.
Pointcut: a set of join points. Whenever the program execution reaches one of the join points described in the pointcut, the advice associated with the pointcut is executed.
Java is full of frameworks, AOP included: : AspectJ, Spring, JBossAOP, etc.
Published October 24, 2006 Reads 15,594
Copyright © 2006 SYS-CON Media, Inc. — All Rights Reserved.
Syndicated stories and blog feeds, all rights reserved by the author.
More Stories By Jinsong Yang
Jinsong Yang is a senior application engineer at Warnerbros. Advanced Digital Services, and is a Sun Certified Enterprise Architect. He has devoted the last six-plus years to designing and integrating large-scale Java EE applications. He holds an MS in computer science from UCLA.
- Kindle 2 vs Nook
- Why IBM’s Server Chief Got Busted
- Is Cloud Computing Like Teenage Sex?
- Industry Experts Discuss the State of Cloud Computing
- Performance Tuning Essentials for Java
- Confessions of a Ulitzer Addict
- Tactical Cloud Computing Panel at 1st Annual GovIT Expo
- It's the Java vs. C++ Shootout Revisited!
- Cloud Computing Can Revitalize Your Career as Software Developer
- IBM Could "Reinvent" Java: Mills
- Oracle & Cloud Computing: Exclusive Q&A with SVP Richard Sarwal
- A Brief History of Cloud Computing
- Kindle 2 vs Nook
- Cloud CEOs, CTOs & SVPs to Speak at 4th International Cloud Computing Expo
- Why IBM’s Server Chief Got Busted
- Is Cloud Computing Like Teenage Sex?
- Industry Experts Discuss the State of Cloud Computing
- Performance Tuning Essentials for Java
- The Difference Between Web Hosting and Cloud Computing
- Cloud Computing Expo: Exclusive Q&A with Yahoo! SVP Cloud Computing
- Ajax in RichFaces 3.3, JSF 2 and RichFaces 4
- Confessions of a Ulitzer Addict
- My Thoughts on Ulitzer
- Tactical Cloud Computing Panel at 1st Annual GovIT Expo
- A Cup of AJAX? Nay, Just Regular Java Please
- Java Developer's Journal Exclusive: 2006 "JDJ Editors' Choice" Awards
- The i-Technology Right Stuff
- JavaServer Faces (JSF) vs Struts
- Rich Internet Applications with Adobe Flex 2 and Java
- Java vs C++ "Shootout" Revisited
- Bean-Managed Persistence Using a Proxy List
- Reporting Made Easy with JasperReports and Hibernate
- Creating a Pet Store Application with JavaServer Faces, Spring, and Hibernate
- What's New in Eclipse?
- Why Do 'Cool Kids' Choose Ruby or PHP to Build Websites Instead of Java?
- i-Technology Predictions for 2007: Where's It All Headed?









































