So ok, today was a crazy day.
New sprint, new ticket.
Work on the bug tickets first he said ….

Sure can. Oh had I just known that this very first innocent looking ticket is the way to coder‘s hell ….

‚Access of undefined‘ it said. Easy to fix, I thought.
Until I found the very same code twenty-fucking-two times over about 50 files!

Who would guess that exportSingleOperatorBooking, exportSeveralOperatorBookings, exportAllOperatorBookings (… and more) could in practically be the same? Nah, they all use different interfaces.
Oh wait, the alias type of the extended sub-interface of file misc.ts is the same logical content as a differently named interface below another different interface with the same content as in another ts file?
Wait that can‘t be. Riiiiight?? 😳

8h later I have barely scratched the surface of refactoring this shitshow of a project.
But no, I refuse to put the same error handling multiple times in different places.
I could have been done already. I could have saved my soul, my sanity. But I will be brave and strong to save the innocent developer that will cometh after me. For I shall be rewardeth for my sacrifice.

  • 1
    How can a function be 22 times in 50 files?
  • 0
    @jonas-w it wasn‘t exactly one function, moe like a chain of functions: service -> mapper -> transformer -> client.
    Various type declarations spread across different files too, like IDownloadFileBase64, IUploadFileBase64, IFileBase64 with the same content, and on some other spots the same content of those interfaces used inline, like:
    file: { // same as interfaces above
  • 4
    @mojo2012 :| rm -rf ./projectWithSpaghettiInsideOfIt/
  • 2
    @jonas-w and then a force commit to the repo. Multiple times.
  • 1
    But you choose to save your integrity :)
  • 3
    The classic copy paste development.

    Instead of refactoring you copy paste and change whats needed.

    And end up with multiple almost identical functions.
    And when you find a bug you have to go over each of them to see which is affected.

    And sometimes only one gets fixed, or some, and the same problem gets fixed over and over in possibly different ways.

    I wonder if you inherited code from a former colleague :/
  • 0
    @Voxera he still is a colleague 😅
    In his defense, he only has 3y of experience in software development.
  • 1
    @mojo2012 ok. My collegue did not have any valid excuses ;)
Add Comment