Download - Reverse Engineering (EVO 2008)
Reverse Engineering
Tudor Gîrbawww.tudorgirba.com
Chikofky & Cross, 90
Reverse engineering is analyzing a subject system to:
identify components and their relationships, andcreate more abstract representations.
Why reverse engineer?
The B29 bomber
In 1944, 3 B29s had to land in Russia
Requirement: Copy everything, fast!
Disassemble
Disassemble Run
Disassemble Run
Test and compare
Tupolev TU-4: 105,000 pieces assembled in 2 years
Why reverse engineer software?
forward engineering
actual development }
{
}
{
}
{
}
{}
{
}
{
}
{}
{
}
{
reve
rse
engin
eerin
gforward engineering
}
{
}
{
}
{
}
{}
{
}
{
}
{}
{
}
{
actual development
program transformation
reve
rse
engin
eerin
gforward engineering
}
{
}
{
}
{
}
{}
{
}
{
}
{}
{
}
{
program transformation
reve
rse
engin
eerin
gforward engineering
}
{
}
{
}
{
}
{}
{
}
{
}
{}
{
}
{
Reengineering life cycle
reve
rse
engin
eerin
g
}
{
}
{
}
{}
{
}
{Setting direction
First contact
Initial understanding
Detailed model capture
reve
rse
engin
eerin
g
}
{
}
{
}
{}
{
}
{Setting direction
First contact
Initial understanding
Detailed model capture
patterns
patterns
patterns
patterns
short intermezzo
What are patterns?
reve
rse
engin
eerin
g
}
{
}
{
}
{}
{
}
{
Setting directionFirst contact
Initial understanding
Detailed model capture
Yogi Berra
You got to be careful if you don't know where you're going, because you might not get there.
Setting direction patterns
Agreeon maxims
Appointa navigator
Speak to theround table
Most valuablefirst
If it ain’t brokedon’t fix it
Whereto start
Whatto do
Fix problemsnot symptoms
Keep it simple
What notto do
How to do
Setdirection
Maintain direction
Coordinate direction
reve
rse
engin
eerin
g
}
{
}
{
}
{}
{
}
{Setting direction
First contactInitial understanding
Detailed model capture
Interview during demo Chat with maintainers
What is the usage?
What are the bugs?
What do you like?
What is the history?
What is the process?
What are the problems?
Interview during demo Chat with maintainers
Remember that they are all humans:
they complain
they are enthusiastic
they protect their jobs
What is the usage?
What are the bugs?
What do you like?
What is the history?
What is the process?
What are the problems?
Read all code in one hour
Read all code in one hour ?
Read all code in one hour 100’000 lines of code
?
Read all code in one hour 100’000 lines of code
* 2 = 200’000 seconds
?
Read all code in one hour 100’000 lines of code
* 2 = 200’000 seconds
/ 3600 = 56 hours
?
Read all code in one hour 100’000 lines of code
* 2 = 200’000 seconds
/ 3600 = 56 hours
/ 8 = 7 days
?
ArgoUML
Moose
Woody Allen
I took a course in speed reading and read “War and Peace” in twenty minutes.
It’s about Russia.
First contact patterns
Chat withmaintainers
Interview during demo
Talk withdevelopers
Talk withusers
Read all codein one hour
Skimdocumentation
Do a mockinstallation
Readthe code
Compilethe code
Read about the code
Talk about it
Verify what you hear
reve
rse
engin
eerin
g
}
{
}
{
}
{}
{
}
{Setting direction
First contact
Initial understandingDetailed model capture
Speculate about design
Graph
Layout
EdgeNode
Abstract
Item
Identify exceptional entities
Identify exceptional entities
for i in $( ls ); do echo `wc -l $i` >> tempdonesort -nr temp | head -10
Initial understanding patterns
Speculateabout design
Analyzepersistent data
Studyexceptional entities
Bottom up
Top down
Iteration
Recoverdatabase
Identifyproblems
Recoverdesign
reve
rse
engin
eerin
g
}
{
}
{
}
{}
{
}
{Setting direction
First contact
Initial understanding
Detailed model capture
To understand: refactor
To understand: refactorwrite tests
To understand: refactorwrite testsstep through execution
Learn from the past
Detailed model capture patternsTie code and
questions
Exposecontracts
Refactorto understand
Step throughexecution
Look forthe contracts
Write teststo understand
Learn fromthe past
Exposedesign
Track yourunderstanding
Encodeassumptions
Exposecollaborations
Exposeevolution
reve
rse
engin
eerin
g
}
{
}
{
}
{}
{
}
{Setting direction
First contact
Initial understanding
Detailed model capture
Tudor Gîrbawww.tudorgirba.com
creativecommons.org/licenses/by/3.0/