Exam Flashcards
AOP
Aspect-Oriented Programming (AOP) complements OO programming by allowing the developer to dynamically modify the static OO model to deal with cross cutting concerns
Cross-cutting concerns
Concerns which “cross-cut” the class structure, lowering cohesion and increasing coupling.
CCC Consequences
> Code Tangling
> Code Scattering
Code Tangling
1) Code for CC is mixed with the business logic.
2) Reduces cohesion
Code Scattering
1) Code is duplicated because it is needed in multiple places
2) Reduces coupling
Lock handling Problem
1) Business logic code (put and get) is mixed with concurrency control code resulting in code tangling and poor cohesion
2) Have to add locking code correctly to every business logic code resulting in code scattering
3) Failure to do so would lead to hard to find bugs
4) Need a single, global lock resulting in extra coupling
Lock handling Pros
1) Avoids code scattering and tangling
2) Lock is localised as a private instance variable
3) Reusable simply by writing a new concrete aspect
AOP and Design Patterns Pros
1) Greater modularisation of concerns
2) Avoid code tangling and scattering
3) Easier software evolution
4) Greater code reuse
5) Easier management (easier to split tasks)
6) Cheaper implementation of new features
AOP and Design Patterns Cons
1) Program flow is hard to follow
2) Tendency to use CCC everywhere, leading to poor designs
3) Everybody on the team needs to be up to speed with AOP
4) Tools limited to those which support AOP language in use
AspectJ
1) Java AOP framework
2) Classes and aspects are written separately
3) “woven” together at bytecode generation time
4) Nothing in class code referes to the aspects
AspectJ advice kinds
> before - code to be executed before the join point
after - code to be executed after join point
around - replaces the code
pointcut - shows where the CC should be applied
AOP and Design Patterns
1) Observer and Singleton are the only ones who have any benefits
2) Pure fabrications have no sensible inheritance relationships outside the pattern
3) Combing patters will make AOP solutions more problematic
Advice
Additional code that you want to apply to your existing model
Join point
Place where CCC crosscuts the code
Point cut
Point of execution in the application at which cross-cutting concern needs to be applied
Aspect
The combination of the point-cut and the advice
Iterative process
> Assumes you can’t get all requirements right at the start.
Progresses in a set of timeboxed iterations
Phases
Disciplines
Artifacts
Timeboxed Iteration
Means if you don’t get it done you don’t extend the iteration, you change the plan
Agile UP Phases
- Inception
- Elaboration
- Construction
- Transition
UP Phases [Inception]
Initial feasibility study and project go-ahead
UP Phases [Elaboration]
More detailed study, production of high-risk parts of the system. Iterative except for very small projects.
UP Phases [Construction]
The bulk of the work. Iterative.
UP Phases [Transition]
Acceptance testing, “maintenance” etc.; moving on to the next project.
Disciplines
Done through process, not phases
Disciplines Examples
> Requirements
Domain Modeling
Class Design
Coding
Artifacts
> The things you make as part of the process
> The amount of “ceremony” in a project should be appropriate to the scale and nature of the project.
Artifacts Agile approach
> Don’t produce more artifacts than you need to
> Don’t make them look pretty unless you have to.
Ceremony
Artifacts other than code
Use Cases
A description of a set of interactions between a system and and one or more actors
Use Cases Formats
> Brief
Casual
Fully dressed
Use Case [Brief]
A short paragraph describing the MSS.
Use Case [Casual]
The MSS plus short descriptions of the main alternatives