Axa Assurance Maroc - Insurer Innovation Award 2024
Everything you Wanted to Know About Refactoring
1. Everything you Wanted to Know About Refactoring but were Afraid to Ask! By Gary Short Technical Evangelist Developer Express
2. Agenda What is Refactoring? Why Should I Refactor? How do I know that I have to refactor? How Should I Refactor? How can Tooling Help Me? Advanced Refactoring.
3. Why do I Need to Know this? Refactoring is a professional dev skill Therefore it’s a must have skill for you! Helps to keep technical debt under control Technical debt kills projects.
4. Introduction Gary Short Technical Evangelist for Developer Express Community Evangelist for... Well, me really! Microsoft MVP C# Where do I hang out? http://www.garyshort.org (blog) http://www.twitter.com/garyshort http://www.sodthis.com (podcast).
6. What is Refactoring? Knowledge says refactoring is... the process of changing a computer program's internal structure without modifying its external functional behavior or existing functionality, in order to improve internal non-functional properties of the software, for example to improve code readability, to simplify code structure, to change code to adhere to a given programming paradigm, to improve maintainability, or to improve extensibility.
7. Ooo, Hold on, How’d you do That? the process of changing a computer program's internal structure without modifying its external functional behavior or existing functionality, Unit Testing is a software design and development method where the programmer gains confidence that individual units of source code are fit for use modern applications include the use of a test framework such as nUnit each test case is independent from the others: substitutes like method stubs, mock objects, fakes and test harnesses can be used to assist testing a module in isolation.
24. How Should I Refactor? Ask yourself the following questions Is my code readable? Is my code abstract? Anything more is rearranging the deck chairs on the Titanic It gives you a sense of doing something But ultimately it’s pointless.
35. Can Tooling Help me? Yes, in the following ways Refactoring can be repetitive Repetitive tasks bore humans Resulting in mistakes Solutions can contain many projects Many classes with many projects can contain the same method calls This makes them hard to find and easy to miss Tools can suggest refactors that you might not know exist.
41. Summary Refactoring is changing the structure, but not the functionality of your application Refactoring is done to pay back the “Technical Debt” Refactor by asking is your code Readable Abstract Invest in some tooling.
42. Further Reading Fowler, Martin (1999). Refactoring. Improving the Design of Existing Code. Addison-Wesley. ISBN 0-201-48567-2. Wake, William C. (2003). Refactoring Workbook. Addison-Wesley. ISBN 0-321-10929-5. Feathers, Michael C (2004). Working Effectively with Legacy Code. Prentice Hall. ISBN 0-13-117705-2. Kerievsky, Joshua (2004). Refactoring To Patterns. Addison-Wesley. ISBN 0-321-21335-1. Arsenovski, Danijel (2008). Professional Refactoring in Visual Basic. Wrox. ISBN 0-47-017979-1.