Homework 3: "Redesign" patterns
Goal: To design and implement a reusable design pattern in AspectJ
Due: Wednesday 02 October 2002 in class
Turn-in: during class and by email to
mdeters@cse.wustl.edu (see below)
You should:
- Reconsider and redesign one of the
Gang of
Four design patterns (you will be assigned one to avoid two people
covering the same one) with aspects in mind.
- Implement and test your design pattern. This includes writing one or
more simple "clients" that make use of your design pattern.
- Identify:
- Advantages or disadvantages in using AspectJ for this design pattern
instead of plain Java
- Advantages or disadvantages in using AspectJ for this design pattern
instead of another non-aspect language (C++, or whatever you're
familiar with)
- Intermediate designs that you attempted but ultimately decided
against (and why you made such a decision)
- Difficulties in getting things to work
- Any other experiential tidbits from completing this assignment
- When "redesigning" your design pattern, keep in mind the
following general suggestions:
- Attempt to increase the obliviousness of client objects of their
role in the pattern.
- Rather than studying the Gang of Four designs (UML diagrams,
etc.) for places to inject aspects, go back to the original
objective of the design pattern and think of crosscutting concerns
in the big picture.
- Don't try to shove everything into one aspect---if there are multiple,
independent concerns, try to split them into separate aspects.
Even concerns that aren't completely independent can often be
cleanly separated. (As an example, "independent but
cooperating" concerns fall into this category. A thread
safety mechanism on top of another concern is one such example.)
- Aim toward reusability of your pattern implementation.
- Try to use abstract aspects and pointcuts where
appropriate. Use the Subject/Observer example's "protocol"
aspect (as discussed in class) for inspiration.
- You will lead a 10 (or so) minute discussion on October 2 (or the 9th
if we run out of time on the 2nd).
- You are not required to prepare materials (presentation slides, demos,
etc.) but may if you choose. Please be prepared to access your source
code over the network and walk us through it. (I'll bring a network-ready
laptop and projector.)
- Please turn in any source code, visual aids, and any other prepared
materials to me by email.
You are not required to write up answers to the above questions in the
email to me, but you will include them in your class discussion.
- This assignment is intended to make you think about design and also
write code. It may take some time to clearly identify aspects in your
pattern, so please start thinking about this early and email me if you
have any difficulties.
You may find the Subject/Observer
discussion helpful in completing this assignment. The
AspectJ
Programming Guide also provides an explanation. The source code for
the Observer demo is in /pkg/aspectj/examples/observer (or in
the documentation distribution available at aspectj.org if you choose to
download it yourself).
Pattern Assignments
Please contact me at
mdeters@cse.wustl.edu if you
have problems with this assignment.
Help on setting up AspectJ
Back to Aspect Seminar page
Morgan Deters /
About me /
OpenPGP Public Key /
02 Jan 2006