And while one dev might indent every line perfectly every time, another dev probably doesn’t care (and knows JavaScript doesn’t care too much either, so s/he can get away with it). Isn’t that painful to look at? Yeah.ĭoes this sound at all familiar to you? Congrats, you’re on a working dev team, and everyone has their own preferences for how they like to code.Īs you might already be able to imagine, what one developer is perfectly fine with (no whitespace anywhere), probably drives another one nuts. This is an example of poorly formatted code. Take this piece of code from a codebase I’m currently working in: Blocks of code with no spaces or comments anywhere making reading them and deciphering what’s happening that much harder.Some files that use “strict” JS and others that don’t.Run on lines that cause you to scroll right for ages to see everything they contain.Tons of whitespace between some lines and no whitespace between others.You may see some (or all) of the following: Now that I’ve got everyone else’s attention, let me give you a hypothetical (real-life) example of what you might encounter upon opening an existing JavaScript codebase that a team of developers has put together. If you’re a solo, rockstar, ninja developer, you can go on about your day. This post is for all the JavaScript developers out there who’ve ever developed any application with another person (or plan to). Code formatting: it’s not just for sticklers and grammar nazis A slight exaggeration, but you get the idea.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |