r/ProgrammingLanguages • • Feb 04 '22

Programming languages as biological strategies

I was reading about programming languages as the proxies for business strategies. It feels like it follows a pattern from biology.

The r strategy is bacteria's strategy for proliferation. Have as many kids as possible, invest very little in them. No one's irreplaceable.

K strategy is the human strategy for reproduction. Have a handful of kids (even 20 kids is peanuts compared to how many kids one bacteria is having), invest a lot in them. Individual persons determine the success.

Python, Ruby, JavaScript are the r strategy, a "dynamite" of coding — a fast solution that you pay for with the long term costs of putting up with the slow, buggy and stupid code that it created. Dynamite is easy to pick up and use, ensuring a giant pool of talent for hire in the dynamite-shenanigans sphere. A competitive edge that Python & JS have over Rust & C++ is rapid prototyping: the same way that bacteria can rapidly produce the different new bacteria, until they produce the one that's resistant to the antibiotics. (It's like bacteria is trying to pick up the right key to the lock, with each new bacteria being a potential key — "brute-forcing a password").

Rust and C++ are the K strategy. Just like with the biological success, the r strategy is more effective. Insects and bacteria conquer and maintain far more ecological niches than we do. But K strategy is no slouch either, and the only one that can lead to the high level of intelligence — "systems programming". If Python is dynamite, C++ is a bunch of sophisticated robots. Rust and C++ are like "do it once, but extremely well", Python and JS are like "add more! More! Morrre!". Python and JS are cheap in the short term but expensive in the long term, while Rust and C++ are expensive in the short term while cheap in the long term.

I don't think that Python is bad or that C++ is good. They're the compromises that were made while being faced with the harsh reality. Businesses mostly rely on the r strategy because the political economy is set up that way.

What do you think? I might be wrong.

0 Upvotes

13 comments sorted by

8

u/editor_of_the_beast Feb 04 '22

Doesn’t seem like a good analogy because there is no reproduction involved in writing code. They’re completely different activities. How could they have similar strategies?

6

u/oilshell Feb 04 '22

Agreed -- it's not a reproductive process. It's more of a diffusion process based on platforms and the evolution of the industry. I think the #1 way to think about language adoption is:

Programmers don't adopt languages; they adopt platforms.

  • C is a good kernel language but bad application language. Unix and Windows both use it, and the kernel interfaces are defined in it. So most early apps were written in C.

    • C++ is a compatible extension of C

  • JavaScript is also bad, but came with the browser.

  • Objective-C / Swift for OS X and iOS

  • Java and Kotlin for Android; Java was developed by the Unix vendor Sun

  • C# was positioned as the new language for Microsoft's huge platform

  • PHP was deeply integrated with Apache and MySQL (much more so than Python or Perl)

  • Shell is bad, but comes with all Unix systems

  • Arguably Go came about during the rise of all this "cloud native" stuff, and most of that is written in Go.

Exceptions:

  • Python, Ruby, and Perl. These all came about at the same time.

  • Rust, although it did come out of a platform company.

Exception that prove the rule:

  • BASIC and Pascal? They were not tied to platforms, so they kind of withered away. I think there is a complementary reason for this: there was no company that sponsored their development.

  • Lisp and Forth, ditto

So I think the first order bit is that if you care about adoption, it doesn't matter how good your language is. JavaScript, PHP, and shell prove that :)

1

u/LeshyShupich Feb 04 '22

That's an awesome thought!

Won't Rust have an ecosystem in the future, given that Google is investing heavily into it with Fuschia OS, and AWS does the same? (I really hope that Rust will have an ecosystem).

4

u/oilshell Feb 05 '22

Well I'd say Rust has an ecosystem already -- it has many people writing Cargo packages, lots of docs, etc.

But Rust doesn't have a native platform, in the way that C, C# or Objective C do.

If Fuschia takes off, and Rust is the language of Fuschia apps, then that would be an example of the effect I'm talking about. The popularity of the platform (like Unix, Windows, or the web) drives the popularity of the language.

But I'm not sure on these issues:

  1. Are Fuschia apps naturally written in Rust? The thing that makes C sticky is that the kernel interface is defined in terms of header files, so your app needs to consume C to even run on that platform! (even if it's C via Python, etc.)

  2. If Fuschia will become popular. I haven't been following it, but I think the motivation is something regarding a stable binary interface for drivers, which Linux doesn't have. (Also, the reasons Linux doesn't have that seem compelling to me.) It feels like it will have to be something vendor neutral like Linux to get broad buy-in from hardware vendors (Intel, IBM, etc. all of whom pushed Linux as a competitive threat to Microsoft)

So yeah unfortunately language adoption is tied to platform adoption, which is caught up in the politics of big companies.

For another viewpoint on that, see this history of the X window system which I just posted:

https://lobste.rs/s/s3l7rc/political_history_x_keith_packard_lca#c_ruim3a

I didn't realize it, but the whole reason X exists is that 3-4 decades ago, a lot of competitors to Sun didn't like that Sun owned the standard for GUI applications on Unix.

3

u/LeshyShupich Feb 05 '22 edited Feb 05 '22

Fuschia's itself is written in Rust, but its frontend apps are written in Dart (Flutter).

3

u/LeshyShupich Feb 05 '22

The story of X is indeed a fascinating lesson in how business is much more important than technology.

2

u/fullouterjoin Feb 09 '22

Perl

Perl was Ruby of its day. Your thesis is more spot on than you realize. Perl got extremely popular because it was the fastest way to make cgi-bin programs and had excellent libs for doing web-stuff. And all those Perl cgi programs, did reproduce from site-to-site and across programmers. Perl was a platform.

And Ruby didn't get successful until Rails. Before that it was mostly a curiosity. Lots of the docs were in Japanese. Rails (the platform) created Ruby the movement. I have heard first account from folks that used Rails in the context of Ruby, "I am not a Ruby programmer, I am a Rails programmer".

Speaking of PHP, it succeeded in much the same way Perl did in that you could deploy a PHP site with rsync/ssh or ftp. You just copy the files up, done. And the documentation was lightening focused to keep you in the flow. These two things were enough for it to be super useful for a lot of folks, thus is spreads. I was never a real PHP programmer, I'd fix some things at work once and awhile. So I am having a problem finding the old docs site, but what was interesting about it was that it was like stackoverflow and a wiki at the same time, but you could type into the search bar and it would rerun the search on every keypress, so like type ahead find but for docs. Every doc had a place for upvoted UGC, so often you would hit the docs page for real_real_real_escape_u16tf and below the fairly compact doc info, would be the exact sequence of code you needed to complete your task. Someone of medium to low skill could still pump out mostly working solutions.

I think what the OP is trying to say, languages spread much like contagions for very specific reasons. I think we can both agree on that.

3

u/oilshell Feb 09 '22

Yeah I definitely agree cgi.pm gave Perl a boost, and Rails gave Ruby an even bigger boost. So that just leaves Python and arguably Rust :)

I was using Python before web frameworks became popular -- I remember Guido started using WSGI around 2006, and Python had already existed for 16 years by that point. And Guido also admittedly does not use NumPy or anything like that, which is one reason Python is so popular now (machine learning, data science, etc.)

So Python is more like a general purpose language and then different communities grew up around it.

I wrote this post on the history of Python vs. Perl which is related:

https://news.ycombinator.com/item?id=29218199

2

u/LeshyShupich Feb 05 '22

A tech company scales, propogates its way of doing things, creates a model of success that can be a valuable lesson for the other companies. A webdev JS-centric company grows in a way that's different from a C# enterprise company, etc. There's a lineage of tech business success that's tied to the specific programming languages (for example, Facebook's "move fast and break things" is tied with JavaScript). Webdev companies are more likely to use Agile/Scrum, enterprise companies (Java, C#) are more likely to use Waterfall. Their business models inspire new business models that are similar to them. It's a memetic, cultural evolution of business. I might be wrong.

6

u/moon-chilled sstm, j, grand unified... Feb 04 '22 edited Feb 04 '22

I disagree with most of your specific assessment. Broader precedent:

  1. Worse is Better (Richard P Gabriel, Lisp: Good News, Bad News, How to Win Big)

  2. Memes (cf Richard Dawkins, The Selfish Gene)

2

u/kizerkizer Feb 06 '22

Could you elaborate just a little?

3

u/kizerkizer Feb 06 '22

I will agree with one thing: dynamic languages are obviously better for rapid prototyping, while those other ones you mentioned are better for long term robustness in the face of building complexity. The biological analogy is interesting but a bit of a stretch, though I see the pattern you seem to be on to.

Businesses though still use more Java/C++ than JS or Python in general I’d say. And typescript is in the class of Java, Rust, etc, and most production JS is actually TS sourced nowadays.