English 中文(简体)
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 to make a good start but shyness and fear of appearing stupid makes it difficult to ask questions. How to ask questions ?

I wanted to ask what techniques do you guys use to understand a project ? I mean there are of lots of technical details which one must remember and keep in context in order to make a design. Your read the code and get some facts but how to move ahead ? For instance you read the code and the document(s) and get some facts A and fact B . How to reach suitable conclusion X for which you may or may not have needed to take into account facts C and D also ?

最佳回答

Reading the code is balanced by writing the documentation.

Write the documentation that your replacement will need. Imagine someone who knows less than you. Explain it for that person.

When you cannot explain something to your replacement, ask questions.

When you have a complete description, you will "know" the system.

And you will have produced complete documentation.

问题回答

Code-reading can be particularly difficult if there is not enough documentation and the code is poorly documented and badly written. I guess the best way now is to find the entry point of the code, and slowly understand its flows and what data it uses. I would keep a look out for

  1. Structure - are there any partitioning of entities/system? Where in the code (and how) do they communicate with each other?

  2. Data - what sort of structures are used to hold the global data? How are the data accessed and saved?

  3. If you are doing C or C++, it is also important to find out how memory is handled and for C++ (and other related non-managed memory OOP languages, I guess), how are object ownership contained.

  4. Since it is an embedded project, are there any non-standard code or coding constructs used?

You don t mention what kind of tests exist. If there are test cases, modify them and trace how this would affect the end result.

You might want to look at diagrams which give the entire picture of the logical structure of the system, like, for example, looking at class diagrams in an OOP system would be of great help. Looking at the design diagrams of large and complex apps gives you a clear understanding of how the internal modules of the system are organized and this way its makes the task of figuring out what functionality does a particular piece of code does much much easier. In the absence of diagrams, you re best bet would be to start from the entry point of the app, like main() and proceed from there while you draw(literally draw or write down on paper) your own conclusions about the system(this way you can have your own documentation) and ask your peers if they re correct.

My experience is that it s best to start with some kind of task -- a bug fix or other small change. That will provide focus to your learning. I find it hard to read through a binder or sift through pages of source code or documentation without having a way to apply it.

If you have a sandbox where you can play with changes that you ve made without messing up the code base, that can be even more helpful.





相关问题
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 ...

热门标签