Aspect Oriented Programming provides a mechanism of modularizing the application by separating to cross cutting concerns from the application. For implementing an AOP paradigm, you would want to know the following:
Aspect: A concern that cuts across multiple objects like Transaction, logging, exception handling etc…
Join Point: An execution point in the application like a method execution or catch of exception etc…
Advice: Action to be performed in an aspect at a particular join point.
Pointcut: Pointcut determines join points of interest for us to execute the advice. For example, conditions like Function Name or all public functions etc…
In our project or for that matter in any project, we can see a more common problem – dilution of the design guidelines. The project was designed with certain principles in mind. Unfortunately, as time passes by and new team members contribute towards the code, these guidelines get evaporated. One such case in our project was the usage of Command classes.
In order to understand the actual issue, we might have to go back a few years when Raj was designing the application. The architecture was designed like
- There will be a WCF service exposed by the client for their business operation.
- Each operation in the service will perform one action requested by the user.
- The action to be performed will be delegated to a command class.
- Each command class will perform one and only operation.
Seems a fair enough guideline. But as the team started working on the application, they saw that there were some pieces of code being written again and again. Bling!!! What about code reuse... Brilliant!! Let us have common code written in a separate command and reuse the command. So, what eventually happened was each service operation started comprising of multiple commands, which went on to become a separate command for certain logic even when not reused.
But what is the problem:
I see no harm in reusing, I mean, didn’t we learn that reusability increases code quality.
Come on people!!! What do you think might have been the problem with this? Please post in your comments on the same. I would request the project members not to comment on this as they very well know the issue.
As I would not want to make you read too much of content in 1 post, we will discuss the issue and the solution in the next blog.
Desire!!! Indulge!!! Inspire!!!