10
Skuldul
3y

I understand that changing code requires it to be tested, but removing code that has been commented out for years shouldn’t matter!

Save my soul

Comments
  • 1
    The test should check if there are in fact fewer commented out lines of code. If true, awesome!
  • 3
    @N00bPancakes yeah our standards seem to be, “not used anymore? Comment it out even if it’s 10000’s of lines”

    Oh even worse, comment out an entire class and add “_Old” to it
  • 4
    May be you have a script running on a forgoten VM which reads your git repo, looks for this specific commented code, compiles it on the fly, then injects as a "plugin" into your release software ?

    I saw so much vbizzare things, it would not surprise me to find something like that haha

    (But yeah, removing commented section should not trigegr a full retest)
  • 5
    No, do your job properly!

    You need to write unit tests to test that the removed comments are indeed still removed... In case someone adds them by accident...
  • 0
    Testing against commented code, whose creation / last changed date can be (hopefully) verified by an VCS, seems like a very dangerous idea.

    Most of the time the same trouble occurs as in too many comments without maintenance - you test wrong behaviour.

    Even if the file hasn't changed much, it's senseless to add tests to have more tests.

    Many tests with low quality are the worst. Resources are wasted, despite a misleading high count of tests it's very likely that the codebase is rotten and stinks like hell.

    If you don't know how to test, let it be.

    Hire an expert, but don't blindly add tests for the sake of tests.

    Not only is it a PITA to maintain, but it leads to the problem of our codebase is wrong cause we assumed the tests were right problem - tons of low quality tests can lead to this paradoxon.
  • 0
    I get this dilemma every now and then: Should I delete the code or comment it? A dev after may find it helpful to see the evolution of logic. I don’t know. Meh.
  • 6
    @Cyanide Delete.

    That's why you have a VCS.

    It's his job, don't take it away or it will be depressed.
  • 0
    @NoToJavaScript No, I know our code base very well, and there is nothing like that, would make my happier if there was though haha
  • 2
    @Hazarth

    1. Remove commented code
    2. Merge to master
    3. 2nd dev rebase -i his working branch
    4. Conflict!!
    5. Add commented code back
    6. Commit
    7. Merge back to master

    TADA! >.<
  • 0
    You comment it out or rename it so you can say in 3 years „oh hey, we had that thing 3 years ago, ah, good times. We only had 2k commented lines.“
  • 0
    Dude - commented code should be terminated with extreme prejudice. Put on the shades, do the Arnold Schwarzenegger voice saying “Hasta la vista, baby.” and commit!😎
Add Comment