As you become more experienced with JavaScript there are tips and principles on how to write clean code that you should know. The craft of software engineering is a relatively new one. The craft of medicine has existed for thousands of years while so...
prplcode.hashnode.dev4 min read
Great article, Simon!
I am finding it hard to universally agree with the notion of not making functions with boolean (flag) arguments. If you had to make a different function for every variation of a method, wouldn’t you often end up with multiple functions with a lot of duplicate or similar code in them?
I suppose the obvious solution to this is to break such functions up into smaller methods, but then in some cases wouldn’t you end up with several methods where one would do that just accepts a few flags?
Would you consider it acceptable to have a parent function with flags and some simple methods to call the parent just for readability’s sake?
If you can give further clarifications or examples, that would be great!
Riti Rathod
nice tips