Project round-up for COM 3205 (take-home final) Given out on Thursday, Dec. 5, due one week later. ================================================== The purpose of this take-home final is to demonstrate your knowledge of SE in the context of your project. 1. Design a tool that checks for dynamic stamp coupling (DSC) ----------------------------------------------------------------------- Consider this as another tool in the domain of "coupling checking". The LoD checks for some forms of bad coupling and this checker will check for another form of bad coupling. Definition: (copied from a lecture in the SE course at Berkeley) Can also be found in various text books on SE. Stamp Coupling Def. data structure is passed as parameter, but called module operates on only some of individual components. Example: calculate withholding (pass entire employee record although only a slice is needed) Why is this bad? affects understanding not clear, without reading entire module, which fields of record are accessed or changed unlikely to be reusable other products have to use the same higher level data structures passes more data than necessary e.g., uncontrolled data access can lead to computer crime The closer to AspectJ code you come with your design, the better. Write a simple requirements document which includes test cases. Note that we want a _dynamic_ stamp coupling checker which checks the rule for a given program execution. Given a method call a.f(b), if "not all of b is used" in the control flow of the call, DSC is violated for this call. So DSC is a call join point predicate. "not all of b is used" can be interpreted in various ways: b is never used. b has subparts some of which are never used. "used" can be interpreted in various ways: sent a message, assigned to a variable, passed as a parameter, read, written. Chose the interpretation you find most appropriate and give an explanation for your choice. Note that using Java Reflection, you can find the parts of an object. 2. Apply coupling definitions ----------------------------------------------------------------------- Apply various coupling definitions to Paul's Eclipse project (or your own) and write a report about this coupling analysis of Paul's project. Do the coupling rules contradict AOSD? 2.a) Apply the LoD checker using Paul's program. ----------------------------------- How do you have to set the Stable and GloballyPreferred set to get meaningful results? Are you detecting some areas of your Eclipse code that could be improved based on the LoD Checker statistics. Do you learn From 2.b) on coupling gets better. Content coupling is considered the worst coupling. From 2.b) on the application is done manually. Choose one package or a few classes. Stop when the work becomes repetitive. Do you get ideas about how to improve your code based on you manual application of the coupling definitions? 2.b) Content Coupling ----------------------------------- Def. one module directly references contents of the other Example module a modifies statements of module b module a refers to local data of module b in terms of some numerical displacement within b module a branches into local label of module b Why is this bad? almost any change to b requires changes to a Does AOP introduce content coupling? Is this bad coupling? 2.c) Common Coupling ----------------------------------- Def. two modules have write access to the same global data Example two modules have access to same database, and can both read and write same record use of Java public statement Why is this bad? resulting code is unreadable modules can have side-effects must read entire module to understand difficult to reuse module exposed to more data than necessary Does AOP introduce common coupling? Consider a logging aspect that makes many modules write to the global log file. Is this undesirable coupling? 2.d) Control Coupling ----------------------------------- Def. one module passes an element of control to the other Example control-switch passed as an argument Why is this bad? modules are not independent module b must know the internal structure of module a affects reusability Does AOP introduce control coupling? Consider an around method that executes the proceed conditionally. 2.e) Stamp coupling ----------------------------------- Apply your designed algorithm manually. Is there any stamp coupling?