Ask HN: Should beginner programmers use code formatters from day one?

3 points by vga805 ↗ HN
I taught JavaScript awhile back and I regret not using prettier from day one. I think using a formatter lets new learners focus on the tricker parts of the language rather than the style thereof.

7 comments

[ 2.6 ms ] story [ 17.9 ms ] thread
Yes. I think all professional programmers should be using as many tools as they can from day 1. Tools like linters, filewatchers mapped to tests, IDEs (or well equipped editors). All of these tools help drive code quality and productivity and thusly should be seen as much a part of their career as knowing the nuances of their choice language, design patterns or details about any other part of their stack.
...and then there we are with professional programmers who can't run javac without fully-blown IDE, don't know that you can package class files to a JAR to ship a program, and think that you need two dozen different tools with their quirky configuration to ship a trivial web page to present static text.

No, programmers should start with the simplest tools and learn on concrete examples why and what for the more complex ones are needed (or that they are completely redundant and unnecessary).

That's just like, your opinion, man.
I think you should use a linter for sure. I look at it like spellcheck. If you allow the computer to just "fix" it for you, you will reinforce the incorrect spelling. I always backspace and retype the incorrect word so that I learn the correct spelling (and in turn, the correct combination of keys to press). I do the same thing with linters. I have it configured in my IDE that linting errors are underlined in red, like a syntax error. This forces me to go back and retype the correct syntax and style.
No. Without freedom to mess around and experiment with different styles, how are you supposed to learn why it matters, let alone develop your own style?

(Reading/modifying nicely-written code is a good exercise to try early on, though...)

I'm somewhat alarmed about how ubiquitous these formatting tools have become. Seems like a step towards stamping out any trace of individuality, and making programming an assembly-line job rather than a craft.

Certainly a good idea if they're going to work with others. As an important aid to the learning process? Probably not.
I think the first thing to teach/learn is to set up a linter which includes strict formatting rules.

Formatter, editor, etc. should remain a personal choice.