Steven Ketcham <stedak / charter.net> wrote in message > AOP was very difficult to explain, debug and implement. It did not > obviously replace any of our current procedures and at best it was > perceived as very heavy-weight. The conclusion on AOP was that it was a > neat concept but there was no immediate benefit for using it. > > On Sat, 23 Aug 2003 22:00:22 +0900, Lothar Scholz <llothar / web.de> wrote: > > I don't like it because it breaks encapsulation and splitters the code > > over a few files. Maybe that can be solved with new kind of editors > > but it is much more easy to result in a big confusion. AOP is the latest effort in code factorization. Code factorization started with the goto statement, then loops, then functions, then classes and methods. And now, AOP. If you write programs in OOP long enough, you will realize that there are code spots that are not factorized. For example, you register to a event listener at the beginning and de-register at the end of a method. If you find yourself writing very similar codes in various classes or methods all over places, you are not factoring your code efficiently. It's not your fault, it's just that OOP cannot do certain types of code factorization. Before having loops, a repetitive task may look like x = x + 1 x = x + 1 x = x + 1 But when you have loops, you can factor the three lines of code into for i in range(3): x = x + 1 Similarly, before object-oriented programming, you have data structure that are very similar, say, A and B, A has (color, shape) and B has (color, shape, weight), with OOP you can use inheritance, and factor out the common code. If we view OOP and inheritance as a vertical dimension in code factorization, AOP would be a new horizontal dimension in code factorization. Hence, people use terms like "aspect weaving". Some people don't like AOP because it violates encapsulation in the vertical dimension. But this way of thinking is kind of, erh, unidimensional. Because conversely, a program that is built from purely AOP is encapsulated in its own aspect dimension, and the usage of OOP in that case would violate the encapsulation in the horizontal dimension. The fact is, both factorizations are needed in the real world. Aspect-oriented coding and object-oriented coding are like the conjugate variables in quantum mechanics, whether you use one picture or the other, at the end of the day they are equivalent, but in some circumstances it's better to use one than the other. (If you know Fourier transform, you know what I mean. A localized wave packet in time necessarily means a spread-out packet in frequency, and vice-versa. You can't have encapsulation both ways.) regards, Hung Jung