开发者

How do I tell where to put an upgrade in the code

开发者 https://www.devze.com 2023-03-25 05:44 出处:网络
My job consists almost entirely of adding new functionality to a legacy system built by my predecessor.

My job consists almost entirely of adding new functionality to a legacy system built by my predecessor.

The new features are not that much of a problem, I can copy pastes some coder from the system and know enough to know how to use it.

My problem is with 565 classes I never know where my new function should go, what it should inherit. There is no documentation of the architectural and so far I have had to read and read and read source till I can trace a function call and find a suitable place to put my code.

Having read this sight it is apparent to me that working on others peoples code like this is an nece开发者_StackOverflow社区ssary skill to a programmer so there should be some professional techniques that I would do well to learn.

What tips and tricks are there when upgrading other programmers code ?

The program is a server with a database, an a website GUI.


It is generally helpful to discuss the code base with other programmers. With luck, they may still be in touch with the original developer.

Document as much as you can; writing down what you have learnt will help you to memorize it, and it will be helpful for future reference - both for you and for other developers.

One thing I sometimes do when confronted with a new code base is draw simple UML diagrams of the things I find. I do this by hand, because doing it by hand helps me to understand things better. It is not necessary to do perfectly correct UML or to make diagrams of everything; just draw the things that you try to understand and see if it helps you understand what's going on. (Of course if you decide to make these diagrams part of the documentation, you should make sure that they are not ambiguous)

Hope this helps. Good luck on your project!


Use some sort of visualization tool to figure out what sort of dependency model you've got. Then start with adding the change to the place that has least side effects. Document where you've added it, and why. Write a unit test and a feature test. Then ask for a review of your work. Then you can slowly start promoting and de-duplicating your code. Some development environments will help you find code duplication. Duplicates will give you hints at where the code should go.

If Spring or some DI framework is being used, look at the composition model. Perhaps you need to extract your code and some other code into a well named, clearly defined component.


Three things should help you decide where any changes should go.

  • Well designed code should make it clear where changes go (or at least what needs to be changed).
  • Experience. Experience programming will help choosing what part needs changed.
  • Familiarity. Even though the code base is large you will become familiar with it and realise where the next change should go (or at least know where to start looking).
0

精彩评论

暂无评论...
验证码 换一张
取 消