Jess Holle wrote: > So what is AOP good for? It's a powerful tool for building certain > types of library/framework capabilities. ...
Just relating a personal experience, I had read various bits on Aspect Oriented Programming (or aspects in general) but they always seemed to be vague descriptions - "they are cross cutting concerns". Err, ok, but like what does that really mean??? I never "got it". So just in case anyone else is in the same camp of not quite getting the point of aspects, I thought I would share an example that suddenly made it make sense to me. If nothing else, this post might give others the enjoyment of saying "gee this guy is just slow to understand isn't he!" ;-) I came across a concrete example recently in the Alfresco content management system. (Not really programming, but it was a concrete example that made sense to me.) Expressing in programming terms, in Alfresco you can define a class hierarchy for different document types (e.g. generic base class that stores an array of bytes representing the file contents; a subclass say for Office documents with metadata properties common to Word, Excel, and PowerPoint; then a subclass per exact file format with additional properties specified to each file type and maybe saying how to index the file contents appropriately). Inheritance makes complete sense here. Now for aspects. Within an Alfresco repository you might want *some* instances of documents also to be under version control, or record management control. This is not per document type - it "cuts across" different document types. Similarly some instances of files maybe under Record Management control (e.g. "this file cannot be deleted for 5 years"). So in Alfresco you can add an aspect (in this case "records management") on a per instance basis. The aspect is not part of the class hierarchy - but it does give the instance more properties. I am not saying this is exactly the same as AspectJ - I have never used AspectJ. I just found it helped me understand terms like "cross cutting concern" in a much more concrete way. I now at a conceptual level read "aspect" sort of like "Java interface", but one that can be added to object instances at run time irrespective of what class they belong to. Well, I hope the above helps at least one other person out there! It was a penny dropping moment for myself. Alan --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "The Java Posse" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/javaposse?hl=en -~----------~----~----~----~------~----~------~--~---
