3

I just joined a group of five developers (non-professionals) working on a medium sized Python framework (> 50 modules, > 10.000 lines of code). The project has no documentation whatsoever and there are no coding conventions of any kind. My job is to

  1. get an overview of what the framework does (theoretical physics calculations),
  2. write a detailed documentation for the current code,
  3. define development guidelines,
  4. design a new software architecture,
  5. perform code refactoring.

Unfortunately, I'm not used to programming languages with a dynamic type system in such large projects (until now I've used Java for such purposes and Python for shorter scripts).

Speaking in terms of anti-patterns, the code is pure spaghetti code, contains a god class and lots of copy-and-paste programming. In my oppinion, the code has degenerated to a point that is unmaintainable. However, rewriting the entire code is not an option.

In "AntiPatterns: Refactoring Software, Architecture, and Projects in Crisis" William Brown et al. suggest the following steps for code refactoring, when adding new code in such software projects:

  1. Control access to member variables (in Python I would use properties).
  2. Avoid duplicated code.
  3. Reorder function arguments to improve consistency.
  4. Remove code that is, or may become, inaccessible.
  5. Rename classes, functions, data types to improve consistency and set standards.

Step 1 seems to be somehow un-Pythonic to me and steps 2-5 are trivial. I have resigned at trying to figure out the big picture. Instead, I am approaching the issues one at a time. However, I am constantly stuck at trying to resolve the insane amount of object coupling.

I am uncertain if my approach is a good idea at all, as I have no experience in software restructuring. It is also hard to ask a specific question as I am stuck in the beginning of my work. I would appreciate if someone could provide insight into best practices in this topic.


Edit: This question now focuses on the approach of restructuring Python frameworks instead of simply getting an overview.

sfat
  • 334
  • 1
  • 6
  • My question focuses on the approach with **dynamically typed languages**. – sfat Jul 15 '13 at 12:09
  • Get the specs. Write the specs if none exist. Review the specs. – Deer Hunter Jul 15 '13 at 14:00
  • 3
    I don't think that the suggested duplicate is a great match against your question, but I think the answers there will help refine your question. Please review the suggested duplicate question & answers, and [edit] your question to call out the differences in what was previously asked and your question now. –  Jul 16 '13 at 01:11

0 Answers0