DEV Community

Discussion on: What's wrong with code in 2022? πŸ€·πŸ»β€β™€οΈ

Collapse
 
sleibrock profile image
Steven L • Edited

Modern computers can absolutely waste a ton of CPU and memory, but at the highest levels, the organizations would not care about solving these minor issues. Why does my laptop need 15 gigabytes of RAM to have a spreadsheet, Microsoft Teams and one Chrome tab open? Couldn't tell you. I absolutely hate Windows for how useless it feels. Can't even open Outlook without it spinning up to 100% CPU usage.

But, things aren't always so obvious; software is objectively a challenging problem that requires a lot of well-thought out plans.

For instance: how do you write one project and compile it to work on other people's computers? If you were still writing C, you would have to write a C codebase and use a compiler to support a given architecture and hope the operating system can run your code. Then you have to test it and all that other fun stuff.

But then suddenly, you need to target an entirely different platform that you've never seen before with a different compiler. Suddenly your C code doesn't work, because the platform is different; compiler types are of different sizes, the endianness is a different direction, certain standard library functions don't exist or take different parameters, and now you're stuck writing C preprocessor macros hoping that your pains go away.

This was what coding was like in the awful days, and it can still exist too if you write C/C++. No compiler will make you happy. Everyone either acknowledged C/C++ was awful and moved onto other things during this time period, or simply stuck behind and said "this isn't so bad guys" as they wrote high performance software dealing with the issues that C/C++ brings. Java won a lot of fans because it was very portable with it's "write once, run anywhere" mantra, while C++ is still hated to this day by many.

With Java came other languages that offered more dynamic and flexible programming, like Python and Ruby, which most people scoffed at when thinking about building full-fledged software in. The performance metrics of these two languages aren't great, but sometimes people write Python/Ruby code that can interop with C-world and get decent performance. Fast forward one or two decades and now we have insane machine learning libraries that you can use with Python and are used at Fortune 500 companies.

The web is popular, but golly does it suck to write things for it. HTML pages aren't dynamic, so you need a language to be able to create dynamic pages that can retrieve information from database, so in comes PHP, which sells itself as a solution to a problem web devs were having with FastCGI and Perl. PHP proved itself as an okay solution, and somehow companies around the world threw their million-dollar industries at it and it got us decently far. But the browser was the real pain in the butt, so in came JavaScript, and JavaScript took off to the moon.

Where am I getting with all this? I'm mostly stating that things that alleviate headaches from the programmers are far more popular than things that don't. Writing and maintaining separate language codebases with different purposes is not necessarily better to some people who would prefer to have a "monolithic" repository of code that can do everything and not make things complex. JavaScript can now control the front end, the back end, it can be used to design games, GUI applications, and so much more without ever having to leave the comfort of the JavaScript language itself.

Facebook, Google, Apple and all the other tech companies are the foremost "leaders" of the technical world, and when Facebook publishes a library called "React" where the goal is to make the web easier to develop, what happens? Everyone's going to write React. Google makes Go and uses Go? Go devs will pop up in random places. Increasing your surface vector of being a potential hire at a Fortune 500 is a very promising idea for many aspiring programmers.

But this doesn't mean everything will appear pretty at the bottom of the totem pole. Organizationally, no one gets promoted for fixing memory leaks. Sometimes I have to close my Discord because it leaks memory after several hours and gets slow. Is anyone going to fix it at Discord? No, because it's an Electron problem (probably), and Discord isn't there to fix Electron problems, they're around to fix Discord problems.

YouTube, a site owned and ran by Google, has to polyfill in a ton of extra JavaScript for non-Chrome browsers, making the performance of YouTube on non-Chrome browsers not all that great. Google runs and upgrades Chrome with non-standard libraries so they can move fast, and in turn, makes other browsers perform worse on their sites. I can admit that sometimes other browsers are very slow at upgrading their features (Firefox), but it's not likely that Google will care about the non-Google browsers, as Chrome is included in every single Android device, and is renowned for being the most popular browser on the internet. Why? Probably because it's a Google browser lol, remember that part about everyone using React?

So in summation, we live in a society where poorly-built software is so common-place that people have to upgrade computers to go on Facebook of all things. The lowest common denominators of computer hardware are not the targets of big business, and probably never will be all that important. Our ten-year old laptops are deemed unimportant, and everyone is expected to upgrade their smartphone every two years. Why? Probably because nobody wants to write fast software made with slow phones in mind!

/rant

Collapse
 
mariamarsh profile image
Maria 🍦 Marshmallow

We can assemble a separate blog on this topic from the comments under my post haha 🀣
With each new comment some new information is added and it's really cool πŸ‘
Thanks for sharing your thoughts 🀩

Collapse
 
ddotfdot profile image
D.F.

@sleibrock This is valuable insight, you really show how complicated and ugly things get and fast... and it's true, our world of software and technology is a mess and you really bring clarity to a messy topic

But to talk to @mariamarsh real quick, there's a couple things I want to point out:

  1. I assume you wrote this in reference to Windows computers. Windows is my background and it's honestly a frustrating and messy OS, for many reasons I won't get into. It's not Linux, and Definitely not the prime pick to run containers in. But, it is an extremely complicated software platform where I've touched things I didn't even know existed that affect things I didn't even know X component could. However, since windows 7, they've much improved their act and it's a much more reliable platform.

  2. Where are you getting your 99.9% figure from? How do you calculate resource waste? Is this in regards to software that runs on windows, or you talking about the OS itself? Or both?

  3. I don't think, necessarily, file-size is the End-All, Be-All indicator of resource-usage/waste. For example, compare the file size between the exact same .csv and .xlsx(Excel) file, which one is smaller? File compression, and other factors play into this.

  4. Libraries. Yes, There are built-in libraries in the OS, but that's not the end of the story. What about different Versions of the same library/software? I think it was Windows xp where you had to download different versions of .Net and .Net components for every piece of software. But the same thing applies to every language and dependency version.

Version mismatch and Dependency Hell are very real things that cause issues, from personal to corporate environments to this day. All software is built on software before it, and once you dive deep into what dependencies everything is built on, you'll never reach the bottom. Do you remember how one developer removed left-pad from NPM and broke the internet? That's the situation we are in with all of our software on any operating system. This is a joke tweet, but also, so very true:

"the most consequential figures in the tech world are half guys like steve jobs and bill gates and half some guy named ronald who maintains a unix tool called 'runk' which stands for Ronald's Universal Number Kounter and handles all math for every machine on earth" - twitter.com/6thgrade4ever/status/1...

  1. The last thing is, if you are upset with windows, try linux if you can(There's some software that cannot be ported easily or doesn't have an equivalent counter-part). There's never been a better time to run linux on desktop, or headless, or on ARM devices. It definitely outperforms Windows In regard to Resource-Management.
Collapse
 
mariamarsh profile image
Maria 🍦 Marshmallow

This is a big problem with any modern operating system, whether it's Linux or Windows.
XUbuntu eats up 500-800 MB just after startup, and it needs 1.5-2 GB for some significant work. Win2K startuped and ran with128MB, WinXP with 256. Well, that's not entirely fair, because they were 32-bit: just to CALL to the full address, we need a 64-bit address, but XUbuntu has a difference even with WinXP by 8 times. In fairness, a workstation on Linux still doesn’t eat up more than the conventional 1-2 GB after startup, but Win10 / 11 can easily eats 2-3.

On Linux, all problems manifest themselves in exactly the same way, just try to build any open source project, it will immediately pull billions of the same open source libraries to itself. And many of them are needed only for the sake of one or two functions.
If it were not for the SSD, the available RAM, and the hardware instructions in the processors and their multithreading, the operation of computers running any modern OS would be a sad sight.

The main resources are eaten not by a bare machine, but by applications on it. Websites are almost entirely crap code, and one page "weighs" a hundred megabytes. This needs to be optimized on the server side, otherwise nothing. IDEA, VSCode and a bunch of other applications eat about the same (a lot) almost regardless of the OS. Another example for you is Jetbrains Toolbox, a little application for downloading and updating the IDE. It eats up 200-500 MB of RAM. What? How? Why?

Dependency hell can also exist in linux, I would not put 2 different versions of openssl, or libjpeg without "dances with tambourines". Look at the NPM and Composer dependencies of any site. Previously, jQuery was enough of all JS, but what about now? NPM folder can easily reach several gigabytes, and then from too many files the collector will fail and fall, great!

What about 99.9%, maybe I'm exaggerating, but the absolutely irrational loss of resources applies to both software and OS.

Thank you for your questions πŸ€—
I also advise you to read the comments of other users, there are a lot of interesting thoughts and opinions 🌈

Thread Thread
 
ddotfdot profile image
D.F.

"If it were not for the SSD, the available RAM, and the hardware instructions in the processors and their multi-threading, the operation of computers running any modern OS would be a sad sight." Well, yes, things are written for the current hardware standards of the day. People(developers, commuters, pedestrians) will "fill the space" of where they are. People naturally use the tools at their fingertips.

Nothing you've described is particularly new to me, but it feels like you are just describing the state of software in 2022. So, since I'm not sure what you are comparing everything to, I have to ask:

  1. What do you think the state of software should look like?
  2. What does good resource management look like to you, both from an OS perspective and a software perspective?
  3. What do you think are reasonable specs for computers(cpu, ram, HDD space, etc)?

P.S. - Linux Dependency hell is particularly frustrating because if you try to update your packages, and one of those packages was installed by pip / is dependent on something installed by pip, the package manager could fail to update anything.

Thread Thread
 
mariamarsh profile image
Maria 🍦 Marshmallow • Edited

It feels like you are a very curious young man 😏
$500 and we'll face you in a 1v1 Discord battle to see who wins, the Dark Side or the Light Side πŸ”΄βš”οΈπŸ’šYou will be in the role of Darth Vader πŸ‘Ύ
But I have a condition: I will take my father Chewbacca with me 🀣

Thread Thread
 
sleibrock profile image
Steven L

Some of these conversations can be tagged under the "static linking versus dynamic linking" category and others probably file under "software bloat". What do you think your approach to application development is with respect to static/dynamic linking? Ship with deps, or ship targeting deps on a host environment?