Ending the big debates of the computing world
By Ariel Costas - September 29, 2021
NOTE: This article is humor, don’t take it too serious. If you want to complain, shoot an email to ariel at costas dot dev
Since computers exist, some big debates have existed over two popular choices related to settings or using certain program or another. Today, I’ll give my opinion on these topics, and why my choice is (probably) the best /s.
Tabs or spaces
When indenting code, there are two options: either you are a normal person and use tabs or you want to see the world burn and use spaces. A code file is nothing more than a text file on your hard drive, and each character entered is a byte (or more) of space. Why would you use four bytes when you could use only one?
A horizontal tab is the ASCII character 0x09, and an editor can display it however it wants: moving the text after it 4 columns to the right, 8 columns or only 2 if you want it like that. This means, everyone receives only one byte (0x09) but they get to choose how they see it, as a personal choice.
On the other hand, spaces are 0x20 on an ASCII chart and each space is moving the following text ONE COLUMN to the right, so to indent it as 4 spaces you need 4 bytes. That’s 4 times more than a tab, it makes files larger and it doesn’t allow for customization, as I could prefer to have two columns indentation and someone else 8 or even 16.
Please don’t waste resources using spaces, the planet and other developers will thank you.
Line Feed vs CarriageReturn+LineFeed
This is not so commmon, but we get to the same problem: wasting bytes. This is in part thanks to Windows and DOS using CR+LF nowadays, while Unix-like systems use only LF.
You might have seen “\r\n” in some places before, those are the escape sequences for CR (\r) and LF (\n), that indicate a line ends and the following bytes are in other line. Why using two characters to indicate a line ends and the following one begins? One is enough, as Unix-like systems prove.
The Linux kernel has 17.5M lines of code, and each line has a line ending. So, around 17MB of the kernel code are just line endings. If Linux used CRLF, that would DOUBLE the amount to 34MB only for line breaks.
So, once again, don’t waste resources uselessly. Thanks :)
Light mode or dark mode
This is more of a personal preference, but I like terminal and code related things to be dark, for some reason. My eyes get tired when reading code in light mode, or writing it.
This doesn’t happen with websites though, I can read long articles on a site with a light background without problem, and can’t get used to dark mode everywhere, neither websites, programs or cell phone apps.
Vi/Vim vs Emacs
In the old days of computing, the most popular text editors were GNU Emacs and Vi (or vim, Vi IMproved). Most server distributions include vim installed by default, as it’s good for editing from a terminal.
Emacs, however, is more extensible and easily customizable using Elisp (its own variant of the Lisp programming language). Emacs is also known for things like Org-mode, or being able to be used as a full desktop operating system (not exactly, but almost) by having a Window Manager (EXWM), Agenda (Org), Browser, Terminal and even clients for IRC and other communication methods.
If you don’t know any of them, I’d tell you to first learn vim keybinds (moving around, opening and closing buffers, editing modes, substitution and all that) and then install emacs with something like Evil-mode. That way you have the extensibility of Emacs while keeping the more popular vim bindings, and having the same keyboard shortcuts on a graphical emacs editor or on a remote server using vim through a terminal or SSH.
And that’s it, I resolved the big dilemmas/debates of computer users that have existed for years, in only some lines of text. I guess I’m the smartest human being to ever have existed ;).
Just kidding, buf if you feel like something is wrong or just want to discuss this article, feel free to write to my new public inbox [Etiquette] [Archives]