DEV Community

Discussion on: How Do You Handle Legacy Code When Starting a New Project?

Collapse
 
raviklog profile image
raviklog

Good thread...yes i have worked on many legacy code...different languages, intricate components architecture and existing issues and new features to update....sometimes no documents will be available, no comments will be there...the people who had worked on that will not be there....So i follow the procedure.

1) If i dont have documentation, then first go with the functionality test and note down how many functions are supported by the software...excel or any spreadsheets...
2) For each function, i will verify as a tester and then also do unit test to check what works and what does not work...elaborate process but i extend my work timelines from 8hrs to sometimes 16hrs or more...but this effort will help later.
3) once functions are clear, then as a developer do run and perform code workflow and check all the entry, exit points...sometimes it is events/multiple threads/multiple processes involved...those times in your code type logs for all the major entry, functional steps and exits to cross verify your understanding.
4) All these please take a separate code base/directory , as the main baselined code in source control should not be affected by any way...so do all these verifications in s separate code base.
5) Main split your working time based on priority of everyday task and the learning and documentation...surely many night-outs i have done just to learn and document...but it will help us dearly when clients ask for new features to update/do complete migration...you will feel control of your own product.
6) Mainly understand the issues/bugs in the legacy code...perform thorough analysis before fixing the same...as it will break existing functionalities and we will go in a loop of rework.
hope it coincides with others worked on legacy code and helps