Design Recovery. Today’s Lecture Reverse engineering Assignment 3 Benumbered design continued (if...

33
Design Recovery

Transcript of Design Recovery. Today’s Lecture Reverse engineering Assignment 3 Benumbered design continued (if...

Page 1: Design Recovery. Today’s Lecture Reverse engineering Assignment 3 Benumbered design continued (if time)

Design Recovery

Page 2: Design Recovery. Today’s Lecture Reverse engineering Assignment 3 Benumbered design continued (if time)

Today’s Lecture

Reverse engineering

Assignment 3

Benumbered design continued (if time)

Page 3: Design Recovery. Today’s Lecture Reverse engineering Assignment 3 Benumbered design continued (if time)

Reverse Engineering

Recreating design abstractions from: Code Existing design documentation (if available)

Personal experience / general knowledge about problem and application domains

Talking to people

(Biggerstaff, 1989)

Page 4: Design Recovery. Today’s Lecture Reverse engineering Assignment 3 Benumbered design continued (if time)

Design Recovery We might need

Formal specifications Dataflows Underlying patterns Informal knowledge

We want to understand What How Why

This might be more than just re-creating…

Page 5: Design Recovery. Today’s Lecture Reverse engineering Assignment 3 Benumbered design continued (if time)

Why do we have to do this?

Page 6: Design Recovery. Today’s Lecture Reverse engineering Assignment 3 Benumbered design continued (if time)

Why do we have to do this? Working with others’ code…

Debugging Maintenance Modification Reuse

Working with your own code You will work with code in the absence of a

complete design

Page 7: Design Recovery. Today’s Lecture Reverse engineering Assignment 3 Benumbered design continued (if time)

Why do we have to do this?

No designLost designBuild-and-fixedAgile methodologies

Design driftCommon!

Incomprehensible design

Page 8: Design Recovery. Today’s Lecture Reverse engineering Assignment 3 Benumbered design continued (if time)

Design Recovery’s Goals

Recover lost information Cope with complexity Generate alternate views

Detect side effects Facilitate Reuse

(Chikofsky and Cross, 1990)

Page 9: Design Recovery. Today’s Lecture Reverse engineering Assignment 3 Benumbered design continued (if time)

Design Recovery Tips

Page 10: Design Recovery. Today’s Lecture Reverse engineering Assignment 3 Benumbered design continued (if time)

Object Orientation

Something of an advantageClass names, function namesEstablished relationships (inheritance,

members, etc.)

High cohesion helpsA holistic sense of purpose

Page 11: Design Recovery. Today’s Lecture Reverse engineering Assignment 3 Benumbered design continued (if time)

Finding the structure

Entities Classes Methods Variables

Relationships Inheritance Member Objects Method calls

Page 12: Design Recovery. Today’s Lecture Reverse engineering Assignment 3 Benumbered design continued (if time)

Approaches Reverse engineering tools

E.g. Omondo Running the program Eclipse’s References and Declarations Reading documentation Reading class names Talking to people Code reading

Page 13: Design Recovery. Today’s Lecture Reverse engineering Assignment 3 Benumbered design continued (if time)

Also, remember

Existing artifacts, but also Personal experience Knowledge about problem Knowledge about the context Knowledge about solution

Page 14: Design Recovery. Today’s Lecture Reverse engineering Assignment 3 Benumbered design continued (if time)

A (Small) Example

addAllPixels(Image image){

for(int i = 0; i < image.getWidth(); i++){

for(int j = 0; j < image.getHeight(); j++){

Color c = image.getColor(i, j);

addPixel(new Pixel(i, j, c));

addToColumn(i, new Pixel(i, j, c));

updateColorTotals(c);

}}}

Page 15: Design Recovery. Today’s Lecture Reverse engineering Assignment 3 Benumbered design continued (if time)

We might be able to guess that:

Need for a pixel class Different instances for

addPixeladdToColumn

Concerned about speedNot so much about space

Concerned about changability?Or just following convention

Page 16: Design Recovery. Today’s Lecture Reverse engineering Assignment 3 Benumbered design continued (if time)

Could have just been

addAllValues(ImageNumber n){

for(int i = 0; i < image.height; i++){

for(int j = 0; j < image.height; j++){

colorArray[n][i][j] = image.colorAt(i, j);

}}}

Page 17: Design Recovery. Today’s Lecture Reverse engineering Assignment 3 Benumbered design continued (if time)

Assignment 3 – Design Recovery

Recover the design of Calico (surprise!)Tool for electronic whiteboard software design

developed at UC IrvineYou may use any tools you likeDo not ask anyone about it (despite that

normally being a good resource)

Get the Calico code from the subversion repository, detailed instructions follow

Page 18: Design Recovery. Today’s Lecture Reverse engineering Assignment 3 Benumbered design continued (if time)

Assignment 3 – Design Recovery Each group must turn in:

A complete UML (-ish) Diagram At least 1 additional diagram of your choice (might be informal) A document describing the design of Calico (at least 4 pages) Your audience is someone unfamiliar with Calico who needs to

make very significant changes to it The code may not compile Your submission graded on completeness, clarity, accuracy

Each person also needs to submit a team evaluation (forms available on class webpage)

Paper copy due Thursday, February 4th, at start of class

Page 19: Design Recovery. Today’s Lecture Reverse engineering Assignment 3 Benumbered design continued (if time)

Suggestions for Group Work

Everyone start by taking their own look at the whole systemMultiple perspectives will be very useful

Work out the high level architecture Understand program flows Look out for subtle details

Page 20: Design Recovery. Today’s Lecture Reverse engineering Assignment 3 Benumbered design continued (if time)

Further tips

There are papers available on Calico on André's website; feel free to consult them

Use representations of classes to organize

Rote completeness is not the answer, will need to be elegant

Page 21: Design Recovery. Today’s Lecture Reverse engineering Assignment 3 Benumbered design continued (if time)

Team AssignmentsTeam 1 Warren Applebaum Stacey Dao Sam Kaufman Kyle Lutze Ryan Nissenbaum

Team 2 James Benson Hunter Gillane Garrett Kim Francesco Mantovani Hiroe Ono

Team 3 Alex Chung Sohrab Hejazi Tae Kim Michael Merchant Matthew Palmer

Team 4 Andrew Ziming Ryan Hsu Frank Morales Joshua Papa Jordaniel Wolk

Team 5 Jessie Danielson Simon Huynh Patrick Lu Kyle Musler Sean Tsusaki Leo Zen

Page 22: Design Recovery. Today’s Lecture Reverse engineering Assignment 3 Benumbered design continued (if time)

Detailed Checkout Instructions

Two Steps:

1) Install Subclipse plugin for Eclipse

2) Check out the Calico repository

NB: this assumes that you're using Eclipse and are otherwise comfortable with it.

Page 23: Design Recovery. Today’s Lecture Reverse engineering Assignment 3 Benumbered design continued (if time)

Detailed Checkout Instructions1. In Eclipse, go to Help > Software Updates > “Available Software” tab

Page 24: Design Recovery. Today’s Lecture Reverse engineering Assignment 3 Benumbered design continued (if time)

Detailed Checkout Instructions2. Hit “add site”, enter location: http://subclipse.tigris.org/update_1.4.x

Page 25: Design Recovery. Today’s Lecture Reverse engineering Assignment 3 Benumbered design continued (if time)

Detailed Checkout Instructions3. Hit “OK” => Check the Subclipse main box => hit “Install”

Page 26: Design Recovery. Today’s Lecture Reverse engineering Assignment 3 Benumbered design continued (if time)

Detailed Checkout Instructions4. Make sure everything is checked off and hit “Finish”

Page 27: Design Recovery. Today’s Lecture Reverse engineering Assignment 3 Benumbered design continued (if time)

Detailed Checkout Instructions5. Let the libraries download => hit “Yes” at this dialogue box

Page 28: Design Recovery. Today’s Lecture Reverse engineering Assignment 3 Benumbered design continued (if time)

Detailed Checkout Instructions6. Make a new Project (NOT Java Project) and choose this

Page 29: Design Recovery. Today’s Lecture Reverse engineering Assignment 3 Benumbered design continued (if time)

Detailed Checkout Instructions7. Make a new repository location

Page 30: Design Recovery. Today’s Lecture Reverse engineering Assignment 3 Benumbered design continued (if time)

Detailed Checkout Instructions8. Enter https://calico.ics.uci.edu/svn/calico3client/tags/inf122/ and hit

“next”

Page 31: Design Recovery. Today’s Lecture Reverse engineering Assignment 3 Benumbered design continued (if time)

Detailed Checkout Instructions9. Select the root of the tree => hit “Next” (NOT “Finish”)

Page 32: Design Recovery. Today’s Lecture Reverse engineering Assignment 3 Benumbered design continued (if time)

Detailed Checkout Instructions10. Check out in the workspace => give it a name => hit “Finish”

Page 33: Design Recovery. Today’s Lecture Reverse engineering Assignment 3 Benumbered design continued (if time)

Server Checkout To checkout the server version, you will need to repeat steps 6 through

10. Just replace the SVN URL with:

https://calico.ics.uci.edu/svn/calico3server/tags/inf122

Note: You will need to login with your ICS username and password.

(If you receive any SSL certificate errors, you can safely ignore them)

If you have any problems, please feel free to email [email protected] or stop by my office (ICS2 room 110)