Web Dev full-stack [LAMP] since 2005, but much heavier on the JS stuff these days.
Jack of all Stacks, Master of some.
Always looking to learn new things. Always glad to help out, just ask.
Location
Atlanta, GA
Education
B.S. in Biochemistry 2004, M.S. in Computer Information Systems 2007
This solution is great to optimize the code.
However in the real world, next week some non-tech person is gonna come in and go "When it's divisible by 3 i also want you to display "pop" and "pizzaz" if it's divisible by 4"
At that point the final optimization becomes a hindrance, so the second version of the code is better to work with.
This happens in real world situations ALL the time.
A lot of framework devs don't take this into consideration and over-optimize the code unnecessarily leading to headaches for their future selves, or worse, for the poor sucker who has to take over their code in a year to apply new changes.
I suppose the lesson is: Optimize, only as far as you need to to gain the performance expected. Anything more, might come back to haunt you.
This solution is great to optimize the code.
However in the real world, next week some non-tech person is gonna come in and go "When it's divisible by 3 i also want you to display "pop" and "pizzaz" if it's divisible by 4"
At that point the final optimization becomes a hindrance, so the second version of the code is better to work with.
This happens in real world situations ALL the time.
A lot of framework devs don't take this into consideration and over-optimize the code unnecessarily leading to headaches for their future selves, or worse, for the poor sucker who has to take over their code in a year to apply new changes.
I suppose the lesson is: Optimize, only as far as you need to to gain the performance expected. Anything more, might come back to haunt you.
Great advice. Definitely need to keep scalability in mind. I added the correction to the article. Thanks so much for sharing!