A good logging framework is critical for even the most simple of software. You could be writing your code in Java or C++ or Rails and using either a custom home built logger or a standard logging framework like log4j, but you have to be logging.
And if you have been logging, you know how ugly and cumbersome it makes your code look. It would be nice to somehow separate the logging code from the functionality code.
Aspect Oriented Programming
Preface
A concern is anything which impacts the code of a program. Separation of concerns simply means that each piece of code addresses a single concern. This leads to modular programming which is easier to code and more importantly leads to less bugs and the code is easier to change.
When a single piece of code addresses multiple concerns, we call that cross cutting concerns. The best example of a cross cutting concern is logging. The log statements are usually present throughout the code. A change in the logger code can impact any other functionality.
The problem of cross cutting concerns is addressed at various levels by
And if you have been logging, you know how ugly and cumbersome it makes your code look. It would be nice to somehow separate the logging code from the functionality code.
Aspect Oriented Programming
Preface
A concern is anything which impacts the code of a program. Separation of concerns simply means that each piece of code addresses a single concern. This leads to modular programming which is easier to code and more importantly leads to less bugs and the code is easier to change.
When a single piece of code addresses multiple concerns, we call that cross cutting concerns. The best example of a cross cutting concern is logging. The log statements are usually present throughout the code. A change in the logger code can impact any other functionality.
The problem of cross cutting concerns is addressed at various levels by
- Object Oriented Programming
- Functional Programming
- Aspect Oriented Programming
However, Object oriented programming (code is classified into objects) or Functional programming (dividing the code into simple functions) cannot really solve the problem described above (separating the logger code).