reverse engineering 2007-11-27

59
Introduction to reverse engineering Tudor Gîrba www.tudorgirba.com

Upload: tudor-girba

Post on 19-Jun-2015

1.431 views

Category:

Technology


0 download

DESCRIPTION

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

TRANSCRIPT

  • 1. Introduction to reverse engineering Tudor Grba www.tudorgirba.com

2. Reference 3. Reverse engineering is analyzing a subject system to:identify components and their relationships, andcreate more abstract representations.Chikofky & Cross, 90 4. Why reverse engineer? 5. In 1944, 3 B-29 had to land in Russia 6. Requirement: Copy everything fast! 7. Approachdisassembleruntest 8. TU-4 Result: 105,000 pieces reassembled in 2 years 9. Why reverse engineer software systems? 10. 1946 11. 1956 12. 1956 13. 1956 14. 1956 2006 15. 1956 2006 16. 1956 2006 17. 1956 2006? 18. Software is complex. 29% Succeeded18% Failed 53% Challenged The Standish Group, 2004 19. How large is your project? 20. How large is your project? 1000000 lines of code 21. How large is your project? 1000000 lines of code * 2 = 2000000 seconds 22. How large is your project? 1000000 lines of code * 2 = 2000000 seconds / 3600 = 560 hours 23. How large is your project? 1000000 lines of code * 2 = 2000000 seconds / 3600 = 560 hours/ 8 = 70 days 24. How large is your project? 1000000 lines of code * 2 = 2000000 seconds / 3600 = 560 hours/ 8 = 70 days/ 20 = 3 months 25. How development happensfo rw ar dengin eering { { { {{ { }{ { } } actual development } } } { }} } 26. Reengineering is needed to regain controlfo rw g rin aree d ginen gineneese rinerv g re { { { { { { } { { } } program transformation} } } { } } } 27. Reverse engineering is creating high level views g rinee ginenseerv re { { { { } } } } { } 28. Legacya sum of money, or a specied article, given toanother by will;anything handed down by an ancestor or predecessor. Oxford English Dictionary 29. A legacy system is piece of software that you have inherited, and is valuable to you. 30. Reverse engineering is creating high level views g rinee ginenseerv re { { { { } } } } { } 31. Setting directionFirst contact g rinee ginInitial understandingense Detailed model captureerv re 32. What is a pattern? 33. Setting direction g First contact rinee ginInitial understandingenseer Detailed model capturev re 34. You got to be careful if you don't know where you're going, because you might not get there.Yogi Berra 35. Setting direction patterns Set Where directionto start AgreeMost valuableon maximsrst MaintainCoordinate What not What directiondirectionto do to do AppointSpeak to the If it aint brokeFix problems a navigator round table dont x itnot symptoms How to do Keep it simple 36. Setting directionFirst contact g rinee ginInitial understandingenseer Detailed model capturev re 37. First contact patternsTalk withTalk with developersusersTalk Chat withInterview about it maintainers during demoVerify what ReadRead aboutCompileyou hear the code the code the codeRead all code SkimDo a mockin one hourdocumentation installation 38. InterviewChat during demo with maintainers What is the usage? What is the history?Users complain Developers Users are enthusiasticprotect their jobWho to choose? What to ask? 39. InterviewChat during demo with maintainers What is the usage? What is the history?Users complain Developers Users are enthusiasticprotect their jobWho to choose? What to ask? Remember, they are all humans :) 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 x? Why was the reengineering effort started? How do you release? How do you plan what to do? How do you test? 41. Read all code in one hour 42. Read all code in one hour 43. Read all code in one hour I took a course in speed reading and read War and Peace in twenty minutes. Its about Russia. Woody Allen 44. How large is your project? 1000000 lines of code * 2 = 2000000 seconds / 3600 = 560 hours/ 8 = 70 days/ 20 = 3 months 45. Why read all code in one hour? 46. Setting directionFirst contact g rinee ginInitial understandingenseer Detailed model capturev re 47. Initial understanding patterns Top downRecover design Speculate about design IterationAnalyze Study persistent dataexceptional entities Recover Identifydatabase problemsBottom up 48. Identify exceptional entities 49. Speculate about design 50. Speculate about designLayout AbstractItemGraphNode Edge 51. Setting directionFirst contact g rinee ginInitial understandingense Detailed model captureerv re 52. Detailed model capture patternsTie code and questions Track your Exposeunderstanding designRefactorto understand ExposeEncode collaborationsassumptionsStep throughWrite tests executionto understand ExposecontractsExposeevolutionLook forLearn fromthe contractsthe past 53. Why refactor? To understand 54. Write tests to understand and to ensure later refactorings 55. Example: Visualization does not guarantee understanding 56. Learn from the past 57. Setting directionFirst contact g rinee ginInitial understandingense Detailed model captureerv re 58. Tudor Grbawww.tudorgirba.com creativecommons.org/licenses/by/3.0/