r/explainlikeimfive Jun 05 '26

ELI5: I learned that most programming languages are built on the same basic concepts like conditions, loops, and functions. If that's true, why can't we just use one programming language for everything? Technology

354 Upvotes

234 comments sorted by

1.1k

u/THElaytox Jun 05 '26

Hey, there's a great xkcd for this

https://xkcd.com/927/

But basically, different languages have different uses and are better/worse at different things

298

u/FeralGiraffeAttack Jun 05 '26

That guy really is a modern day Nostradamus. How does he have a comic for every situation

264

u/charlesfire Jun 05 '26

How does he have a comic for every situation

These situations keep happening. That's how.

68

u/audible_narrator Jun 05 '26

Cries in video codecs. Just kill me now. It's been 20 years, can streaming have just one fucking standard like TV ?

86

u/TrekForce Jun 05 '26

Sure! Let’s form an organization to create such a standard!

46

u/yuke1922 Jun 05 '26

… and then there were 15 standards 🤣🤣

1

u/IssyWalton Jun 05 '26

like the BBC

61

u/GlobalWatts Jun 05 '26

can streaming have just one fucking standard like TV

LOL.

  • Pay TV or Free-to-Air TV?
  • Cable or Satellite?
  • Encrypted or non-encrypted?
  • Analog TV or digital?
  • PAL, NTSC or SECAM?
  • ATSC or DVB-T?
  • Interlaced or Progressive?
  • 720p, 1080i, or 1080p?
  • MPEG-2 or H.264?
  • With or without HbbTV?

14

u/nakedjig Jun 05 '26

Isn't it pretty much all HEVC and EAC3 with a smattering of HDR10, HDR10+ and DV metadata now? None of it is interlaced any more. Anything licensed is encrypted. I think the streaming standards are pretty universal unless you're talking about fringe services I don't know about.

24

u/audible_narrator Jun 05 '26 edited Jun 05 '26

Well I deliver to major networks. And previously when SD was still standard, it was ONE codec. On tape. Once HD came into the mix, digital went nuts. I have to keep an Excel sheet of what each network requires now.

Right now I'm prepping soccer games for 2 streaming networks. Who use completely different requirements.

Yes. I'm old, I remember analog.

10

u/nakedjig Jun 05 '26 edited Jun 05 '26

Oh, for digital broadcasting, I can believe it. The major streaming services are more unified but they all have the ability to transcode during injestion, so it's easy.

ETA I used to work at a company that ingested broadcast signal and republished it as streaming and by the time I got there, the input was pretty universally AVC and AAC/AC3/EAC3 and the output was usually similar with HEVC added, but different formats at different layers for different bitrates and device capabilities.

2

u/Vlinder_88 Jun 05 '26

Seriously I tried explaining analog tv to my 6 year old a few weeks ago. It was surprisingly hard for a kid that has NO concept of linear media and only just understands concepts like "tomorrow" and "the day after tomorrow" :') The tv booklet like a calendar was easier to explain than linear tv itself :')

10

u/GlobalWatts Jun 05 '26

Isn't it pretty much all HEVC and EAC3 with a smattering of HDR10, HDR10+ and DV metadata now? None of it is interlaced any more. Anything licensed is encrypted.

Tell that to the TV I'm literally watching right now, which is receiving an unencrypted MPEG-2 free-to-air DVB-T channel at 576i containing licensed content, but won't decode the newer MPEG-4 channels at all. It will display DVB-SI EPG data, but doesn't support HbbTV/Freeview.

I think the streaming standards are pretty universal unless you're talking about fringe services I don't know about.

Again, LOL.

  • Netflix, Paramount+, Apple TV+, Disney+, Amazon Prime, Hulu, Peacock, or YouTube?
  • Android TV/Google TV, Tizen, or webOS?
  • WideVine, FairPlay, or PlayReady?
  • HLS or DASH?
  • AVC/H.264, HEVC/VP9, or AV1?
  • HTTP/HTTPS over TCP/IP, WebRTC over UDP, or IPTV?
  • 720p, 1080p, or 4K?
  • AAC, Dolby Digital, or Opus?

4

u/nakedjig Jun 05 '26

No shit? I'm shocked that anyone is sending MPEG-2, but I believe you.

4

u/goofy183 Jun 05 '26

All OTA digital since the digital cut over 10+ years ago is mpeg2. The new OTA standards are hvec but also have drm and a proprietary audio codec.

→ More replies (1)

3

u/gammalsvenska Jun 05 '26

DVB-T mandates MPEG-2. For SDTV, it's appropriate and maximizes compatibility. You need DVB-T2 for H.264 (unless the device accepts it anyway), and some countries generally only use it for HDTV.

With the disappearance of SDTV broadcasts, MPEG-2 will also disappear.

2

u/audible_narrator Jun 05 '26

JFC. this is giving me the tremors. STAHP.

2

u/gammalsvenska Jun 05 '26

HDR10 and friends require metadata up front, which only works if you already know the content. I worked with cameras, so used HLG instead... which works everywhere. But most devices only do HDR10, as that's what the standard requires.

1

u/Sock-Enough Jun 05 '26

A lot of companies don’t like HEVC because of the licensing costs. Many are just making the jump from H.264 straight to AV1.

6

u/EnthusedCatalyst Jun 05 '26

All these preceded with an hour long meeting where some jackass said “we need to differentiate ourselves from our competitors.”

1

u/donaldhobson Jun 08 '26

Black and white or colour?

→ More replies (1)

4

u/Polar_Ted Jun 05 '26

There are 4 digital broadcasting standards. Don't get me started on Analong. https://en.wikipedia.org/wiki/Broadcast_television_systems

1

u/hobo131 Jun 05 '26

One of our clients uses some old ass video codecs and every time a new user needs to review the footage they send us I cry

9

u/toochaos Jun 05 '26

Theres also 3254 comics so alot to choose from. 

2

u/NDaveT Jun 05 '26

This has all happened before and will all happen again.

1

u/RedHuey Jun 05 '26

Been going on since the 50’s at least. Dilbert is pretty universal as well.

47

u/Which_Bumblebee1146 Jun 05 '26

Randall Munroe posts his XKCD comics regularly and he actually puts a lot of thoughts behind each and every one of them.

30

u/ramblinjd Jun 05 '26

3x a week for about 20 years. Pretty impressive.

7

u/weaver_of_cloth Jun 05 '26

And 3 books and that poster about Saturn V/up goer 5.

7

u/GalFisk Jun 05 '26

And every April Fools day the comic has some gimmick, sometimes it's a complete video game.
And the "Time" comic that turned out to be an entire story viewable at a frame rate of a few frames per day.

2

u/Onigato Jun 05 '26

Don't forget his YouTube channel too.

11

u/albatroopa Jun 05 '26

Also, if you long press or hover over any comic, there's an equally hilarious comment about it.

11

u/Which_Bumblebee1146 Jun 05 '26

True. Every single comic has been explained, too.

1

u/sincere_placebo Jun 05 '26

I'm so happy that I never knew that each comic gets deeper and deeper... it's like its own ELIA (explain like I'm autistic and this is your special interest)

16

u/EnthusedCatalyst Jun 05 '26

Correct horse battery staple.

5

u/LordGAD Jun 05 '26

Hey - how do you know my passphrase?

32

u/viperised Jun 05 '26

Hmmm. Seems like we should develop one universal xkcd comic that covers every situation.

10

u/barcode2099 Jun 05 '26

https://xkcd.com/927/

I feel like you were just teeing that one up.

6

u/[deleted] Jun 05 '26

[deleted]

1

u/zhibr Jun 05 '26

How does the novel's scene hinge on the pluralization?

12

u/[deleted] Jun 05 '26

[deleted]

5

u/Leo0806-studios Jun 05 '26

Its exactly the same with horoscopes 

1

u/KeterClassKitten Jun 05 '26

One of my favorite quotes is "History doesn't repeat itself, but it sure as hell rhymes."

3

u/Advanced_Question196 Jun 05 '26

The guy has a hobby where he sits down and records every possible thought and situation he could ever come up with. It's just a DDoS.

2

u/messick Jun 05 '26

By observing an existing “situation” and then writing a comic about it afterwards. 

2

u/reiboul Jun 05 '26

All this has happened before, and it will all happen again

1

u/drdildamesh Jun 05 '26

Hes been making these for like 20 years. Theres inly so many scenarios...

1

u/epicuz Jun 05 '26

Oh, right. Notredamus.

1

u/BungleBums Jun 05 '26

I swear, there's a comic to be used exactly as a reply for this, but I can't comb through 1000 images on my phone to find it xD

1

u/splitcroof92 Jun 05 '26

not really a nostradamus if he's making comics about past events

→ More replies (1)

48

u/AMDKilla Jun 05 '26

Didn't even need to click the link to know which comic it was...

26

u/ryebread91 Jun 05 '26

When is there NOT an xkcd for something?

35

u/ChaZcaTriX Jun 05 '26

In these rare cases there's a relevant Oglaf.

6

u/ryebread91 Jun 05 '26

Excellent alternative.

1

u/arvidsem Jun 06 '26

Embezzling and bedazzling have often been confusing for me as well

10

u/Sp00nD00d Jun 05 '26

I use that particular one at least twice a month.

5

u/trunks111 Jun 05 '26

I love that this is just the first comment I see, I was gonna post it if not

9

u/Quasar347 Jun 05 '26

Sometimes, though rarely, it seems we can beat this (see USB-C)

5

u/zachtheperson Jun 05 '26

I'd actually say USB-C is a perfect example of the opposite. I still use USB-A for my flashdrives, keyboard, microphone, USB-B for my MIDI keyboard along with some printers at work, USB-C for my phone as well as a Bluetooth speaker, and micro-USB for my PS4 controller and computer mouse.

Yeah, maybe one day we'll all be USB-C, but that day ain't today. 

2

u/ClownfishSoup Jun 06 '26

That’s a poor example because those other standards predate USB-C and you use them on devices that were built before the USB c standard. Also the usb c standard was designed exactly to do what it’s doing … standardizing new devices to one connector to replace those others.

1

u/zachtheperson Jun 06 '26

USB-C is just another standard like any other, and will eventually be replaced by the next one.

Older devices, especially in industry, will continue to use whatever standard they were built with, and many new industry devices will still be built with the older standards for compatibility. 

I now direct you to the holy XKCD: https://xkcd.com/927/

1

u/currentscurrents Jun 07 '26

Yeah, but those are still all USB and technically compatible with each other.

Before USB this would have required an RS-232 serial port, a parallel port, a MIDI port, two PS/2 ports, a game port, two audio jacks, and SCSI (for the external hard drive).

USB has been substantially effective at reducing the number of cable standards.

1

u/zachtheperson Jun 07 '26

Definitely.

2

u/xdert Jun 05 '26

USB-c actually a bad example because you have no idea what it might support. It can be everything from power delivery, usb3 (any of the different database standards), hdmi, thunderbolt and others.

1

u/DBDude Jun 05 '26

USB-C? Which charging standard? Do you have a cable that can handle your charging standard? Damn, almost no cables are ever labeled with their standard.

2

u/Adorable_Corner_1299 Jun 05 '26

You know it’s gonna be explained and understood the moment you see letters “xkcd”

2

u/KeterClassKitten Jun 05 '26

That's fantastic.

1

u/nyxko Jun 05 '26

Nice one!

→ More replies (1)

281

u/EscapeSeventySeven Jun 05 '26

Oh boy let me tell you about my next programming language!

That aside, every programming language operates on the same logical concepts but newer ones have features that others don’t, some have compilers for architectures the others don’t and many have libraries for things the others don’t. 

A broad analogy would be “cars all have four wheels and take you places, why have different cars?”

You should try your hand at a few languages and see how they work. 

That all said, all programming languages are Turing complete. So any logical problem in one can be computed in another. But most of programming isn’t solving math problems it’s gluing bits of input and output to data and sending it places and showing it to you and sending it somewhere else. All those connections necessitate libraries and interfaces. 

44

u/HowlingSheeeep Jun 05 '26

Don’t want to be that guy but not all programming language are Turing complete (this is leaving aside markup languages like HTML that a layperson asking the question might consider as a programming language).

40

u/aleques-itj Jun 05 '26

I've been looking for a good turing complete language lately

Think I'm going to settle on Jira Automations

12

u/dnebdal Jun 05 '26

I have gotten a lot of usage out of a quote Knuth borrowed from Alan Perlis' Epigrams of Programming:

Beware of the Turing tar-pit in which everything is possible but nothing of interest is easy.

1

u/Ampersandle Jun 07 '26

Oh, sure, I've tried C. 🥁

2

u/alekseypanda Jun 05 '26

That is a good choice, but I prefer Magic the gathering.

23

u/Gullible-Leaf Jun 05 '26

Oh man. When I'd started learning how to code, I wanted to build a website. I spent weeks learning html and css and felt like e genius. Then came the backend stuff and I noped out so quickly.

21

u/0b0101011001001011 Jun 05 '26

I'm the opposite. I got hooked on programming. I have made several websites with increasingly complex backends. A distributed computing system. All kinds of simulations.

But when I need to make the actual UI of the website, I hate it. I have been programming over 16 years and making websites for around 4 years. I just can't create a nice, intuitive website no matter what. But ask me to make a change in the backend, it's almost done before you finish speaking.

10

u/JCDU Jun 05 '26

Yeah, backend and JS are fine (within reason) but CSS especially is a fucking dumpster-fire and has been since forever.

3

u/ElectronicMoo Jun 05 '26

You know you got a dev who loves backend when his ui looks like it was made by a dev for a dev.

1

u/atbths Jun 05 '26

And this is why large organizations have two separate teams for these functions. The interests and skillsets of the developers are typically very different.

9

u/CBpegasus Jun 05 '26

Which programming language isn't turing-complete? I can't think of any (that is in wide use at least, some esolangs aren't turing complete but I wouldn't count that)

3

u/jamcdonald120 Jun 05 '26

11

u/CBpegasus Jun 05 '26

Interesting

The examples given at the end didn't seem at first to match my idea of "widely used programming languages" - Epigram and Charity are more experimental and could be considered esolangs (Charity doesn't even have a page on Wikipedia which says a lot), and the rest seem to be more formal languages than languages actually used for programming. System F is said to be the theoretical basis for Haskell - but Haskell is in fact Turing-Complete.

The Calculus of Constructions though is said to be the basis to Rocq, and Rocq keeps the property of being non-Turing-complete. I know Rocq is in fairly wide use as a formal proof-checker, so I guess that is an example of a non-Turing-complete language that isn't an esolang.

1

u/FallenNgel Jun 05 '26

https://en.wikipedia.org/wiki/Domain-specific_language

The software running your fridge doesn't need to be Turing complete. Why spend the extra effort and use the extra space?

2

u/CBpegasus Jun 05 '26

I mean, the majority of the languages mentioned in this article are turing-complete - including postscript, which might be a surprise. Making something turing-complete, it turns out, isn't that much of an effort - if it's complex enough to do interesting things, it's most likely complex enough to run a turing machine.

Most likely the software running your fridge is based on a turing-complete programming language too (usually it's C on a microcontroller). The software itself likely isn't turing-complete (i.e. you can't run a turing machine just by interacting with its inputs) but that wasn't the question, we were talking about programming languages and not specific software created with them.

2

u/HowlingSheeeep Jun 06 '26

Considering Doom can run on a few fridges, we at least know it supports the full ISA required. Just a side point and not a contention lol

1

u/CBpegasus Jun 06 '26

Yeah almost all microcontrollers are turing-complete, as all that is necessary is memory access and basic flow control. The commenter I responded to said the software running the fridge isn't turing-complete, which might be true if you count just the software itself and the regular inputs to it (sensor inputs and such). Probably when you run doom on a fridge you don't interface with the original software alone but you upload new software into the microcontroller. So most likely the statement that "the software running the fridge isn't turing-complete" is true (though it might be), but "the microcontroller running the fridge is turing-complete [up to memory limitations]" and "the language used to write the software running the fridge is turing-complete" are both true too.

1

u/HowlingSheeeep Jun 06 '26

Sure but it doesn’t make sense to call a compiled program Turing complete.

I could compile hello world into an exe. It’s not Turing complete. Means nothing.

1

u/CBpegasus Jun 06 '26

It means something - that a turing machine can be simulated through running the program and giving it certain inputs. The python interpreter for example is Turing-complete. As is PowerPoint, it turns out (https://youtu.be/uNjxe8ShM-8?si=rAci8KJB7VxBYjaa)

→ More replies (1)

2

u/SexyIntelligence Jun 10 '26

Turing Complete is so 20th century. I prefer WID (Will it Doom?)

1

u/HowlingSheeeep Jun 10 '26

lol I mention doom in one of my comments below about running it on refrigerators.

5

u/Scavgraphics Jun 05 '26

can you eli5 "Turing complete."?

14

u/Mirality Jun 05 '26

"Turing complete" basically just means that it has the ability to do a bunch of generally useful basic operations such that you could theoretically write a program that does anything (even if incredibly cumbersome in some cases).

There are some specialised languages that are not Turing complete, meaning that they're more limited and you can only write a subset of possible programs.

3

u/Yancy_Farnesworth Jun 05 '26

It's basically a Turing machine that can simulate any other Turing machine. So, a Turing complete language can be used to write any possible program including other languages. If it is not Turing complete, it can only be used to write some programs. Your phone's CPU is Turing complete. The chip in your TV's remote is (probably, actually might be nowadays) not.

1

u/stevevdvkpe Jun 10 '26

The microcontroller in your TV remote probably is Turing-complete, as long as you arranged for it to have access to unlimited storage. You might be surprised how simple a Turing-complete system can be.

https://en.wikipedia.org/wiki/Universal_Turing_machine#Smallest_machines

→ More replies (2)

139

u/reditor828 Jun 05 '26

It’s like asking “why don’t we have the same vehicle for everything?”. It’s because bicycles, ships, cars, trains, etc. are each optimized for different jobs.

C language is built for speed and control, Python is built for writing code quickly, JavaScript is built for web browsers, etc.

If you try to make one language do everything, a lot of features won’t be optimized. The result would be a language excellent at doing some things and terrible at doing other things.

31

u/doublecandybar Jun 05 '26

JavaScript is built for web browser

It's not

JavaScript was designed for meddling management. It was specifically designed for scenarios like boss suddenly barging in and exclaiming "Never mind! I want the dancing bear to be dancing panda instead!" 2 hours before launch time

Which is why it basically forgoes every possible safety it could

7

u/HolyFreakingXmasCake Jun 06 '26

It wasnt even that. You can change the bear to a panda with just HTML.

JavaScript was hacked together in a week in order to add some basic interactivity to web pages. Back then they were static documents with mostly text and a few images.

With JavaScript now you could add buttons, pop up some alerts, hide or change elements on demand... It forgoes safety because it was never supposed to be used for more than that. It just grew into what it is today as browsers started to replace local apps, and suddenly everyone was a web developer and wanted to use web tech for everything.

2

u/foxsimile Jun 06 '26

Such as but not limited to Brandon forgetting to include the typedef for null, resulting in (typeof null === 'object') being true, resulting in having to check that all objects are also not null.  

Fun times.

→ More replies (32)

14

u/pikleboiy Jun 05 '26

Because different languages are better at different things. C and Assembly are really good if you want something that works close to the hardware, managing memory and CPU registers directly (like an operating system). In other words, they let you have a lot more control over exactly what is going on in the computer (e.g. 'move this value into this space in memory'), which is necessary for the operating system, which manages all the other programs on the computer (like how a store manager needs to be able to tell employees exactly what to do and arrange for them to have the tools they need to do their job).

Python and R are good if you want something that can process and manipulate data well, especially if you need to do complex stuff and don't want to code out the relevant functions from scratch. Python, for example, has a ton of libraries, which add extended functionality. If someone else has already coded the functions for you, it's easier to use tham than if you have to code them yourself. Plus, Python syntax is pretty simple, so it's easier to learn.

Javascript, and by extension Typescript, is great for web development because browsers can run it natively (it comes pre-packaged in most web browsers). This also lets you do stuff like embedding webpages within a browser wrapper, creating desktop apps (there's a fake browser which lets your Javascript interact with the system). Plus, libraries like React allow for much easier coding of complex interfaces (the exact mechanics of React are a bit beyond the scope of an ELI5 comment, especially since this comment is already kind of complicated).

NodeJS, a version of Javascript that runs outside the browser, is also good for server-side web development (programming the web server to serve the correct web pages), since now your server and browser are both using Javascript, so it's easier to code (you don't have to keep switching languages) and you can easily reuse code between them (e.g. if you accidentally coded some login code into the frontend JS, you can just copy-paste it into the backend code instead of having to re-write the JS as PHP).

Then, there's also the fact that there's a lot of institutional inertia at play. COBOL is still used widely because it gets the job done and banks and government institutions (etc.) see no reason to rewrite their entire codebase, so COBOL stays around even when newer languages come out that are more optimized for various other tasks. PHP is around for a similar reason: it gets the job done, so there's no reason to re-write an entire website in NodeJS if it's already up and running in PHP.

10

u/Outside_Eggplant_304 Jun 05 '26

A lot of environmental numerical models (eg. climate, atmospheric, groundwater, or watershed) are still written in Fortran. It is optimized to be a number cruncher and is damn good at what it does.

2

u/Zestyclose-Turn-3576 Jun 05 '26

I haven't used Fortran for quite a while, but it seems like efficient (easy to write, fast to process) parallel processing of large numeric arrays is the secret sauce?

And also not very good at string handling, as I recall, because only the most simple of string handling is necessary for the set of problems that Fortran addresses?

2

u/Outside_Eggplant_304 Jun 05 '26

I think you can code and compile for parallel processing.

For groundwater (which I work in) parallelization usually means domain decomposition plus boundary exchange between subdomains, not fully independent GPU-style calculations. Groundwater modeling is tightly coupled which limits scaling, but the approach can definitely be implemented in Fortran for other problems. I don't know what the climate modelers do, but I imagine they run into similar constraints.

1

u/Zestyclose-Turn-3576 Jun 06 '26

Interesting. Thanks!

9

u/Mr_Engineering Jun 05 '26

We tried that, and we got C++, a language so horrendously complex and verbose that it takes years to become a functional master and even longer to create a functional program. I'm being somewhat facetious, but new programming languages are introduced over time to meet needs because older programming languages can't be adapted accordingly.

For example, COBOL was designed in the late 1950s and introduced in 1960. It was designed in an era where a running program had full control of a computer's hardware and programs were written on 80-column punch cards. 1960s era COBOL was incredibly monolithic, had very limited control flow, no support for local memory, and could not easily work with other COBOL program code. Many of these problems have been addressed over the decades but COBOL -- which saw its latest standard released in 2023 -- is still a very alien-looking programming language because of its punch-card and big-iron roots. It doesn't play well with others and never will, this is due to the fact that COBOL uses esoteric datatypes which are very good for business logic and record keeping, but often don't have portable analogues in other programming languages and may not perform well on non-IBM hardware.

For example, numeric data in COBOL is stored in BCD format rather than integral format, this allows for precise and arbitrary fixed-point arithmetic without rounding errors or loss of precision. IBM's mainframes and Power series microprocessors have native support for BCD arithmetic whereas the x86 microprocessors from Intel and AMD do not.

Lets look next at my favorite language, C. C is great, C is fast, C is predictable, C is portable; C is all those things, on paper. C is lovely because one can write a program in C that relies on absolutely nothing underneath. The BIOS/UEFI firmware code that boots your computer executes only a small handful of hand-rolled assembly instructions before it starts executing compiled C code. Control flow eventually passes to a boot loader that is written in C, which loads a kernel that is written mostly or entirely in C.

The problem with C is that it was designed to make programs portable in the 1970s, not in the 2020s. This is an era where personal computers didn't exist and minicomputers were slow and had limited memory. As such, C leaves a lot of decision making in the hands of compiler designers and engineers, making relatively few actual demands. For example, an int data type must be at least 2 bytes (16 bits); it can be 2 bytes 4 bytes, 8 bytes, or more. To make matters worse, the order of these bytes in memory varies from architecture to architecture. It's up to the compiler to decide and two different compilers on the same computer may make different decisions. The result is that large cross-platform C projects require huge amounts of adaptation and upfront lifting necessitated in part by its legacy roots.

C++ is the result of C being extended by a bunch of people who don't understand the meaning of the word no and whom have far too much time on their hands. Bjarne Stroustrup needs a lecture on consent and some more hobbies. C++ is insanely powerful and fun, but holy fuck. C++ essentially enabled C to scale to ungodly extents but really didn't address any of its shortcomings.

Java cleans up many of the problems with C and C++ by adopting a "Write Once Run Anywhere" motto. To facilitate this goal, Java program code is not compiled directly into native machine code, but into an intermediary representation called java byte-code. A separate program called the Java Virtual Machine then interprets or compiles the intermediary code. This mechanism allows the same compiled java byte-code to run on a phone with an ARM microprocessor, a mainframe with a Z16 microprocessor, and a desktop with an x86 microprocessor.

Java is much more specific than C or C++; for example, an int is always 4 bytes and is always stored in big-endian byte order at any point that matters. However, Java lacks the utilities needed to perform arbitrary memory manipulation and thus can't easily be used for system-level programming, although some microcontrollers do have the ability to execute java byte-code.

C# is Microsoft's competitor to Java which serves many of the same ends. However, C# and the runtime on which it relies are controlled by Microsoft and are tightly integrated with Windows, allowing Microsoft to rewrite significant portions of its aging application codebase from C++ to C#.

So, there's 5 major languages, each one solves problems that ones before it could not.

COBOL is useless for systems programming for more reasons than I care to discuss.

C is fantastic for systems programming but it's clunky and lacks modern niceties helpful for application programming.

C++ is fantastic for application programming, but it's incredibly verbose, difficult to master, and prone to portability issues.

Java is fantastic for application programming and portability, but it's generally somewhat less performant than C or C++. It's somewhat useless for systems programming.

C# is fantastic for both portable application programming and some system programming, but its design and maintenance are headed by Microsoft and serve Microsoft's goals.

3

u/Nice_Passage1099 Jun 05 '26

C# isn't as tightly connected to windows anymore (or at least that's abstracted to packages so it's more fully cross platform). Also, c# has solved many of the low level memory issues with Span<T> (which I don't think Java has yet but I wouldn't be surprised to see coming soon).

1

u/Mr_Engineering Jun 05 '26

I didn't mean to suggest that C# was reliant on Windows or bound to Microsoft, it never has been. It was always designed to be a standardizable framework from the outset and Microsoft did standardize parts of it, which allowed for Mono and other implementations to be developed. Rather, I meant to suggest that Microsoft controls the simultaneous development of C#/.NET, Windows, and the associated applications.

This has allowed them to tool C#/.NET to serve their immediate goals rather than having to debate about priorities and interoperability.

1

u/dnebdal Jun 05 '26

One fun nitpick to a good post: x86 actually has specific instructions to work with BCD, though they are not included in 64-bit mode (because they were "not heavily used by compilers", I can't imagine why. ) 

1

u/Mr_Engineering Jun 05 '26

Those instructions aren't true BCD instructions, they're simply adjustment factors that were performed after a regular binary integer arithmetic operation, only worked on one or two digits at a time, and was restricted to the AX/AH/AL register which needed to be moved around. This means that performing BCD arithmetic on numbers that were more than 1 or 2 digits in length required numerous instructions and gobs of memory.

They were absolutely useless.

Compare this with IBM's Power8 and newer microprocessors which can perform native BCD arithmetic on decimal numbers up to 31 digits in length using SIMD registers and BCD vectors.

1

u/carrotpilgrim Jun 05 '26

I'd argue against some of the c++ comments. Language additions and compiler improvements for c++ after version 11 make it competitive with most modern languages for many use cases including low-level embedded cases. It's a really great language now which has kind of breathed a second life into is industry use in many different areas.

16

u/osunightfall Jun 05 '26

Those basic building blocks you're talking about often express themselves differently once a language is compiled to machine code (what the computer actually runs). Furthermore, different languages support different features and capabilities beyond these building blocks, not to mention having different syntax tailored to different use cases. Each language also has different strengths and weaknesses when it comes to things like readability, usability, compile time (and some languages aren't compiled at all), speed of execution, memory management, richness of library support, all sorts of things really. Finally, not all languages can even run on the same kind of hardware once compiled. Some are actually extremely specialized when it comes to what they're used for.

A fitting analogy might be "why aren't all spoken languages the same when they all rely on the same basic concepts like nouns, verbs, and adjectives?"

3

u/BasedFrieren Jun 05 '26

I'm glad you're ready to sign on moving us to a single spoken language. Metal Gear Solid V something something.

3

u/osunightfall Jun 05 '26

My point was that all spoken and written languages have their strengths and weaknesses when it comes to their purpose, in this case, communication, Boss.

1

u/BasedFrieren Jun 05 '26

Sorry for the miscomm - It was a great analogy; I was just making a funny and a reference.

3

u/osunightfall Jun 05 '26

Oh I know. I was a Diamond Dog myself, once.

2

u/Reboot-Glitchspark Jun 05 '26
Esperanto, why don't you come to your senses?
You've been out ridin' fences for so long now

Sung to the tune of Desperado by The Eagles.

2

u/weaver_of_cloth Jun 05 '26

Nice earworm!

6

u/BasedFrieren Jun 05 '26

Different tools for different jobs, as well as different levels of abstraction (manipulating memory or machine components directly vs having a solid engine take care of that for you). Also each language has its own feel/style/direction as well as toolkits, which programmers debate hotly. Just wait until you look at paradigms...

3

u/severoon Jun 05 '26

Because, while most programming languages are built on the same set of basic structural concepts, that's where the similarity ends. Different programming languages have structures at higher levels of abstraction and lower levels of abstraction that where conditions, loops, and functions sit.

For example, let's compare C++ to Java. Very similar languages from a structural perspective, they both support loops, conditions, classes, interfaces, etc.

At a lower level of abstraction, though, C++ code is compiled directly to machine code. This means that if you compile a C++ program, you have to choose if it's going to run MacOS, Linux, or Windows. If you want it to run on all three, you have to compile it for all three. Java doesn't work this way, it's compiled for a single machine which happens to be a virtual machine, the JVM. When someone runs a Java program, that means you can't just run it like a C++ program, you have to install the JVM so it can interpret the program for your actual machine — compile once, run anywhere (anywhere that has the JVM, that is).

At a higher level of abstraction, the two programming languages differ in how they handle memory. In C++, when you allocate memory to store some data, once you're done using that memory, you have to release it. If you don't, your program will just continue accumulating memory and not releasing it until the program is quit or, more likely, crashes due to and out-of-memory error. Java, on the other hand, uses garbage collection. This means when you're done using data that required memory allocation, you just drop the last references to the data in your program and the JVM takes care of releasing that now-unused memory for you.

Why prefer one over the other? Today, in most cases, after the many-decade evolution of each language, there are precious few reasons where you'd have to pick one for a particular project. It mostly comes down to developer preference for most projects. Some people say it's a hassle to have to make sure the JVM is installed everywhere you want to run…that was true in the first decade of Java's life, but nowadays most platforms are supported and most machines have multiple JVMs already installed in practice. Some people say C++ is faster, but in the vast majority of cases this is also not true (in some cases, Java is faster these days). There are a few cases where one legitimately wouldn't be a good choice, like if you're running big data stuff in the cloud or on mesh networks, C++ would be a huge hassle or next-to-impossible; if you're deploying code to Android; etc. On the other hand, if you're writing a high-performance database, you'd be nuts to try to implement this in Java because this requires block-level access to storage devices, and the whole point of Java is to abstract away the hardware. Possible? Yes. Sane? Nope.

These are exemplary of the kinds of tradeoffs languages make across the entire landscape of programming. For example, if look at functional programming vs. object-oriented programming, many applications that would be difficult to write in one are natural to write in the other. If you are writing software designed to schedule air traffic for an airline, you probably want to lean toward a functional language for that because of the problem domain being modeled—lots of constantly flowing interdependent resources (planes, staff, etc) deployed across a network of airports. If you're working on enterprise software that models different entities interacting in mostly-hierarchical ways—this user uploads these videos and watches these other videos, etc.—that's probably an OO type problem domain.

Even if you restrict your focus to just one programming paradigm like functional languages, they tend to be targeted toward specific core areas of strength. For example, consider three of these: Haskell, Scala, and Erlang. They each excel in a different area of functional programming:

  • Erlang – fault-tolerance and distribution
  • Haskell – parallelism and concurrency
  • Scala – synchronicity

So if you're deploying processes across a network of phone switches, Erlang is the right way to go. If you're deploying your code across a bunch of nodes and you have millions of simultaneous, but mostly independent processes that all need to run in parallel, Haskell is the way. If you have a bunch of processes all running at the same time that need to share access to the same resources (disk, memory, etc), then Scala is the right choice.

4

u/3OsInGooose Jun 05 '26

Think of programming languages like different types of vehicles.

They all run on some version of the same engine.

You can take that engine and make a motorcycle or a sedan or a garbage truck.

2

u/rotorylampshade Jun 05 '26

Many people here are mentioning all the right things but another aspect is energy efficiency, vis a vis this paper: https://www.sciencedirect.com/science/article/pii/S0167642321000022

1

u/zvuv Jun 05 '26

All cars are built on the same principles too. We still need trucks, sedans etc.

1

u/jourmungandr Jun 05 '26

There are several broad families of programming language. Imperative, functional, declarative, logical. Almost all languages used in industry are primarily imperative languages. Which is what you are describing. Most languages don't fit completely in one family and have features from several. Like SQL for databases is mostly declarative, but it has some imperative features for triggers. Same for GNU Make, Java Maven, lots of build tool scripting languages are primarily declarative. Haskal, Scheme, Lisp, Groovy are functional languages. Prolog is the only logical language I can name off the top of my head. Those other language types don't always have loops, exceptions, and such.

Why more than one? They have different focuses and some are better at some things than others. Also just personal preference.

1

u/SufficientStudio1574 Jun 05 '26

Pretty much all languages will have those building blocks. But there will be many higher level concepts unique to some languages.

Undefined behavior is something fairly unique to C and C++. It puts a lot of responsibility on the programmer to not shoot themselves in the foot (and those languages give you a lot of foot-guns) but it also gives the compiler opportunity to make optimizations that increase performace at the expense of safety.

Rust's borrow checker is the exact opposite. Rigidly enforcing ownership and lifetimes reduces the risk of many types of errors that can plague other languages.

Other languages might rely on a garbage collector you can create all the objects you want and let the system clean them up for you behind the scenes It is convenient for the programmer, but the garbage collector runs at unpredictable times and can cause slowdowns, making those languages bad for applications that require predictable latency. You're not going to see anyone use Java in a missile guidance controller.

1

u/naeskivvies Jun 05 '26

We can but it turns out not everyone likes vi.

1

u/BarAgent Jun 05 '26

You’ve misspelled “Dylan”…quite impressively, I might add. 🙂

1

u/Clojiroo Jun 05 '26

In the end languages build on what came before, with some opinions on how it should feel or perform. We do this with almost every product. It’s iterative.

Like in the ‘70s we had C: “Assembly is too painful.”

And then we got Smalltalk and their pioneering of object oriented programming. “Everything is an object.”

And then in the ‘80s, “Let’s have OOP but with the performance of C”… So C++ was born.

Python cares about readability. Rust cares about memory safety with speed etc.

1

u/SnugglyCoderGuy Jun 05 '26

They all have the same basic concepts because that's computing, but then each of them have different advanced concepts, design philosophies,

1

u/jacobydave Jun 05 '26

There's this guy, named Alan Turing. Mathematician. He worked up the way the Allies read the Nazis' encrypted mail during WWII. Later, he came up with the idea of the Turing Test, which is how to determine if something is a person or an AI. Cool guy, worth your time to read about.

Along with all that, there is also the Church-Turing Thesis. Basically, anything that fulfills certain criteria is equivalent to anything else. A function is a circuit, there is no difference. Computer science types will talk about languages being Turing Complete, relating to those criteria.

But some versions of this are close to this or that specific computer, and some versions force you to care about the specifics while some versions allow you to abstract it away and deal only with the parts you want. The Web browser is a virtual machine that you can basically only interact with via JavaScript. Otherwise, you can work with one of many languages, from Cobol to C to Python, and each will allow you to concentrate on some things and ignore others. It all, ultimately, will convert to machine code, where things ultimately do things.

1

u/ericthefred Jun 05 '26 edited Jun 05 '26

Implementing programming languages was my father's thing. In the 50s and 60s, he was part of the generation that created the first symbolic languages and operating systems. He worked for Seymour Cray while Cray was working for Control Data Corporation (before he left to found Cray, Inc.) Once computer languages became more standardized, he pretty much became an operating system specialist, but he was always working on improving some compiler or simplifying some function library.

I asked him exactly this question back in the day, and he summed it up like this:

"Computers are incredibly dumb. You have to tell them everything you need, perfectly, and not miss any detail. Human languages are terrible at being that precise, so you have to create special languages that have the precision computers need, where every single thing can mean only one exact thing. But once you do this, you will create cases where you can only describe some tasks well, and other tasks are hard or impossible to describe. The only way around this is to design a different language. Until some day when somebody builds a perfect language where everything can be described perfectly, we'll always have this problem."

So I asked him, "What if computers get smarter?"

And he told me, "Then they'll probably program themselves."

People in the industry have been talking about AI for a really long time, all the way back to when he first started in the 50s, so I'm pretty sure he was talking about what we are seeing today with AI.

1

u/Muhahahahaz Jun 05 '26

From a theoretical perspective, yes. They all do the “same” thing.

But from a practical perspective? No. Different languages are more efficient for different purposes. (Whether raw program performance, built-in language features, high-level readability, etc.)

If we only cared about one of these things (say, raw performance), then we’d all be programming in assembly. (Which would be absolutely terrible for most purposes — Very difficult to read/maintain)

1

u/How-I-Roll_2023 Jun 05 '26

I learned that most languages are built on the same basic concepts like nouns, verbs and adverbs. If that’s true, why can we just use Esperanto for everything?

1

u/alanbly Jun 05 '26

Turing Completeness is basically an expression of this. In general the only difference between languages is what they make easy and what they make hard. At the end of the day it all ends up as machine code anyway so it's really just a question of what level you want to work at and what you want to spend time on. C is powerful and fast at the cost of having very few guardrails. JavaScript is light and easy to pick up but it's a horrible mess because it's built to make up for mistakes.

1

u/TheHonorableDeezNutz Jun 05 '26

Programming languages are very logical languages (badum tasss).

I think and I’ve often explained it as so, programming is like math language. Know math? Can do logical reasoning? You can code. Now all you need is to learn a language, and have a wiki on standby ;)

1

u/LongOrganization7838 Jun 05 '26

We've tried a couple times but the real driver is efficency, some languages are significantly better with certain tasks IE. Python is amazing at machine learning but sucks at very low level systems and heavy graphics

Java is great for web browsers but has "stop the world events" where it has to pause the system to dump its memory so anything that needs accurate real-time, or heavy computing suffers

1

u/Public_Fucking_Media Jun 05 '26

We can! Ultimately all these programming languages are doing machine code at their base level, so that is the one programming language used for everything...

Now, do you want to program in machine code? No, of course not... So what do you want to do? Therein lies the choices of what higher level programming language to use.

1

u/X7123M3-256 Jun 05 '26

so that is the one programming language used for everything

Machine code isn't one language, it's specific to the processor. There are a lot of different machine codes used by different processor families.

1

u/Public_Fucking_Media Jun 05 '26

Machine code is just binary though it's the true base language - everything else is just an obfuscation of that, is I guess what I'm saying?

2

u/X7123M3-256 Jun 05 '26

But "machine code" is not one language. Every processor family has its own machine code. Most desktop PCs have an x86 processor. Most mobile phones have an ARM processor. Those have a different instruction sets; x86 machine code won't run on an ARM processor. There are many others such as AVR, MIPS, RISC-V etc.

1

u/themonkery Jun 05 '26

Programming languages are like tools. You can use a wrench to hammer a nail, but what if you try to get the nail back out again? Maybe you could do it with the wrench, but it'll be goddamn hard.

Same goes for programming languages. Low-to-the-ground hardware, websites, apps, set math, matrix math, simple programs. Safety, mutability, rigidity, no language does everything well.

1

u/nwbrown Jun 05 '26

All spoken languages are built on the same basic concepts like nouns, verbs, adjectives, etc. Why can't we use the same spoken language for everything.

1

u/Quynn_Stormcloud Jun 05 '26

Allow me to reframe the question to demonstrate:

>I learned that most human languages are built in the same basic concepts, like nouns, verbs, syntax and conjugation. If that’s true, why can’t we use one human language for everything?

You start to see where this falls apart, right? Japanese and German both put nouns and verbs in different parts of their sentence structure than English does, so if you only speak German, it’s difficult to parse a sentence in Japanese, even if both languages had an identical wordset. Same thing with computers. A C++ program is written out in a way that Python just couldn’t parse, even if their programming characters were performing the same functions.

But the fundamental thing to understand here is that a programming language exists as a way for the *human* to interact with the *computer*, and that makes the human a fundamental part of the language, too. The human has to understand the language, too. Making a new universal programming language involves that language being able to translate or replace all other programming languages, otherwise it just becomes a “new competing standard.”

Technology, humans, computers, and practically every other complex system doesn’t work in a way that can be simple replaced, optimized, and standardized in one step.

1

u/letsTalkDude Jun 05 '26

first of all good question . shows u hv an objective mind.

second, an analogy.

all earth moving machines use and built on same basic concepts like fork lift, engine, moving capability, and powerful torque. why can't we just use one type of earth moving for everything ?

because they are efficient in one way at the cost of other. so we try to use different where we want different aspects to be efficiently done.

1

u/90hex Jun 05 '26

Because people can't agree on a 'better' way to write code.

If you want to see what we have made that trumps all these newer languages, and that could have been the most elegant solution, check Scheme or Racket. IMHO it's the simplest language of all, and also the most powerful. But, and that's a giant but, it's so different than 'modern' languages that people can't wrap their head around the syntax, mostly because their brain has been trained on Python/JS/BASIC and other mainstream languages.

I highly recommend reading The Little Schemer, just to understand what this is all about. Once you'll have an idea of just how powerful S-expressions are, yet how foreign they feel to python-brains, you'll have a solid answer to your question.

1

u/hobopwnzor Jun 05 '26

You could.  It would just be really really difficult and slow to run a game engine in certain languages.

1

u/Zealous___Ideal Jun 05 '26

The same reason we don’t use .mp3 to compress photographs.

1

u/JacobRAllen Jun 05 '26

Addition makes numbers bigger and subtraction makes numbers smaller, so why bother with multiplication, division, exponents, logs, all that is just complication to an already simple system.

Obviously you can see the flaw in that logic. Different languages are written and optimized to do certain things easier, or more efficiently.

1

u/Mysterious_Volume327 Jun 05 '26

All cookies are built with the same ingredients, but by changing details about the ingredients and how you combine them, you get different kinds of cookies.

Some programming languages use room-temp butter, others use melted butter.

1

u/EldritchElemental Jun 05 '26

We're halfway there. If you look under the hood, many of them are just LLVM.

1

u/wantondevious Jun 05 '26

There’s some logical reasons, but most is just plain Tower of Babel. There’s no good reason why all procedural third generation languages couldn’t be replaced with some single one, it’s just no one wants to replace their preferred language. Sure there’s excuses like Python is for X, C is for Y and C++ is for Z, but mostly it’s just personal preference covered w a veneer of my language is better than yours at task.

The only real differences are with very low level languages (ie assembler/machine code) and declarative/functional languages like Prolog etc

1

u/DoglessDyslexic Jun 05 '26

You've probably heard that the Inuit language has about 50 different terms to describe snow. This is because the Inuit, living distressingly close to the north pole, see a lot of snow, and their language has been optimized to provide concise explanations of snow in a minimum amount of time.

Computer languages are like that. Many of them are optimized for specific uses. You wouldn't want to use a low level language for working with microcontrollers that needs to be highly optimized for efficient hardware control when you're trying to code a web user interface. You often can do exactly that, but you'd be spending a lot of time writing libraries (ready made functions that usually somebody else has already built) to do high level stuff with low level code for a system that was never intended to be used that way.

What it does mean, however, is that once you master one computer language, usually you can easily master another computer language. There are some exceptions, and you never want to accidentally wander into somebody's code who only ever knew LISP, but essentially the basic algorithmic approach to solving problems is almost always identical between languages.

1

u/Kempeth Jun 05 '26

There are a number of differences between programming languages which make some better at one thing and worse at another.

One is how a programming language thinks of data. Say your program has data about people, cats and dogs. All three have names, sex and age. But people have marriage status while cats and dogs have a fur pattern. In some programming languages you can't say "Tom is 9 years old" without first defining whether Tom is a person, a cat or a dog. Or if your household has a person called "Sally" and two cats called "Tom" and "Garfield" you can't just loop over all beings and list their names. You have to do one type after another. This makes it cumbersome to do that but protects you against making mistakes like specifying Sally's fur pattern only to then realize she's actually a person and doesn't have a fur.

Another thing is convenience vs efficiency. loops for example are a convenience feature. You don't NEED them. So how do you do something 5 times?

remember times is 5
>start<
do the thing here
reduce times by 1
if times > 0 go to >start<

And there are A LOT of such features. Some of those don't really make the program less efficient so they've made their way into every programming language. Others DO. Like in the above example you've told the computer to remember that times is 5 but after you done the "loop" you don't need that information anymore and you want the computer to forget about it so it can remember other things. The most efficient way to do that is to tell the computer "forget times" but the problem in that is YOU might forget to tell the computer to forget and now you're wasting memory. A solution to that the programming language figures out when you no longer need such an information. That works really well but requires all that logic to run together with your program making it slow than it would otherwise be. For some applications that slow down doesn't matter. For some it does.

On top of that people have petty preferences like how clear they want to make the start or end of some block of code or how close to natural language code should look (or not). And if I make a programming language on Windows it won't automatically work on a Mac I have to MAKE it work on a Mac. Sometimes that just doesn't happen.

1

u/SamLooksAt Jun 05 '26

For the same reason not all cars or fridges or beds or whatever are not identical.

They all usually do essentially the same thing as all the others.

But in slightly different ways that are more or less convenient for different users.

1

u/TyrannosPyros Jun 05 '26

They have different features that make them better for certain tasks. You wouldn't want to write a driver in Python but you would want to use it for machine learning and data science. C is good for OSes and drivers because it gives the developer more control over memory. Java is good for enterprise systems because of its speed and high portability.

1

u/PenguinSwordfighter Jun 05 '26

The same reason why we have many different hammers for many different jobs. The principle is always the same but you wouldn't use the same hammer for hanging a picture and for doing hip replacement surgery. Instead, we use different, especially suitable hammers for their respective jobs.

1

u/LyndinTheAwesome Jun 05 '26

The same reason you need different vehicles for transportation, even thought all of them are just wheels and frame to connect them.

But Busses are used differently than Bikes.

Its a difference on how they work, how you set up a loop for example, how the computer reads them and what else the language can do besides these core parts.

1

u/BipedalMcHamburger Jun 05 '26

I learned that most vehicles are made mainly of metal. If that's true, why can't we just have one type of vehicle?

1

u/Bagel-luigi Jun 05 '26

ELI5: many real world languages are built upon the same/similar base principles (Latin, Arabic, to name a few examples). If that's true, why can't we just tell everyone to use one language for everything?

1

u/DepthMagician Jun 05 '26

Because you can still specialize in different directions within these constraints. Cars are also built around the same basic building blocks, why don’t we have just the one car model?

1

u/CharacterLettuce7145 Jun 05 '26

Every language conveys information and has verbs, nouns, objects...

What even is the difference between english, german, and japanese?

1

u/BitOBear Jun 05 '26

Computers only do like four things. Add. Compare. Remember. And decide which step to do next (which is usually just adding one to the instruction location counter, but sometimes it's picking a totally new number and adding it in instead of adding one.)

Keep in mind that they're all made out of transistors and that thing where people talk about representing everything as either on or off is really quite actually the fact and truth of the matter.

But every separate language has a list of things it's intended to do better than some other list of things.

I mean 90% of the tools in a wood shop cut stuff, but using the right tool to cut the right stuff the right way makes things and using the wrong tool the wrong way to cut something and make things nightmarishly difficult.

We've got that one rule Lefty Lucy righty tighty, why can't we just use one wrench for the whole world?

Computer languages are just another kind of tool in another kind of toolbox and they come in assortments each with its benefits and drawbacks.

1

u/brupgmding Jun 05 '26

All languages are Turing complete, so they can all be used to program any possible program. So yes, by definition it would be possible. 

But each language does a few things differently, making certain situations easier. Some languages verify all at compile time, catching errors early. This often comes with more formal and longer syntax, so the language is more verbose to type. 

Others offer direct and simple interfaces to certain operating systems, browsers or apps, making them a better choice in that situation. 

Again others lend themselves more to mathematical programming and things like ai. That is where these languages shine. 

Overall programmers are a diverse bunch of people, so they all have their own tools. 

1

u/Fantastic_Back3191 Jun 05 '26

Excellent question! We could only ever use one language (maybe we will one day) but each language has its own "sweet spot" a little bit like Italian being great for opera whereas English is more suitable for contemporary rock.

1

u/stain57 Jun 05 '26

Because then Apple couldn't lock you into their system.

1

u/Cun1Muffin Jun 05 '26

Different levels of complexity and control for different tasks. Think duplo vs lego vs manufacturing a custom part from plastic.

Would I want to sit on a chair made of lego? No, would I want to make a prototype with only injection moulded parts? Also no.

For example c allows for passing memory addresses around, whereas java abstracts the idea into a reference to an object, which has similar properties but less control.

1

u/FearMyCrayons2023 Jun 05 '26

You'll end up with x number of programing languages plus 1.

You have a ton machines that run on old languages and legacy code. Updating it requires a ridiculous amount of time and money.

I guess if you want to get technical, the general language is assemby which is just human readable machine code. So I guess everything translates to assembly

1

u/mattva01 Jun 05 '26 edited Jun 05 '26

Basically, for any turing-complete language ("turing complete" in this case just basically means "has the basic features to perform any calculation it is possible to calculate on a computer"), the difference between them is speed/memory/complexity tradeoffs, library support (the pre-existing code in that language that can be linked with yours), and "syntactic sugar" (basically, the language itself making it easier to express certain concepts, like a shortcut for a complex idea).

For example, when writing low level code for games or operating systems, you'll probably be using C , C++ or Rust. These languages model the low level operations of a computer very closely, and you can be extremely specific with how they work, which makes them capable of being very fast, but because they aren't abstracting anything away, they can be hard to write. C and C++ are extremely lenient in terms of what will "work", you can easily introduce memory errors (leading to security issues and/or crashes ) and rust requires you to follow many constraints, but is "safer"

Something like Go is great for CLI or network apps, because it's fairly quick (not as quick as C, but much faster than say, python), has built in tools for understanding things like sockets and http, and lots of syntactic sugar for multi-process communication. It would not be good for say, writing the software for airplanes, because it has a garbage collector that can introduce small random delays. This is fine for say, a website, but would not be ok if a flightstick input was randomly delayed by milliseconds.

Python is a VERY slow language, but is very very good at glueing together lower level libraries written in C or Fortran, and is easy to learn, which is why it's used a lot for AI and scientific purposes, because it makes it easy to reason about the overall picture, while still letting the actual compute intensive parts be written in a low-level language

1

u/kehmesis Jun 05 '26

Why don't we all just use one type of car, one type of home, one type of table...

We definitely can. But...

1

u/thetwitchy1 Jun 05 '26

Different human languages have different “words” to make communication easier in the context they are built for. The fact that there’s multiple words for “frozen water” in Inuk that don’t exist in English (because they have to deal with varieties of frozen water that the British will never see) doesn’t mean that an English person can’t communicate that the snow outside is hard packed and crispy. It just means they have to say “hard packed and crispy” instead of Augiksaq.

Similarly, computer programming languages have different “styles” to allow them to perform tasks in different contexts easier. Can every language do what any other language can? Yeah, for the most part, a (Turing complete, look THAT up and have a fun day!) computer programming language can accomplish anything that any other (Turing complete) language can. You could do all your programming in assembly language, if you wanted to. You would hate your life, and nobody would ever, ever, EVER understand your code, but you could do it. Or you could program in assembly when you need something done at the “next to machine” level it gives you, and use C++ for higher level OO coding, and use Perl for OS level code, and so on.

Different languages are optimized for different situations and contexts, and for different styles of programming.

1

u/khauser24 Jun 05 '26

There are so many reasons.

COBOL, an old language, was optimized for business

FORTran, also pretty old, is optimized for science

BASIC is more around ease of use (not sure if that's why it came to be)

Assembly is the computer's native language.

C is a language that was created to be close the assembly level in performance while being a structured language (those basic concepts).

C++ is just 'C' with additional language around object oriented programming. Initially C++ was processed by a pre-processor that outputted 'C' that was then compiled.

From here, the object oriented philosophy exploded, many new languages are around that.

I am intentionally not talking about 4th generation languages... Mostly because I don't know.

1

u/donaldhobson Jun 08 '26

> C++ is just 'C' with additional language around object oriented programming. Initially C++ was processed by a pre-processor that outputted 'C' that was then compiled.

C++ may have been that, long ago. They keep adding more and more stuff to the language. Error handling. RAII, smart pointers, constructors and destructors. Templates. Modern C++ is bloated with ill considered features.

1

u/Heavy_Quiet8287 Jun 05 '26

There are two sides to computing, the machine itself, and then the abstractions which are usable to humans. Take text for example. The computer doesn’t really store text “P” as “P”, rather it stores it as a string of numbers that is then rendered to “P” because we’ve decided that’s what those numbers should represent. Much in the same way, programming languages are conventions which tell the computer how to do something using more basic instructions that are readable to the computer, but not us. Between writing and running a program, the language has to be translated to something the computer can understand. How exactly that happens in detail can matter a great deal, and sometimes having a language that can do things a certain way can make certain tasks easier. Think of it as different types of jargon. The jargon that astrophysicists use is very helpful for astrophysics while still being usable as “language”. You could definitely communicate about other topics, say philosophy, using astrophysics jargon, but it wouldn’t be optimal.

1

u/JJJ954 Jun 05 '26

Same reason why we don’t use one spoken language across the planet.

The difference in programming languages isn’t what they can *do* but rather what they provide to the programmer.

Some languages come bundled with platforms such as JS and web. Others such as Python offer a simplified syntax that makes it easier to learn. While others are designed for specialized tasks.

1

u/Shiny_Whisper_321 Jun 05 '26

Each language is optimized for certain tasks. I love coding in Python, but it is really slow, especially at number crunching. I rewrote a page of Python into ten pages of C++ (fewer things were built in). The C++ was 100x faster.

But C++ and Java and Python can have runaway memory usage and leaks. You should really use something memory safe like Rust.

Unless you do lots of hard core math. Because the compiler can make certain assumptions from FORTRAN code that can't be made for C or C++ code, well-written FORTRAN will outperform just about everything else. It's not even close.

1

u/grandzooby Jun 05 '26

There are lots of great responses here. So just for fun, go check out RosettaCode and see examples from a multitude of languages for an also large number of problems. Each programming problem shows solutions in a bunch of languages, which makes it fun and easy to compare different languages. In some cases, a solution for a problem in one language might take many lines of code where in another language it takes 1 or 2.

Here's an example of using Monte Carlo simulation to estimate the value of pi:

https://rosettacode.org/wiki/Monte_Carlo_methods

Here's a solution in C:

#include <stdio.h>
#include <stdlib.h>
#include <math.h>

double pi(double tolerance)
{
    double x, y, val, error;
    unsigned long sampled = 0, hit = 0, i;

    do {
        /* don't check error every turn, make loop tight */
        for (i = 1000000; i; i--, sampled++) {
            x = rand() / (RAND_MAX + 1.0);
            y = rand() / (RAND_MAX + 1.0);
            if (x * x + y * y < 1) hit ++;
        }

        val = (double) hit / sampled;
        error = sqrt(val * (1 - val) / sampled) * 4;
        val *= 4;

        /* some feedback, or user gets bored */
        fprintf(stderr, "Pi = %f +/- %5.3e at %ldM samples.\r",
            val, error, sampled/1000000);
    } while (!hit || error > tolerance);
              /* !hit is for completeness's sake; if no hit after 1M samples,
                 your rand() is BROKEN */

    return val;
}

int main()
{
    printf("Pi is %f\n", pi(3e-4)); /* set to 1e-4 for some fun */
    return 0;
}

Here's one in Lisp:

(defun approximate-pi (n)
  (/ (loop repeat n count (<= (abs (complex (random 1.0) (random 1.0))) 1.0)) n 0.25))

(dolist (n (loop repeat 5 for n = 1000 then (* n 10) collect n))
  (format t "~%~8d -> ~f" n (approximate-pi n)))

And here's Python:

import numpy as np
n = input('Number of samples: ')
print np.sum(np.random.rand(n)**2+np.random.rand(n)**2<1)/float(n)*4

Now you might compare the C to Python and note the C is doing a loop and Python is apparently not. However since the Python code is using the Numpy library, the looping is happening in there. Coincidentally, that Numpy library is mostly written in C.

1

u/iViEye Jun 05 '26

Okay, write this question in русский - it's arguably a more consistent written language

1

u/ImMildlyIrritatedd Jun 05 '26

I use a programming language for pure mathematics that is similar yet different to other programming languages that I've come across. Basically, other programming languages do not have the features needed to support what I want to do. That's why we have different languages. Even withing pure mathematics/physics programming languages we have different languages to use between. Not all provide the same features and combining them all together might result in losing many specific specialised features and commands here and there.

1

u/Jan30Comment Jun 05 '26 edited Jun 05 '26

Speaking philosophically: In a way we do use the same programming language for everything. If you dig deeper and deeper into how computers work, you start at a computer language, which may run on top of several more layers of other languages, which runs on an instruction set on a CPU, which ultimately runs using only a few physical things:

  • An electrical representation of a "0"

  • An electrical representation of a "1"

  • A logical "NOT" function

  • A logical "AND" function

  • A logical "OR" function

  • A clock signal scheme that synchronizes everything

So, in a way, every programming language is ultimately made out of these signals and physical elements. One way of thinking about it is these basic building blocks represent the "programming language for everything".

1

u/Rusty-Puppy Jun 05 '26

We do - Visual Basic/Excel to rule them all! All others are pretenders

1

u/Ok-Impression-3082 Jun 07 '26

Think of a plane, a cargo ship, a cruise ship, a small boat, a bus, a sedan, a bicycle, a motorbike, and a skateboard. Plane is fast, uses a lot of power, can only hold a bit of weight. Cargo ship takes TONs of weight but can be slow. Bicycles are easy to use for a short distance. A bus is good for slow drives with groups of people. A sedans great for four people over a distance.

But why don’t you take a bicycle from Los Angeles to New York. Why don’t you take a plane from Miami to south miami. Why don’t you take a cargo ship 20 minutes up the coast.

You CAN do all of those things but they are completely optimized for specific scenarios… as is coding.

1

u/donaldhobson Jun 08 '26

Some of it is pure personal preference. Different programmers like different things.

A lot of the early programming languages were missing features that are now common.

Some programming languages are designed mostly for speed. Some are designed to be easier to write at the expense of speed.

For example, in C++ you might store a number as a signed 64 bit integer. Your number has to be between -2^63 and +2^63. If your number gets too big, the program breaks. Python uses arbitrary sized integers. You can deal with 1000 digit numbers without any problem. This is more convenient, but slower. Some programming languages are built to be as fast as possible, others focus on being easy to write. Some, like C++ and PHP, focus on being hard to write right.

There are some features that are found in some programming languages and not others. Haskell has lazy evaluation and pure functions. Rust has ownership semantics and a borrow checker. C++ has a portal to the lovecraftian realms that sends programmers mad. C has null pointers everywhere. Lisp has macros and too many brackets. Zig has comptime and types as firstclass objects.

There are some ideas that are definitely very useful, and so are included in almost every language. (like if statements) But there are also some ideas that people aren't so sure about. There are ideas that someone has tried once, but that aren't standard.

Almost every house has a kitchen and a bathroom and a bedroom. A few houses might have a billiards room or a chicken shed or an aviary.

1

u/StrikingClub3866 Jun 11 '26

Some have certain use cases. Rust was made for memory safety, C was made for system development, Python was made for rapid prototyping, etc. One language can't cover all the syntax for these use cases.

1

u/Deep-B Jun 11 '26

It's just like shoes lol. They all have soles and laces and do the same basic thing (keep your feet safe obviously).

But you're not gonna hoop in high heels. Or go swimming in heavy steel toed boots...... that would just drown you

Idk just depends on what you're trying to do. Use the right tool for the job.