The rule: One way of doing something is better than two. #
So when the language gets a new way of doing something that is only slightly better than the previous version, or not better at all, I always stick with the way I was doing it before. That way when reading the code I never have to wonder why did the author choose this way in one place and another way elsewhere.#
Coding tricks is not why we program -- we program to create new utility, and to create something that is easy not to break when it needs maintenence. #
It's very common and imho totally wrong to not adopt the conventions of code you're contributing to. #
If you can get to zero ways of doing something that's way better than one, and way-way better than two or more. #
There are exceptions. Sometimes they add a feature to a language that is so sensible you have to use it. For example, initial values for parameters to functions in JavaScript. Or not having to say name: name in an object definititon, just name will do. Another one, the forEach function in JavaScript is more sensible than the equalent for version.#
See the rule in the standards-makers howto. It's the same idea.#
Sometimes I don't have time to write a full prose version of a post, I think it's better to write the skeletal version rather than publish nothing at all.#
copyright 1994-2022 Dave Winer.
Last update: Wednesday January 5, 2022; 5:48 PM EST.
You know those obnoxious sites that pop up dialogs when they think you're about to leave, asking you to subscribe to their email newsletter? Well that won't do for Scripting News readers who are a discerning lot, very loyal, but that wouldn't last long if I did rude stuff like that. So here I am at the bottom of the page quietly encouraging you to sign up for the nightly email. It's got everything from the previous day on Scripting, plus the contents of the linkblog and who knows what else we'll get in there. People really love it. I wish I had done it sooner. And every email has an unsub link so if you want to get out, you can, easily -- no questions asked, and no follow-ups. Go ahead and do it, you won't be sorry! :-)