Sunday, 5 August 2018

Why is everything always abbreviated? Should I abbreviate too?

This is something that's been bugging me lately as I dive more into node. Official documentation, every tutorial, and third party documentation all seem to use abbreviations where I wouldn't. At least it's consistent, but isn't it a standard convention to not abbreviate unless you have to? Typing is not a bottle neck when developing and even if it were, IDEs can auto-complete for you? So why are we always abbreviating?For Example:app.post('/user', (req, res) => { User.create({ username: req.body.username, password: req.body.password }).then(user => res.json(user)); }); Writing request or response would be four or five more characters per word... that's not going to make the lines exceptionally long and by writing them properly you have an actual word vs a relatively meaningless set of letters.Exhibit B:fluffy.save(function (err, fluffy) { if (err) return console.error(err); fluffy.speak(); }); Why is error abbreviated as "err"? I see this everywhere and it makes zero sense. Saving two characters instead of having a word that everyone can read? Why?Secondly, should I start using these? I always write the full word but I end up in a weird case where I feel like best practices are going against established conventions.

Submitted August 05, 2018 at 01:07PM by _unicorn_irl

No comments:

Post a Comment