Understanding Hardware Makes You Better at Developing Software
Published: 2021-04-27 01:16:46

For most of us, a computer is an unknowable black box. We type in our social media statuses, our youtube searches and our recipe ideas and voila! It just works. Almost like magic.

Even we, the up and coming software devs of the world, will often know how *our code* works(maybe that's a little generous), but not much beyond that. We will build it, test it for bugs, and hit "run" when it is finished without a second thought, completely oblivious to what the funny little magic box is doing behind the scenes. 

![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bwamnga8yznipue9idps.png)

But it doesn't have to be this way. You don't need a STEM degree to understand the fundamentals of computer hardware, and taking the time to do so can actually make you a *better* software dev. With that in mind, let's go over the basic components of any computer, how they work, and a few real world examples that demonstrate how hardware effects the way users interact with our applications. 

There are seven primary parts of any computer: the CPU(central processing unit), which acts like the brain of the machine, the GPU (graphics processing unit), which serves to handle any heavy video rendering, the RAM(random access memory), which provides our applications a place to store things temporarily in memory, a SSD(solid state drive) or hard-drive, which is used to store data in the long term, a network card, which serves to connect our machine to the outside world, the motherboard, which is a place to put everything so it can communicate with each other, and last but not least, a power supply, to make sure it all gets the electricity it needs. 

![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gw7583monp1bz68mnpra.png)
 
Not all hardware components are made equal, however. 

Not every computer has or even needs a GPU. A gamer playing any modern AAA game will need a pretty substantial GPU to even get past the main menu. But your dad running excel for his small business probably won't need something so dramatic. Most mid-tier laptops and phones comes with a duel CPU/GPU chip, referred to as *integrated graphics* in the industry.  

Like the GPU, the network card, depending on your use case, is optional. If you don't need your machine to be connected to the internet at all (an admittedly rare phenomena these days) then paying for a network card is basically money wasted. Most motherboards come with a network card built in anyways these days, so don't sweat it too much if you're in the market. 

Which leaves us with only the bare essentials: CPU, RAM, motherboard, power supply and storage. These are the basic necessities of any modern computer. I can guarantee with about 99% certainty that whatever you are reading this blog with has at least these five basic parts, phones included.

![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b9onbk3156u58i2pha04.png) 
  
Seeing what is necessary to the machine can help us understand what is happening under the hood when users are breaking our programs. For example, if several users have all experienced laggy loading times on your site you can probably safely assume that it's a RAM or CPU issue on their end. 

Maybe they have and ungodly amount of tabs open in chrome, or maybe they only have 2gbs of ram on a PC from ten years ago. No matter what the hardware issue might be, we can mitigate it (but not complete eliminate it) by taking some processes off the front end and moving them to the server side, insuring that all users, good PCs or not, get roughly the same experience and performance.  

Unless it's a network issue on the user's side, which means it's completely out of our hands. You did everything you can. RIP. 

Even if you aren't a PC user, knowing what kind of hardware your mac users are running can still make a world of difference when you are designing software for them to use, especially with the recent launch of apple's proprietary chip, the M1. 

For a bit of background, apple has historically had partnerships with companies like intel to outsource their CPU's, that is until last fall when they sent shockwaves through the hardware world with apple silicon. Because they design the software and the hardware, apple is able to pack a big punch in a small package with the M1. I won't get too far into it here, because we will be here all night, but essentially they have streamlined the way your cpu, ram and motherboard all interact with each other to make one of the best performing chips of all time. 

![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/f113ekzfd4po5dtecqej.png) 

A brand new 700$ mac mini with a mere 8 gigs of ram can edit 8k video with little to no lag(with propiertary software), switch between multiple processes in a breeze and even render full scenes in blender better than a PC machine worth twice as much. 

But you know what the M1's can't do? Play most modern video games. Or run any application in the adobe suite with reliable speed. In fact, theres a whole [host](https://9to5mac.com/2020/11/24/check-m1-compatibility-for-mac-apps/) of things the M1 can't do because with lightning fast proprietary hardware comes the limitations of a closed environment. 

Yes, there are things like [rosetta](https://support.apple.com/en-us/HT211861) that can emulate environments for most non native M1 programs, but with it comes a lot of potential performance left at the door. 

My larger point is simple: the hardware your client is running often determines the performance of the software. By understanding this and a few extra principles, you can better prepare for when they try and break your applications.