10

I am preparing a memoir about "Why do (some) IT projects become too complex and how to avoid it ?".

If you have ever encountered projects having complex codes or were hard to maintain, how did you manage to go through it?

If you have to choose between several applications to use in your project, what would be your top priority in their functionality and why?

dagofly
  • 101

4 Answers4

8

Document, Document, Document!

I work with some pretty complex MVC code, and am only now actually understanding how it works, as opposed to accepting it on faith. Whenever I make a change that I have a hard time figuring out, I put a comment in the code at that section to help clarify what is happening. It might not have helped me since it wasn't there, but it'll help the next person around. I also like to ask other programmers around me to look at my changes to see if they are clear.

My company has an internal wiki that we use for documenting a lot of the meta tasks we do, like virtual server problems, common queries, etc. Whenever I come across something I've not done before but will have to do often, I check to see if there's a wiki on it. If there isn't I'll make one. More people have gotten involved in it as well recently, so I hope it will grow faster. I think it really helps communication of the more mundane tasks we have.

Michael K
  • 15,659
6

I don't think you can ever completely avoid complexity over time, but there are ways to mitigate it:

  • Keep the code as clean as possible at all times, within reason. (In the "how Uncle Bob defines 'clean'" sense.)
  • Apply code reviews and/or pair programming to lower the odds of one developer over-engineering things needlessly.
  • Maintain adequate unit tests and integration tests.
  • Invest in a continuous integration server and build often. Release often too, if possible.

All of this is somewhat dependent on what the project actually entails. Sometimes, for example, it'll be beneficial to accept complexity in exchange for performance. Not all complex code is necessarily a bad thing. In general, though, I think following these guidelines should help.

Adam Lear
  • 32,069
4

Also, resist the temptation to add quick hacks because the code is complex/bad/hacky already. In my experience you'll end up with exponential more complexity.

3
  • technical debt

    refactor to eliminate

  • business changes

    adapt and expunge

  • tool changes

    new tools, same old architecture = impedence mismatch