Unorthodox - the act of not orthodoxing
A Wise Man Once Said
A penny saved is a penny earned, a great idiom to live by as we can minimize greed. My siblings and I grew up with the rich parents cheat code, but we are not too swayed by money. We are also trying to raise our kids the same way. Why I would bring this up is a focus on minimalism with coding. On more minimal budgets, a few bytes saved can be the difference between a running project, and a crawling one.
Pass the Source
While not having a formal CV in coding, I do like playing around, coding is no exception. I am fine with any type of coding convention, but I prefer the GNU style as it is easiest to read even without syntax highlight. Modern styles like the ever-changing Google style guide (go one up for the other tech giants) do better with minimizing extra space. There are also exceptions to the rules that require careful indenting like Python, they are only a few, most are fine anyway. Back in the old days (pre-smartphone) I would suggest those wanting to code to try their hands with HTML while practicing CSS and JS as they can easily be tested on even phones. Nowadays there are even some complete compilers and debuggers available, especially those that want to give Termux, their Debian build-essential
, and root repositories a try.
Code editors are also guilty here, as they try and force certain styles, and it is hard to tweak it to our liking. There are very nice tools like language servers and code snippets around, even some backed by AI. Web code editors have taken major steps forward within a short time span, and with better AI around the corner, could outpace traditional editors easily. Nowadays choosing one without a source directory project manager is a challenge. Even web based gits think so too. I have been using Vim for almost 15 years, and my usual setup was akin to SpaceVim until I wanted to become more minimal. At the end of the day, beauty is in the eye of the beholder.
Production Unready
In a released state, I feel it should be a good time to minimize. Few people are going to look into the code, and many compilers strip away the excess weight, but many do not. I agree modern systems can easily tread through without a care in the world, but the penny idiom still hits me. Many projects are going to have different branches to hold different states, so why not have a minimum build for release like most CDNs (content delivery network) do.
There are many plugins for various text editors that do the job well. Google has a very useful JS minimizer called Clojure Compiler, It is also available online. While simple options are easier overall, you can also select the overkill option to also rename everything, obfuscate, and minimize it to the extreme. A great tool to push the release state to. Other languages do not really have a minimizer as capable as Clojure.
Parental Discretion is Advised
I will be using basic HTML as an example since it is the easiest (probably) to understand even for complete beginners. I have also played with owning, hosting, leasing, and admining sites.
As an example; where _
is a tab, 164 - bits - 122:
<section> |<section>
_<div>THIS |_<div>THIS
__<div>THAT |__<div>THAT
___<div>HERE</div> |___<div>HERE</div>
___<div>THERE |___<div>THERE
____<div>EVERYWHERE</div> |____<div>EVERYWHERE</div>
____<div> |____<div>
_____ANYWHERE |_____ANYWHERE
____</div> |</section> <- HEAD SHOT
___</div>
__</div>
_</div>
</section>
We saved 38 bits, where 1 tab is 1 bit, and a new line is 2. In the short term, this may not mean much, but in the long term, the savings can be huge. If we also minimize all tabs to a still human-readable format, we get 100 bits. Remove the lines, and we get a of 92 bits! Imagine if top sites did this, wouldn't the savings reach unspeakable levels? Many site generators tend to be pretty restrictive, and trying to minimize space can be a challenge.
<section> | <section><div>THIS<div>THAT<div>HERE</div><div>THERE<div>EVERYWHERE</div><div>ANYWHERE</section>
<div>THIS | a bit too chaotic
<div>THAT
<div>HERE</div>
<div>THERE
<div>EVERYWHERE</div>
<div>
ANYWHERE
</section>
Modern browsers will work perfectly fine, those from the Y2K era might choke. Those in the 90s might crash and break the PC when given a popup BTW. Text editors and their syntax engines will properly recognize messy codes. Your favorite browser's devtool will also perfectly line them up nicely as source pages, and also automatically close elements. Many sites have also started excluding <head>
and <body>
elements for a while, well, I felt like pushing beyond that. This may not even be trendy as most programmers find this unorthodox. IMHO, it is easier to work with as most of the time, machines are smarter than us.
The Whole Nine Yards
Some may be disgusted at what I am trying to say, but give it some thought. Site hosting costs have gone down over the years, but everything continues to get bigger. There are many cost-cutting alternatives, like using CDNs, or even offloading media elsewhere. Phones are also becoming more PC-like, with specs rivaling mid-tier consumer laptops. 5 years ago, who would had thought of seeing >10GB of RAM and VGA as low-tier?
If a penny could be saved, would you do it? Would you pass that penny to somewhere else? Would the penny be happy?
Top comments (0)