SDA SE Wiki

Software Engineering for Smart Data Analytics & Smart Data Analytics for Software Engineering

User Tools

Site Tools


Assignment 10, Reengineering Toe Dipping

Release date: Tuesday 07.01.14 - Due date: Sunday, 12.01.14, 23:59

You might want to start with Task 52: Static vs Dynamic Analysis

Task 49: Reengineering the "extend" Concept(s)

8 points

In case you start to work on software developed by others, you might find that they used in code, models and documents

  • the same word for different ideas (homonyms) and
  • different words for the same idea (synonyms).

While this might have been ok for the others as they knew what they have been talking about, every newcomer needs to learn

  • to distinguish the different meanings of the homonyms and
  • to find out that different words actually mean the same thing.

This is a reverse engineering the knowledge. In case you can (partially) remove these difficulties, you are doing reengineering.

Let's do something similar for ATSC knowledge:

a) We used the word “extend” in different contexts. Give for each of the five contexts a definition (2-3 sentences) of the word “extend”:

  1. Java: Java class A extends Java class B
  2. Use case diagrams: Use case A extends use case B
  3. Use case slices: Use case slice A extends use case slice B
  4. Use case slices: Use case slice A extends non use case specific slice B
  5. UML profiles: Stereotype extends metaclass

b) Describe the abstract idea that all these concepts have in common (2-3 sentences).

c) We introduced the two concepts listed below. Give for each a definition and describe how they relate to the other concepts (2-5 sentences):

  1. UML: Package A merges package B and package C.
  2. AspectJ: Aspect A contains a inter-type declaration for class B.

Task 50: Dynamic Feature Location

10 points

Check out the following projects from the samplesolutions (!) folder of the SVN:

  • LibsForJHotDraw (Libraries used by JHotDraw)
  • JHotDraw60b1 (JHotDraw in version 60b1, latest version compatible with the tests.)
  • TestJHotDraw03 (A few tests for JHotDraw)
  • AJHotDraw03 (A version of JHotDraw with some aspects. Not required. Maybe interesting.)

If you want to see JHotDraw at work right click on the file JavaDrawApp.java in JHotDraw60b1/src/org.jhotdraw.samples.javadraw and select “Run As > AspectJ/Java Application”.

From your group's repository check out:

  • A10_T50_DynamicFeatureLocation (This is the only (!) project where we expect changes.)

Your task is to write an aspect to instrument the code to produce a table of the following form:

Test 1 Test 2
Class A 1 0
Class B 1 1

Where 1 means a method of the class is executed during the execution of the test. Otherwise 0. We think it's the easiest to create the table in Java, but you may as well post-process your data in a spreadsheet application or a text editor. As result we expect the following content in the following files in the A10_T50_DynamicFeatureLocation project:

  • dynamic.analysis.ClassesUsedByTestTracing.aj : The tracing aspect
  • Result.csv : The table “class x used by test”. For details about the format see in the file.
  • UsedByAllTest.txt : The classes used by all tests.
  • UsedByPasteCommandTestOnly.txt : The classes used just by the PasteCommandTest

To run the tests right click on the file TestAll.java in TestJHotDraw03/src/test/org.jhotdraw.commands and select “Run As > JUnit Test”.


Task 51: Static Feature Location (Optional)

[5+5+5 points]

The static feature location we presented in the lecture aims at providing the same information as the dynamic feature location but without executing the program. The ideal solution for this task would be an improved executable version of the naive static feature location that we sketched in the lecture plus the result. This is too much and most of you will not have the tools to solve it. Therefore we ask for the following:

a) An [untested but reasonably correct] implementation of the “naive static feature location” from slide 17 in one of the following languages:

  1. Java, based on the Meta-Model on slide 17. (You may assume that each class has a field “name” and you may invent reasonable field / role names for the associations. Assume some tool already generated this model for you from the source code as an abstraction of the Abstract Syntax Tree.)
  2. OCL, based on the same Meta-Model.
  3. Prolog, based on the facts class(ID, Name), method(ID, Name), field(ID, Name), class_contains_method(Class, Method), class_contains_field(Class, Field), class_extends_class(Class, ExtendedClass), field_has_type(Field, Class), method_calls_method(Method, CalledMethod), method_overrides_method(Method, OverridenMethod), method_accesses_field(Method, Field).1)
  4. Datalog, based on the same facts.
  5. Prolog, based on the real JTransformer Program Element Facts.

b) (Just for completeness. We don't think this is possible to solve in a few hours.) An executable implementation of the analysis. If you execute it, you will quickly realize that the precision needs to be improved. Improve it at least a bit.

c) The result of this analysis for the same features as in Task 50 (i.e. “InsertImage”, “ChangeAttribute”, “Paste”, “Undo”). As you probably have no running implementation2), you may use the Call Hierarchy View provided by eclipse. Select the right methods in the test cases 3) and on each right click and select “Open in Call Hierarchy”. Expand the tree completely and write down the class names. Compare your result with the result in Task 50.


Task 52: Static vs Dynamic Analysis

8 points
  • Give us a definition of “Static Analysis” and of “Dynamic Analysis”. (2-3 sentences each)
  • Describe the similarities and the differences.
  • Discuss the advantages and disadvantages of both approaches.

If you use external sources make sure that you cite them.


1)
Update 2014-01-09, dsp: We accidentally used “attribute” and as well “field” in the predicates before. Now it is consequently “field”.
2)
If you have one: Great! Just write down the result and compare it to the result for Task 50.
3)
It is a bit tricky to find a good starting point. You need to study the test hierarchy a bit.
teaching/lectures/atsc/2013/assignment_10.txt · Last modified: 2018/05/09 01:59 (external edit)

SEWiki, © 2025