top | item 39369576

(no title)

ganyu | 2 years ago

Say some gigantic piece of function has 600 lines of code that does logic this, logic that and logic this and that. Suppose one day your PM goes into your office and request that a certain special case be added to this feature.

You do not further increase the complexity of this function by having one or two variables in the front, several if-elses in the middle not to mention a couple gotos.

You take these special cases and the most relevant logic away into yet another function, document it and hence ensure the changes to that 'special logic' do not mess up with the rest of that feature.

discuss

order

No comments yet.