DEV Community

Justin G
Justin G

Posted on

"It works on my machine"

We've all heard this saying before.

We've all seen the memes.

Maybe we've actually said this before in our day to day work when someone says something isn't working on their machine.

There are a lot of variables that could potentially go unaccounted for when a developing a feature. Different OSes. Different versions of the same OS. Different browsers. Different CPU architectures.

It could even boil down to developing a layout for a webpage that looks great on a 27" or 32" monitor, but doesn't scale properly on a smaller laptop screen or when someone splits their 27" monitor to display multiple web pages at once (I mean who even works that way...). That cool little sidebar you developed doesn't always work on every screen size (seriously, stop with the sidebars on web pages that can't be scaled or hidden).

Backend services aren't without their own potential gotchas either. Apple has done a great job providing laptop hardware on their own processors. These M series chips are quite performant. However, the code you develop isn't being run on M series chips in the cloud. Your code will most likely run on some x86-64 based servers. Are those servers as performant as the developer laptops the company is buying everyone? Most likely not, or at least not without paying a premium to your cloud service provider.

One of my tales of "It works on my machine" comes from a time where I was looking through a code base that dealt with hashing user passwords, and I noticed the code was using a deprecated hashing algorithm. Did some research on what algorithm to update to along with reasonable amount of how long hashing a password should take. Made the updates. Tested it on my developer laptop, and everything was looking good to move to the test environment running in the cloud. Pushed the code up, verified it was running, changed my user account password to ensure the new password was stored with the updated hashing, and logged in.

Well..that wasn't nearly as performant as on my development laptop. Turned on telemetry, did another login, and sure enough, it was 10x slower in the test environment as compared to my laptop. Doing some digging, I soon learned the current testing environment was running on servers that were over a decade old, you know, for cost reasons. Even checking the servers that backed the production instance, the update I was developing would be 2x slower compared to my laptop.

So while it may work on your machine, your machine is not where that code will end up running for years on end.

Top comments (0)