158
XPoint
7y

I am asked to refactor this file in order to make it readable
what do you say guys ?

Comments
  • 50
    God help you.
  • 49
    Don't do it sober.
  • 20
  • 2
    @jlave215
    I hope he do
  • 2
    @lostpirate
    hahahah
    I which I can do that right now
    and run away
  • 16
    Switch spaces with tabs, and tabs with spaces.

    Who wants to read 18000+ lines of code anyway ?

    Is death an option ?
  • 7
    Good luck, I have never had to tackle such a large blob ...
  • 4
    Run away ;-)
  • 7
    @GarreauArthur
    Yes I think, but the company will not pay for the burial costs
    Hehehe
  • 1
  • 2
    God speed. If you finish alive, let us know!
  • 24
    I just found a function of 10,000 line
    In that fileπŸ˜•
  • 20
    Just say you want 1$ for every line of code.
  • 3
    @Jasey
    Hehehehehe
    Riiiiiiight......
  • 5
    One more thing I forgot to mention
    That the file I am refactoring
    Is the backend of a Windows form
    meaning it is using variables from the form
    πŸ™‚
  • 1
    @Jasey
    Thx
  • 17
    common sense of programming software .... every fu***** function, method, procedure, etc ... that takes more than 4 screens ... must ... and this is not a recommendation..... must be splited in multiple function, classes, etc ...
  • 3
    @Nosvampire
    Agree 1000%
  • 7
    You can say I'm crazy but it could be actually fun and challenging

    I mean imagine the satisfaction you'll get when you finish

    Oh yea... And be sure to have been paid in advance lol
  • 4
    @dontPanic
    Ok I wouldn't panic
    And I am not...

    You got a point there
    Here some thing I didn't say yet
    That I have 10 days to do it
    Yeah I know there is no challenge anymore

    But I will challenge my self to finish it in couple of days
    πŸ˜‰
  • 3
    @dontPanic and the hysteria and frustration when it doesn't work ....
  • 7
    If you want to reduce line count, make everything on one line. Sorted xD
  • 4
    burn it with fire. or minify, and then make them refactor it again.
    Or bring a hacksaw to work, and while holding it nonchalantly, ask them to do a better job.
  • 2
    πŸ˜€
  • 2
    In my work place we have a single file of ~65k LOC with multiple class in it that have cached state (i.e. variables with meaningless names used to store local variables)!

    Still, good luck :D
  • 1
  • 2
    @gaetanballevre
    Thx
  • 1
    Just auto format it or use ST3 with some regex to make it pretty
  • 1
    Ctrl-K Ctrl-D

    No nonsense
  • 2
    @AboMahdi good luck!
  • 2
    @Nosvampire that's the thrill 8)
  • 3
    Don't do it... If it works, don't touch it.
    You'll just get into a journey for which you know the start point but the ending is not visible in the horizon.
  • 3
    @nocgod
    The thing is I want to refractor the code to be in a separate environment
    Where the windows app still use it and run normally
    And will be used by another process
    So it should be refactored in order to be used both ways
  • 7
    Ctrl + a, delete
  • 2
    @chrisrhymes
    πŸ˜‚ πŸ˜‚ πŸ˜‚ πŸ˜‚
  • 2
    bye bye Weekend
  • 2
    @Anu-cool-007
    Yeah πŸ˜•
  • 2
    You can have a look with resharper. It can help refactoring code quite well
  • 2
    @AboMahdi this task will go under your accomplishments. All the best.
  • 2
  • 2
    Challenge accepted ( remove all line breaks to make one giant line)

    And maybe writing it from scratch is faster then refactoring
  • 0
  • 2
    @zombie01 word of advice.

    Unless its relatively small or well covered in unit tests, avoid rewrite.

    Many small but important checks or edge cases are probably covered by the code but not documented.

    Those are easily missed on a rewrite.
  • 1
    Eventually,
    I checked the code and refactored some main functions(a 1,200 line mainly)

    And made it accessible from an API
    But I am never to touch that thing again in a 1000 years
    πŸ™‚
  • 1
    Rage quit and gtfo
  • 0
    @Nosvampire more than 4 screens?? That's a joke right? 50 lines is already an absolute limit. Check out SIG guidelines, they are even much stricter.
  • 0
    @CodeMasterAlex i would usually be agree wirh you .... but now that im working in a place where the policy is, declare every var in a line, and in the end of the functions release those vars, set to nothing, etc.. if those functions has an average of 30 vars, that left you nothing to deal with, and get the ideal of 50 lines
  • 0
    And this right here is way templates and mother/daughter classes were introduced to C++.

    May you survive this!
  • 2
    @AboMahdi
    So, what does it do? What does it contain? ( and what is it's maintainability score in codemetric?)
  • 1
    @CWins
    Its functionality I can't say sorry
    But it is a code of a winform written in c#
    The goal to be achieved is to make it work as a logic of a webservice

    Meaning refactor the functions in order to make the software run as a rest api when run from cmd, and do all its functionality normally
    Same time keeping it working normally if it was run by double click as a form
  • 1
    PS: the form has 2 partial classes beside this file
  • 0
    @bitsnpieces you are taking it seriously πŸ€”
  • 0
    vim ./file.something

    20000 J

    :wq
Add Comment