76

Took over an old project. Okay lets look into the code: a method with 17 parameters... 17...

Comments
  • 0
    That’s crazy; imagine that, calling the method and then specifying 17 parameters.
  • 1
    @kunashe half are collections the other are booleans and ints... almost all are set to null so you can call a simplified version. There are 2 or 3 full 17 params calls. Someone took 2 or 3 classes and shoved them in a static method for some reason.
  • 5
    Refactor it into taking object[17] !
  • 15
    😁 you have just seen a hint of the dark side... the #1 in our shitty 30 year old codebase has 58... 19 of those are open query objects directly to the database. And the "function" is 13000 lines of doom and despair for those who try to touch it.
  • 1
    @loebkes that certanly proves we are from the darkest timeline
  • 0
    I've done this before 😅
    But it was only used internally by my module, and had no public interface.

    Certainly lots of things in that project I'd do better now...
  • 0
    I had every webpage as a project when I took over there are some 17 projects. Reason: it’s modular and the old developer saw it as micro service 😂
  • 5
    Bitch please. 277 parameters. All of them ints and doubles and arrays and and matrixes of ints and doubles.
    8000 lines of (outdated) comments followed by 5000 lines of management code (referring to around 35 handlers of around 40 parameters and 1500 lines of code each). With hundreds of possible error codes, all of which are, of course, integers, with their meaning appearing in comments at the top of each file.

    And I had to refactor it all into a single request and single response object. Without changing the source code. It was a 2-year worth of a wrapper class.
  • 1
    this is why we study design patterns people!
Add Comment