Design Document From Code

designdocumentationmaintenance

I am not much familiar with documenting/System designing stuff.

I have to maintain an application written in C# – working as windows service.
However there is no documentation for this system which makes it really pathetic to find where some problem (conceptually) occurred.

I would like to know the best way to design/document it (using current code) manually or preferably automatically so that I can identify the exact problems.

Like I feel as if sequence diagram won't much help probably.
Also, please guide me if I am taking it on wrong side?

Best Answer

Do you have appropriate testing (including, but not only, unit tests) for the system? It seems like you don't, in which case I would start by adding enough tests to be sure that the application behaves as expected (since it fails to fulfill the requirements for the moment, if I understand well your question).

Then, documentation's purpose is to introduce the code to the new developer who doesn't know anything about the architecture of the existent codebase. It means that documentation is not really intended to find where a problem occurred.

When the piece of code behaves unexpectedly, you often start reading code, not the actual documentation, which can be obsolete, or just totally wrong or misleading. In practice, when systems I debugged had documentation, it was obsolete or wrong all the time (concerning the debugged point). No exceptions. Either the documentation was written from requirements and the error was introduced in the code, without reflecting the documentation, or the error was the consequence of slight changes at code level, while documentation stayed the same.


Following the comments, I see that I slightly misunderstood your question, which is more about "How I understand the existent codebase which has no documentation at all". It depends. In my case for example, generating class diagrams is something precious. This is the first thing I do before starting to work on someone else's code, and sometimes the only thing. But I also know people who don't bother generating those diagrams, because they find it totally unhelpful.

Related Topic