9

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?

3
  • 2
  • 1
    There are no complex codes in complex projects. See english.stackexchange.com/questions/20455/…
    – user11408
    Jul 12, 2012 at 10:47
  • No one mentioned code map or mind mapping because they've never taught to use them and have no experience in using them because there is no plugin or software out there which could create a map for the code flow of your big project. Millions of lines of code and you have to go through them for hours to understand something small. The way people create programs is brutal and takes a long time to manage a project. Hope one-day visual programming or at least code flow generation plugins find their way in the programming world as a valuable tool.
    – Eftekhari
    Aug 3, 2019 at 20:54

4 Answers 4

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.

2
  • 1
    Interesting! I wonder why don't we have such wiki in our company, it woul have been much easier
    – dagofly
    Nov 16, 2010 at 8:58
  • +1 for the developer wiki (as long as it's backed up well!)
    – MGOwen
    Dec 16, 2010 at 2:37
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.

3
  • technical debt

    refactor to eliminate

  • business changes

    adapt and expunge

  • tool changes

    new tools, same old architecture = impedence mismatch

2
  • exactly, dealing with complex (badly written) code/architecture parterns instead of refactoring it is paying INTEREST on technical debt. when you eliminate those bad spots you're paying back PRINCIPAL on technical debt
    – shershen
    Aug 26, 2014 at 12:37
  • Interesting way to describe this, wish some of my clients could grasp this. Building on bad, hacky foundation code, only means more complex hacks required in the future, instead of just stopping, looking at where we are and how we can make life easier & faster, and moving that direction.. while($client_does_not_listen) { $client_does_not_listen = waste_time_and_money_until_client_listens(); }, watch out because this simple while loop will waste your life minutes & drive you insane, and clearly can only be broken out of by the client.. I've even tried throwing in a try{} catch() to no avail..
    – NinjaKC
    Feb 1, 2017 at 23:02
3

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.

1
  • 5
    Absolutely. When you find yourself in a hole, the first thing to do is to stop digging. Nov 16, 2010 at 0:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.