Comment

Comment by ganyu

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.

parent ganyu 2 years ago

No comments yet

Be the first to share your thoughts.

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton