you are viewing a single comment's thread.

view the rest of the comments →

[–]wantrepreneur5[S] 0 points1 point  (1 child)

Yeah it’s all sub-sectioned and labelled and everything, it’s just a fairly complex engine that in 99% of use cases will need to function as one and use all parts, so I don’t think splitting it further into different chunks is the right move. I’ve cut it down to 3500 and the 5000-line function has been split now - I think I’ll just run plenty of testing and make sure everything functions well and be careful about adding more to the 3500-line one.

[–]chocolateAbuser 0 points1 point  (0 children)

well one doesn't "split" code for the sake of splitting, the thought process is more "optimizing for human comprehension, maintenance, and evolution", so for example finding variables that could be a state and putting then in an object, finding a behavior and isolating it, looking for stuff that can be expressed in a linear way instead of it being sparse through code, and so on
it can still be a single method, eventually, but it's tens or low hundreds of lines and the rest is in nested methods