r/SiliconValleyHBO • u/juanritos • Mar 30 '18
Google JavaScript Style Guide: Use Space, Not Tabs.
https://medium.freecodecamp.org/google-publishes-a-javascript-style-guide-here-are-some-key-lessons-1810b8ad050b2
u/TheRedmanCometh Mar 31 '18
I don't get it you can adjust how many spaces your tabs are. This lets everyone work with their own visual indention.
I fucking hate spaces tbh
1
Apr 01 '18
I think the point is to standardize largely indented pieces of code. Like sometimes in Python you get crazily intended code that would end up looking funny if you opened it on another computer. There may also be conversion errors.
What you really need to do is forsake the sin that is web programming and come to the might embedded world where we care little for your whitespace and worship the holy semicolon.
1
u/TheRedmanCometh Apr 01 '18
Yes they look weird because of how many spaces your tabs are set to. That's the whole point....without changing any of the file we can both have our indention indentation preference. It looking differemt is specific to your preferences not the file.
That's a purely subjective difference...it's strictly different on my machine. Objectively the file is the sane on all our computers. Standardization is about the file contents not my personal view of them.
I don't see how spaces help "standardize" anything in a unique way tabs don't. If anything it's far less noticeable to accidentally include an extra tab
If I'm half blind and need crazy indention I can go to 6 spaces per /t. If I am a horrible soulless person I can set it to one per tab.
Further, conversion errors are due to line endings not tabs.
I'm a back end software engineer. I'm pretty far from webdev unless you count the occasional CRUD app view.
Also who comes to a Java sub and talks about the embedded world?
That's all ahead-of-time compiled shit no? I certainly know theJIT+ jvm makes Java very unpopular for embedded.
2
Apr 01 '18
[removed] — view removed comment
2
u/TheRedmanCometh Apr 01 '18
I thought I was on /r/java because I had just been browsing/posting there. Oops
Sunday at 10am you think I'm anything approaching sober?
1
u/Fatvod Apr 02 '18
But in the show they showed richard hitting his space bar four times each time. That would never be a thing. You would just set your ide to use 4 spaces when you hit tab.
1
Apr 02 '18
Which is what everyone does. That's why the discussion centers around tabs v spaces in terms of portability and displayability.
The tabs people have a good point that you can configure your tabs to your own personal preference, but in a company with code standards there is usually a defined length for the tab/number of spaces.
I also think Eclipse might be bitchy about the tabs as spaces thing. I don't know. I use vim where tabs are spaces.
0
u/Dogeek Apr 02 '18
spaces over tabs
That's bullshit, tabs are designed to indent, it's one ascii character versus 4 spaces. I'll never use spaces over tabs, unless I work on a codebase that does that already.
Use single quotes not double quotes
Google smokes some bad shit with that one. Double quotes are just plain better because you don't have to escape single quotes, it's easily type-able unlike the backtick (`)
Don't use eval()
Well, if the input of eval is accessible only in code, there's no real danger, obviously, if it's used on user input to cast a number into an integer or whatever, yeah, that's a bad idea...
14
u/TRONTraitor Mar 30 '18
Richard and I see eye to eye - Tabs are superior.