Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to save my sanity while maintaining spaghetti code [closed]

Tags:

Just wanted to hear some words of advice (and comfort.. ) that will help me to take control over some complicated spaghetti code -- code that was developed by multiple programmers (usually that never meet each other) over long time. the solution's features are just patched on top of each other.

Usually I tend to see 2 kinds of programmers:

  1. "Scared-to-death programmers" - those guys will not touch anything that they don't have to. they will probably will complete the maintenance task using a quick and dirty fixes that will make the next programmer to start looking for their home address ;-)

    pros:
    it works

    cons:
    you hope you will never see this code again..

  2. "Teachers" - those will probably rewrite the whole code while completely refurbishing its logic.

    pros:
    well, someone has to do the dirty work...

    cons:
    takes longer time and probably one of the most critical features will magically disappear from the product

It will be nice to hear your personal experience from this darker side of the programmer's life.

I am specifically curious to hear any theoretical/hands-on advice that will help me to dive into the spaghetti maintenance task without feeling so miserable.

like image 235
ofer Avatar asked Apr 02 '09 21:04

ofer


1 Answers

I try to wrap really bad legacy code in tests before I start. I pretty much smother it in tests, to be honest! Then I have some confidence in diving in an refactoring it where I need to.

You might like to read

Book cover

Working Effectively with Legacy Code

like image 96
dommer Avatar answered Sep 19 '22 06:09

dommer