English 中文(简体)
How to add a new feature to an existing component? [closed]
原标题:

We have this legacy image viewer component in our project that s working fine but it s source is a real mess. I have to add a new feature to this component so that people can add annotation to images using a light pen which is not a complicated task per se but could be a nightmare dealing with our existing code.

I m really confused right now I don t know where should I start . do I have to refactor the existing code?if not what else can I do?

So here s my question: What could be the best (less painful) approach dealing with such situations?

最佳回答

The question is not an exact duplicate, but this exact same answer applies (you just have a list of one change)

https://stackoverflow.com/questions/1386824/hired-as-a-developer-to-maintain-and-update-current-code-base-no-docs/1386844#1386844

问题回答

Write lots and lots of tests that will allow you to verify that changes you make to the system do not change or break existing functionality.

These tests are like the brace-work that is used to support a physical building when a construction crew is doing reconstruction. That brace-work is used to keep the existing infrastructure intact. You need to preserve the infrastructure of your system with as many unit and integration tests as you have time to write.

These tests will allow you to make small, iterative changes to the system and easily verify that those changes still maintain the expected behavior.

You should read this very good article Big Ball of Mud. And for your answer we all get a big ball of mud at some point and we need to add new functionality to it. Re-factoring such a code is not a good idea since it require alot of testing. But adding few new lines will not harm it. So unless you have alot of time and so does the tester just add the new functionality to your existing code. Although the current code look messed up but remember it works and tested. Read the article and makeup your mind as to which approach is good.





相关问题
Understanding a software system

I recently became part of a complex embedded project team for which I will be developing a part. For the part which is my responsibility there is only old code and not much documentation. I am keen ...

How to add a new feature to an existing component? [closed]

We have this legacy image viewer component in our project that s working fine but it s source is a real mess. I have to add a new feature to this component so that people can add annotation to images ...

Ruby on Rails: What to do with legacy code?

I ve a portal project built in Rails 1.2.3. I ve finished it at end of 2006. The project are using the following plug-ins: acts_as_attachment acts_as_ferret betternestedset simple_http_auth I know ...

Web application to legacy code interop

I am trying to migrate a simple WinForms app to a ASP.Net web app. WinForms app is basically only a presentation layer for a complex plain C app, and interacts with legacy code through COM interop. I ...

Separating rapid development from refactoring/optimization

I m working in a team of 2 front-end developers on a web-based late-stage startup project. The site works quite well, but there s a lot of room for improvement code-wise, as the code is quite messy ...

热门标签