Named params helps the beginners, maybe even more for use of internal APIs
- no needle/haystack order problems anymore - no need going to docs to understand what a boolean or „magic value“ stands for
- no needle/haystack order problems anymore - no need going to docs to understand what a boolean or „magic value“ stands for
someFunction(username, true, false, 10)
Named parameters remove ambiguity and make the code easier to read and review, and even avoid bugs because if you're passing the wrong values it's immediately obvious.One of the hidden issues with the above code comes in the future: if anyone ever changes the order of the 2nd and 3rd arguments in the function definition, and forgets to update this spot, the code will still "work" (no compile error) but instead will have the wrong runtime behaviour. In a pull request, you can't see all the affected spots that didn't get updated, so it is easy to slip through.