Reverse Engineering 2007-11-27

1,690 views

Published on

I used this set of slides for a lecture at Hasso Plattner Institute on 27.11.2007.

Published in: Technology
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,690
On SlideShare
0
From Embeds
0
Number of Embeds
22
Actions
Shares
0
Downloads
93
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

Reverse Engineering 2007-11-27

  1. 1. Introduction to reverse engineering Tudor Gîrba www.tudorgirba.com
  2. 2. Reference
  3. 3. Reverse engineering is analyzing a subject system to: identify components and their relationships, and create more abstract representations. Chikofky & Cross, 90
  4. 4. Why reverse engineer?
  5. 5. In 1944, 3 B-29 had to land in Russia
  6. 6. Requirement: Copy everything fast!
  7. 7. Approach disassemble run test
  8. 8. TU-4 Result: 105,000 pieces reassembled in 2 years
  9. 9. Why reverse engineer software systems?
  10. 10. 1946
  11. 11. 1956
  12. 12. 1956
  13. 13. 1956
  14. 14. 1956 2006
  15. 15. 1956 2006
  16. 16. 1956 2006
  17. 17. 1956 2006 ?
  18. 18. Software is complex. 29% Succeeded 18% Failed 53% Challenged The Standish Group, 2004
  19. 19. How large is your project?
  20. 20. How large is your project? 1’000’000 lines of code
  21. 21. How large is your project? 1’000’000 lines of code * 2 = 2’000’000 seconds
  22. 22. How large is your project? 1’000’000 lines of code * 2 = 2’000’000 seconds / 3600 = 560 hours
  23. 23. How large is your project? 1’000’000 lines of code * 2 = 2’000’000 seconds / 3600 = 560 hours / 8 = 70 days
  24. 24. How large is your project? 1’000’000 lines of code * 2 = 2’000’000 seconds / 3600 = 560 hours / 8 = 70 days / 20 = 3 months
  25. 25. How development happens fo rw ar d en gin ee rin g { { { { { { } { { } } actual development } } } { } } }
  26. 26. Reengineering is needed to regain control fo rw g rin ar ee d gin en gin en ee se rin erv g re { { { { { { } { { } } program transformation } } } { } } }
  27. 27. Reverse engineering is creating high level views g rin ee gin en se erv re { { { { } } } } { }
  28. 28. Legacy a sum of money, or a specified article, given to another by will; anything handed down by an ancestor or predecessor. Oxford English Dictionary
  29. 29. A legacy system is piece of software that you have inherited, and is valuable to you.
  30. 30. Reverse engineering is creating high level views g rin ee gin en se erv re { { { { } } } } { }
  31. 31. Setting direction First contact g rin ee gin Initial understanding en se Detailed model capture erv re
  32. 32. What is a pattern?
  33. 33. Setting direction g First contact rin ee gin Initial understanding en se er Detailed model capture v re
  34. 34. You got to be careful if you don't know where you're going, because you might not get there. Yogi Berra
  35. 35. Setting direction patterns Set Where direction to start Agree Most valuable on maxims first Maintain Coordinate What not What direction direction to do to do Appoint Speak to the If it ain’t broke Fix problems a navigator round table don’t fix it not symptoms How to do Keep it simple
  36. 36. Setting direction First contact g rin ee gin Initial understanding en se er Detailed model capture v re
  37. 37. First contact patterns Talk with Talk with developers users Talk Chat with Interview about it maintainers during demo Verify what Read Read about Compile you hear the code the code the code Read all code Skim Do a mock in one hour documentation installation
  38. 38. Interview Chat during demo with maintainers What is the usage? What is the history? Users complain Developers Users are enthusiastic protect their job Who to choose? What to ask?
  39. 39. Interview Chat during demo with maintainers What is the usage? What is the history? Users complain Developers Users are enthusiastic protect their job Who to choose? What to ask? Remember, they are all humans :)
  40. 40. What to ask a maintainer? How long was your project going on? Who worked on the project? What was the most interesting bug you had to fix? Why was the reengineering effort started? How do you release? How do you plan what to do? How do you test?
  41. 41. Read all code in one hour
  42. 42. Read all code in one hour
  43. 43. Read all code in one hour I took a course in speed reading and read “War and Peace” in twenty minutes. It’s about Russia. Woody Allen
  44. 44. How large is your project? 1’000’000 lines of code * 2 = 2’000’000 seconds / 3600 = 560 hours / 8 = 70 days / 20 = 3 months
  45. 45. Why read all code in one hour?
  46. 46. Setting direction First contact g rin ee gin Initial understanding en se er Detailed model capture v re
  47. 47. Initial understanding patterns Top down Recover design Speculate about design Iteration Analyze Study persistent data exceptional entities Recover Identify database problems Bottom up
  48. 48. Identify exceptional entities
  49. 49. Speculate about design
  50. 50. Speculate about design Layout Abstract Item Graph Node Edge
  51. 51. Setting direction First contact g rin ee gin Initial understanding en se Detailed model capture erv re
  52. 52. Detailed model capture patterns Tie code and questions Track your Expose understanding design Refactor to understand Expose Encode collaborations assumptions Step through Write tests execution to understand Expose contracts Expose evolution Look for Learn from the contracts the past
  53. 53. Why refactor? To understand
  54. 54. Write tests to understand and to ensure later refactorings
  55. 55. Example: Visualization does not guarantee understanding
  56. 56. Learn from the past
  57. 57. Setting direction First contact g rin ee gin Initial understanding en se Detailed model capture erv re
  58. 58. Tudor Gîrba www.tudorgirba.com creativecommons.org/licenses/by/3.0/

×