Brilliant Hardware in the Valley of the Software Slump
&gt; Something strange is happening in the world of software: It’s slowly getting worse. Not all software, but a lot of it. It’s becoming more sluggish, less responsive, and subtly less reliable than it was a few years ago.<p>&gt; What baffles about these software moans is that Apple’s hardware is ever-more refined. While far from flawless, the entire lineup is now (finally) largely free from these “foundational” issues you see in software.<p>The answer to this is very simple (at some level):  It is impossible to produce mechanical designs that are the equivalent of the software engineering abominations the world is stuck with today.<p>Going back to iPhone 3 days, I remember coding a genetic solver in Objective-C that was an absolute dog.  I optimized as much as I could and could only squeeze so much performance out of it.<p>I finally gave up and re-coded the entire thing in clean C++.  The code was somewhere in the order of 290 times faster.  Objective-C was an absolute dog because, at a minimum, every data type you had to use was an object oriented mess.  This was absolutely unnecessary, the proof of it being that my C++ equivalent performed exactly the same function and lacked nothing.  In fact, it was so fast that it allowed the use of this genetic solver in real time in the context of this app.  Objective-C, er, objectively speaking, had no reason to exist.  Yet, it did, and lots of people believed it had to exist and likely many do today.  They are wrong.<p>Another way to look at this is that the clean solution used somewhere in the order of 200~300 times less energy.  This is something hardware engineers are keenly aware of.  Software consumes energy and badly written software is even worse.  Think of it this way:  A bit transition costs energy.  Inefficient code requires more bit transitions per unit time, therefore, more energy and more power dissipation.<p>Imagine the mechanical engineering equivalent.  Some monstrosity where, instead of using a simple screw and a nut one ends up using a complex fastener that has layers upon layers of mechanisms and unnecessary complexity.  A screw with the ability to grow and shrink to any length and diameter, including all the wrenches, tools, nuts, washers and devices needed to install, tighten and test them.  Very quickly a simple product that could mechanically fit in the palm of your hand would quickly become the size of a car.<p>And so, in this way, mechanical and industrial design is always &quot;low level&quot;, like always coding in assembler (not proposing we do that).  Sure, materials and manufacturing techniques improve, yet, at the most fundamental level, excellent mechanical and industrial design is clean, uncomplicated, easy to understand and easy to manufacture.  It&#x27;s machine language, or C.  Not Objective-C.<p>Software engineers who are not exposed to this reality, through no fault of their own, are not aware of these issues.  I don&#x27;t blame them.  If most of what someone sees in school amounts to Python, their view of reality will be skewed.<p>My son is studying Computer Science at one of our top universities and has less than a year to graduate.  He is home now for both the summer and due to the virus.  I&#x27;ve been working on several embedded projects and showed him a few tricks to improve performance.  He was amazed to see how you could optimize code for execution speed (with sometimes dramatic results) by making simple high level choices.  For example, a down counter in a &quot;for&quot; loop (&quot;i=10; i!=0; i--&quot;) is generally faster than the typical up-counter: &quot;i=0; i&lt;10; i++&quot;.  This is due to the fact that processors have instructions like &quot;DJZ&quot; or &quot;DJNZ&quot; (Decrement and Jump if Zero &#x2F; Decrement and Jump if Not Zero) that don&#x27;t require loading a comparison value and engaging the ALU and sometimes even fetching that value over and over again from memory.<p>Software engineering doesn&#x27;t have the same physical constraints found in mechanical engineering unless someone is coding for an application and a domain where excess really matters.  One example of this is writing code for space hardware, where, aside from reliability, you have to be aware of the fact that every bit you are flipping will cost a quantum of energy and you might not have enough to be careless about it.  Energy quickly translates to mass in the form of large cooling radiating surfaces that must be launched into space along with the hardware.<p>It&#x27;s an interesting problem this issue of bad or bloated software.  Not sure if there&#x27;s a solution.  There won&#x27;t be until there&#x27;s a forcing function that requires a change in perspective and approach.<p>EDIT:  
To be clear, my point isn&#x27;t to pick on a specific language or languages but rather than use easy examples to highlight one of the problems that has been building up since the introduction of object-oriented programming.  I remember the early days of OO.  It was a mess.  Much like the early days of desktop publishing where people loaded-up documents with every font they could find.