Peter Considine
Thank you for your thoughts.

I don`t know any drawbacks with always naming functions. In fact they also would be obfusicated during minimisation, if you do.

Performance also could be no reason to do so. You should consider performance issues, when they appear and not upfront — in my opinion. I can`t imagine that this could be ever relevant, nor has it happend to any code I saw. The reason for bad performance in the past was always something else.

I think the same holds for arrays vs. objects. It is nice to know what is faster, I think arrays, but not relevant for every day code, we all probably write.

Quote from Michael A. Jackson:
The First Rule of Program Optimisation: Don’t do it.
The Second Rule of Program Optimisation (for experts only!): Don’t do it yet.

The most important thing should be: write clear, simple and as little code as possible. The less you write, the less the reader had to understand.

The switch conversion seems to me easier to understand. It needs less lines to communicate what is really happening: A replacement.
I think it is possible to use this in diffent contexts, especially implementing a calculator. I like elegant solutions, that simplifies things, but I do not always find them at first sight. A switch case is awful, in my opinion, and my last resort. JavaScript offers strong concepts and options to create beautiful code. More than I mentioned, and surely more than I already know. I am still learning the language and everything else, each day of may life.

At the moment, to write a post and respond to people, reading it. It’s an amazing world, we are in.

Developer since the 80'th, working at Forschungszentrum Jülich ( …

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store