9
mr-user
7d

I need to add new feature into the program which I wrote years ago so I start digging up the source code. The project is written in a language which I no longer code in.

That code is really poorly written with most of them don't have tests. I also find out that previous self is really a genius since he can keep track of huge project with almost no documentation.

To make matter worst, there are unused components (class,feature) in the source code. "Current me" have a policy of "just adding only a feature you need and remove unused feature" but it seem the "previous me" don't agree with the "current me".

The previous me also have the habit of using writing insane logic. I can remember what particular class and methods is doing but I can't figure out the details.

For example one method only have 5 line of code but it is very hard to figure out what those do.

The saving grace is that he know the important for method signature and using immutable data structure everywhere.

I was under the influence of caffeine and have a constant sleep deprivation at the time (only sleeping about 4 hour every day) so I can't blame him too hard.

I can't blame him too hard, right?

Could someone invent a time machine already? Invent time machine not to save the world but to save the developers from himself.

Comments
  • 1
    Sounds like time to scrap it and get a new one. What I'm telling most of my customers these days anyway 😅
  • 3
    @M1sf3t

    Even if I rewrite it would took at least 6 month (that is the best estimate)

    The program is the core component which a lot of another programs depend upon so I cannot scrap it as I want.

    When I was writing the program I can recall even to the tiniest arcane detail and now I cannot even list the major feature.
  • 2
    @mr-user i know, i just feel you pain. It's not feasible for my customers to buy a new vehicle over a leaky water pump or worn out rack and pinion either, I'm just tired of being the one they call to fix it for them.
  • 4
    I know the problem but I learned the lesson long before I started building professional software.

    A small hobby program written in gw basic, it is one of the varieties using line numbers.

    I was “very clever” in reusing code and “avoiding unnecessary number if lines” which caused the code to have very long lines :/.

    You could write multiple statements on the same line using ; and using gosub you could even jump out and back into the same like.

    But the resulting code was unintelligible about 2 weeks after it was finished.

    I have never repeated that mistake, at least not to the same degree;)
  • 2
    @Voxera

    The problem I cannot seen to figure out is that I am doing math operation with constant.

    I cannot seem to remember what that constant do. Of course there is constant name but it is too generic. The only thing I can remember is that it have to do with business goal.

    I also cannot remember why I do certain path manipuliation.

    I learnt my lesson but it always pain to look at your older code.
  • 1
    @mr-user lesson to learn, use constants with names :)

    And if its a computed constant, actually do the calculation in code, the compiler will optimize the calculation away anyway and you have it easy to read :)
  • 1
    FX [ Looks at code he wrote 35 years ago and tries to figure out how it works.. ]
Add Comment