Making your code live forever

iljitsch

Ars Tribunus Angusticlavius
9,637
Subscriptor++
Here in Holland, we always used to be very proud of our tax service. But it's having all kinds of issues right now, with one of them being that they use really old systems. One commenter even talked about "Commodore 64s". Obviously not, but right era for some of these systems, I'm afraid...

Which got me thinking: suppose I had to build software today that I know will stay in use for decades to come. Could be something that calculates income tax. Or the software for an MRI scanner. Or, perhaps closer to home: the software that analyzes a data set for an academic paper that may have to be replicated at some point in the future.

So: what language and frameworks/libraries, operating system and hardware platform could I use without constantly having to change my code because my dependencies are in a constant state of change?

The only thing I can think of is standard C or perhaps POSIX. That is so old and so widely implemented that you can work around the particulars of the underlying OS and it'll run on any hardware.

But of course C is a terrible choice for lots of things. What about C++? A bit higher level, but I hear bad things about it.

And although I can hold my own on the command line and I've been learning a lot more Javascript the past two years, I've never programmed for any type of GUI. But as an observer of that space, it seems like a dead end. I guess in theory there are Windows Win32 apps from the late 1990s that still run on Windows 10 today, but as a rule, badly. On the Mac, I guess early Cocoa apps from the early 2000s can be recompiled after three architecture changes, but again, I wouldn't bet on that working well.

Perhaps the stuff we build today on Windows and MacOS will last longer now that they both figured out their future directions and general compute and graphics hardware don't seem to have radical new approaches coming. Still, I'd rather (conservatively) use web technologies for the graphical part.

I guess Javascript is pretty stable by now, but I don't think if I were running IT for the tax service I'd want to run my stuff in a browser...

I guess ideally I wouldn't want to use a compiled language, because then when you recompile due to architecture changes, you run the risk of new bugs appearing.

Can it be that I'm talking myself into Java?
 

hestermofet

Ars Legatus Legionis
25,464
The only thing I can think of is standard C or perhaps POSIX. That is so old and so widely implemented that you can work around the particulars of the underlying OS and it'll run on any hardware.
This is the only obvious answer. It's so close to assembly language that it's the only reasonable answer. If you stick exclusively to stdlib, it can be almost architecture independent, as well, so porting work to new platforms, as they get developed over time, will be very minimal. C can be incredibly portable, if you don't use platform-exclusive features, and stick to stdlib and core language features. Also, because it's been around for a geological age, things like stdlib are so well tested that obscure edge case bugs that you discover 20 years down the line that you need to patch out probably won't be an issue.

But of course C is a terrible choice for lots of things.
But that's kind of the point. What is really, really good at one thing might be terrible for other things. It's a matter of priorities. If your priority is code that is eternal, you will sacrifice other things, like readability or reusability or fancy new features/paradigms like protocol-oriented programming or rapid application development or whatever else your eternal language is not good at. Other languages may be better at those other things, but they won't be good at the things C is good at.

what language and frameworks/libraries,
If your goal is eternal code, stay the hell away from frameworks, and any libraries that are not an integral part of the language.

Can it be that I'm talking myself into Java?
Well, yeah, I guess that was the dream. WORA, including machines that don't exist yet but get invented 50 years into the future. :) I'm still able to write brand new code in Java 6, and it still functions exactly as I expect it to on any machine I try, from a featurephone from 15 years ago to a bluray player to a 10 teraflop gaming rig.

But this is just pushing the development work of maintaining your code down the line to somebody else. Massive amounts of maintenance and technical debt is involved, it's just hidden from you as the "end-user" (of the language, not the final executable). Instead of you constantly porting your code to new platforms, the JVM developers are doing it. So at the end of the day, you're very reliant on somebody else being willing to take on the mantle of carrying on JVM development, AND porting it to new platforms in the future. Can you guarantee that 50 years out? 100 years out?

With C, you write it once (as long as you are very conservative and elegant in your code), and the porting work is way less minimal in comparison. There can potentially be very little technical debt, assuming you write it well to begin with, with portability in mind. Once you write it initially, the code can be almost "static" (not in the programming sense, but in the chronological sense), only requiring minimal changes for porting.

Perhaps the stuff we build today on Windows and MacOS will last longer now that they both figured out their future directions and general compute and graphics hardware don't seem to have radical new approaches coming. Still, I'd rather (conservatively) use web technologies for the graphical part.
Really doubt it. Apple breaks stuff constantly, and every 5 years or so, the get the idea in their head "let's rewrite everything, and drag our developer community along with us!" Big Sur and Monterey broke so many fucking things. :facepalm: Even very basic things like third-party WiFi cards don't work any more, because the driver model is completely different. No more kexts. Apple will almost certainly do this type of thing again. They've been very consistent in being inconsistent.

Windows is slowly headed down that road, there's even been talk of versions of Windows with no backwards compatibility with Win32. Things are only going to get worse for GUI applications for both platforms, not better.

Still, I'd rather (conservatively) use web technologies for the graphical part.
That's not being conservative, that's incredibly risky. I use a lot of retro hardware. Getting modern web pages to run on old hardware, or old web pages to work (properly!) on modern hardware can be a pain. Web standards move way too fast, and web development is probably the one area where developers care the least about backwards and forwards compatibility. I wouldn't call any web framework or language stable. Except for Perl. :) Well, I wouldn't call Perl stable either, more like ossified. :p

Here in Holland, we always used to be very proud of our tax service.
Very much an aside, but I think this is super awesome. As a non-American North American who is constantly interacting with Americans on the Internet, I very rarely see an appreciation for things that really matter. Like a well-functioning government that works for its people. This is something that Americans would never appreciate. Many of them are very braggadocios about meaningless and actively harmful things like gun rights though. :p When it comes to politics, Americans really love theoretical concepts like free speech and freedom of religion, but they don't seem to care all that much about practical things like a government that is actually functional and that is able to help the people it serves. As a Canadian, our political discourse is always overshadowed by what the Americans are doing and thinking, so it's nice to interact with people from other political cultures who value the same things we do.

We had a national scandal a few years ago about a payroll system that was rolled out in a disastrous manner, and as a result, hundreds of thousands of civil servants didn't get paid for months. Americans would probably be like "whatever, I don't want a bunch of bureaucrats to get my money anyway. Let's fight about how gay people shouldn't be allowed to get wedding cakes instead!" :p :facepalm:

edit: to add on to that, you folks are proud of your tax system. You poll Canadians, and the number one thing they are proud of is not abstract things like freedom, liberty, democracy, transparency etc. It's our healthcare system. ​🇨🇦​🍁​
https://canoe.com/news/national/poll-lo ... t-proud-of
 

Lt_Storm

Ars Tribunus Angusticlavius
21,346
Subscriptor++
I would actually argue that language or technology choice isn't the problem here. The problem here is security: what happens when whatever language, design, or foo choice you make causes a remote execution vulnerability. If you are designing something that must work without changes for decades, then your first consideration must be isolation. If it is connected to the internet, you have already failed. Your second concern must be integration: since other tools must work with it, you need to have some way to get data to the unchangeable piece without actually exposing it to the networked machine that could hack it, and this part needs to be trivially changeable so it can be updated to deal with whatever new problems arise.

Overall, this is an impossible problem. It would be much better to realize that we live in a world that changes and, rather than trying to figure out how to encase things in amber, figure out how to make sure the constraints you care about can be enforced on a rapidly changing system. Typically this means processes and testing.
 

ramases

Ars Tribunus Angusticlavius
9,021
Subscriptor++
I too think that for the most part, language choice is subordinate to architecture, and that architecture must be able to accomodate change with reasonable effort. Your best bet for such systems probably would be to break down the actual business rules into a kernel that can remain relatively static, only changing when your problem domain changes; ideally, you would try for an as-pure-as-possible transform -- I'd have a real hard think about using a functional language for it -- from an input dataset to an output dataset, leaving all other parts like data access, security and access control to other components, though I realize most cases would require some compromise there.

This way you can adapt to change in your interface layers without having to revalidate your entire problem domain.
 

iljitsch

Ars Tribunus Angusticlavius
9,637
Subscriptor++
Overall, this is an impossible problem. It would be much better to realize that we live in a world that changes and, rather than trying to figure out how to encase things in amber, figure out how to make sure the constraints you care about can be enforced on a rapidly changing system.

Why on earth should things be rapidly changing?

All the relevant computer science was pretty much done by the late 1960s. Most of the languages in wide use today already existed in the 1990s. Yes, hardware has become faster, but for stuff that just needs general compute that's all just more speed, nothing that concerns the code. The only interesting thing is that we have much more memory and now can / must use 64-bit pointers to address it all.

The big changes have been the improvements in graphics and other special purpose performance and the need address those capabilities in new ways to take advantage of that, and networking which opened up a Pandora's box of security issues. But there are ways to isolate yourself from those issues.

I really find it offensive that perfectly good code from a few decades ago won't run anymore because people took it upon themselves to make incompatible changes to the underlying systems and languages. That means either the people who made the original designs were lazy or the people who later made the changes were lazy.

And conversely, when I was working on a little file conversion project this summer it gave me great joy that the C code (stdlib and a handful of POSIX calls) compiled and ran fine both on my Amigas from the early 1990s and my current Macs.
 

AndrewZ

Ars Legatus Legionis
11,860
Overall, this is an impossible problem. It would be much better to realize that we live in a world that changes and, rather than trying to figure out how to encase things in amber, figure out how to make sure the constraints you care about can be enforced on a rapidly changing system.

Why on earth should things be rapidly changing?

All the relevant computer science was pretty much done by the late 1960s. Most of the languages in wide use today already existed in the 1990s. Yes, hardware has become faster, but for stuff that just needs general compute that's all just more speed, nothing that concerns the code. The only interesting thing is that we have much more memory and now can / must use 64-bit pointers to address it all.

The big changes have been the improvements in graphics and other special purpose performance and the need address those capabilities in new ways to take advantage of that, and networking which opened up a Pandora's box of security issues. But there are ways to isolate yourself from those issues.

I really find it offensive that perfectly good code from a few decades ago won't run anymore because people took it upon themselves to make incompatible changes to the underlying systems and languages. That means either the people who made the original designs were lazy or the people who later made the changes were lazy.

And conversely, when I was working on a little file conversion project this summer it gave me great joy that the C code (stdlib and a handful of POSIX calls) compiled and ran fine both on my Amigas from the early 1990s and my current Macs.

This is a very conservative perspective with many incorrect assumptions baked in. With this attitude you will continue to be offended, and probably not make progress on your goal to achieve technology resilience.
 

Apteris

Ars Tribunus Angusticlavius
9,591
Subscriptor
Why on earth should things be rapidly changing?
Economics. People are willing to pay for improvements to hardware and software, and as such the market is moving as fast as it can.

All the relevant computer science was pretty much done by the late 1960s. Most of the languages in wide use today already existed in the 1990s. Yes, hardware has become faster, but for stuff that just needs general compute that's all just more speed, nothing that concerns the code. The only interesting thing is that we have much more memory and now can / must use 64-bit pointers to address it all.
It can't be denied that the late 60s/early 70s were a golden age for computer science, but so is today, I would argue. Similarly, yes, there are languages that have existed for a long while, but there also exist new languages which show promise and which are fun to use. (And there is also probably a _good_ programming language, out there somewhere.)

Regarding "the only interesting thing", you might find this article informative: What's new in CPUs since the 80s?

I really find it offensive that perfectly good code from a few decades ago won't run anymore because people took it upon themselves to make incompatible changes to the underlying systems and languages. That means either the people who made the original designs were lazy or the people who later made the changes were lazy.
Requirements for hardware and software evolve continuously, and the hardware and software follow them. Maintaining backwards compatibility is one concern among many, which needs to be weighed and paid for. The Windows OSs are very good at running software from a long time ago because that's part of how Microsoft attract developers to their platform. macOS is less good at backwards compatibility because, I think, of a philosophical difference, but also because Apple want to sell you an integrated product (hardware + software + experience), not just a OS.

I too appreciate backwards compatibility and like when it's there. I'm interested in how to preserve software, for future generations to use and enjoy. But this is not the only thing worth having. I also like new and fast hardware platforms that can do things that weren't possible before.
 

Lt_Storm

Ars Tribunus Angusticlavius
21,346
Subscriptor++
Why on earth should things be rapidly changing?
Economics. People are willing to pay for improvements to hardware and software, and as such the market is moving as fast as it can.

This isn't just economics. The reality is that software is developed imperfectly and bugs that you didn't notice can suddenly need to be fixed. Moreover, as people, companies, practices, and laws come and go, the situation behind the development of the software also changes. In order to survive this change that is inherent in any society, the software used by that society must also change. There is no escaping this need for change, the only thing that can be done is to make it as simple as possible to adapt.
 

iljitsch

Ars Tribunus Angusticlavius
9,637
Subscriptor++
Lt_Storm: that makes no sense whatsoever. My complaint is that perfectly good old software stops working because its dependencies change in ways that are not backward compatible. So the issue is not that things don't work so they need to be changed, but things do work so they need to be not-changed!

Now of course most software that keeps being used over a long time usually requires changes. But then still it's much better for the underlying stuff to be stable so the changes to the application can be as limited as possible, with no undue testing.

Disposable software is just as much of a scourge on society as disposable physical products. But of course just as much of a business model for the producers: make something that's cheap rather than good, and people come back for more when it breaks! What could be better than that.
 

Apteris

Ars Tribunus Angusticlavius
9,591
Subscriptor
This isn't just economics. The reality is that software is developed imperfectly and bugs that you didn't notice can suddenly need to be fixed. Moreover, as people, companies, practices, and laws come and go, the situation behind the development of the software also changes. In order to survive this change that is inherent in any society, the software used by that society must also change. There is no escaping this need for change, the only thing that can be done is to make it as simple as possible to adapt.
Granted. I happen to think that the economy is the main driver of the type of change in circumstances that results in software changes, but I don't disagree with any of the above.

perfectly good old software stops working because its dependencies change in ways that are not backward compatible.
Only if you change said old software to use the new dependency. If you leave the old software as it is -- i.e. the version of the software, all of its dependencies, and the operating system it runs on -- it will run until the underlying hardware fails.

Disposable software is just as much of a scourge on society as disposable physical products. But of course just as much of a business model for the producers: make something that's cheap rather than good, and people come back for more when it breaks! What could be better than that.
Yeah, I don't know about that. People do actually prefer using good software over bad software, and will do so if an alternative exists. Lock-in is more difficult to achieve with software than with other goods, so if your product really is "cheap rather than good" people are likely to move to "fair-priced and good" as soon as they can.
 

Klockwerk

Ars Praefectus
3,763
Subscriptor
Are we talking about code that's network isolated, or not-internet addressable, or on the internet?

If it's an application or service that's network isolated (and doesn't change) then the code can be any language you want, C or otherwise.

If it's an internal network only service or application, then it's going to have to continually maintained - operating systems will change and require updates for security, if it communicates using windows file shares then the SMB protocol gradually changing (SMB1 going away because it's a security nightmare). If it's internet addressable then it's going to have (or should) continual maintenance as security protocols change, as authentication methods change, as the underlying operating systems change.

From that - if the code is written in a language that is flexible enough to deal with these sorts of issues then it's good and if there are people who know how to write it available at a price that can be afforded.
 

Entegy

Ars Legatus Legionis
18,256
Lt_Storm: that makes no sense whatsoever. My complaint is that perfectly good old software stops working because its dependencies change in ways that are not backward compatible. So the issue is not that things don't work so they need to be changed, but things do work so they need to be not-changed!

But that's impossible. Environments change. Hardware changes. Developers change. Clients change. Needs change. Goals change.

Change is inevitable.

What makes sense to code today might not in 5, 10, 20 years time. What's going to happen to banks when the COBOL developers die out? Their code has lasted decades, but now it's become a serious risk as no one knows the systems like they did. How many new COBOL-only developers are being minted?

So you write, as you say, in C. Ignore platform-dependent and precompiled libraries, write all the code yourself. What boss is going to accept that today? Programmers are told to stop reinventing the wheel anyway, and here that seems to be the solution.

And as hardware gets better/more efficient and data sets get larger... Well, one thing we're dealing with right now is old, old report compilation stuff. It's for loops that look at the entirety of the company's sales to make really nice reports and year-over-year comparisons. 10 years later and that report barely runs as it's processing the entire company's history every day on a single thread, often crashing due to out of memory exceptions. It's being replaced by something newer soon.

But what could have been done back then? Say to a startup with little money "go buy a rockstar developer to build code that will last forever?"

We can easily look at things with hindsight, but foresight is very limited.

Or, another example. I had a boss that loved Windows 3.1. In his words, it never crashed on him, was very stable, and didn't require monthly patches. He's the kind of guy that calls new features in software that he personally doesn't like "bloat". What he fails to mention is that Windows 3.1 wasn't exposed to the Internet 24/7 to find all its flaws, and that OS does so little compared to what we expect from our computers today. It's also a funny example because yes, Microsoft strives for backwards compatibility, but they do break things. You're not going to be watching 1080p YouTube on a Windows 3.1 machine. And hey 32-bit Windows client is finally out the door so there goes all that 16-bit software!
 

Jehos

Ars Legatus Legionis
55,560
Lt_Storm: that makes no sense whatsoever. My complaint is that perfectly good old software stops working because its dependencies change in ways that are not backward compatible. So the issue is not that things don't work so they need to be changed, but things do work so they need to be not-changed!
If you think your code is perfect, you're not looking very hard for the bugs. If you start from the assumption that bugs are there and therefore your code will need to be maintained over time, you'll do a lot better.

Separately, there's the whole other problem of your code staying static but the world around it changing.
 

iljitsch

Ars Tribunus Angusticlavius
9,637
Subscriptor++
So how long should I keep looking for bugs and not finding any?

But I'm not arguing for code to be poured in concrete so it can never be changed. What I'm looking for is a set of practices that will let me write code with a decent expectation that that code will still run unmodified one and two decades from now and hopefully even longer.

That means all hardware and all OSes will be replaced by then, so preferably the executable and definitely the source code should be agnostic about such details. And of course the language should still be available and not have changed in a backward incompatible way.
 

AndrewZ

Ars Legatus Legionis
11,860
I'm guessing the COBOL network code specialists don't come cheap these days...
IBM updates their COBOL compiler on a regular basis. When that happens the old compiler is no longer supported. That means all COBOL programs must be recompiled, and rewritten if necessary, to compile against the updated compiler. Even COBOL programs that run fine must be updated.
 

AndrewZ

Ars Legatus Legionis
11,860
So how long should I keep looking for bugs and not finding any?

But I'm not arguing for code to be poured in concrete so it can never be changed. What I'm looking for is a set of practices that will let me write code with a decent expectation that that code will still run unmodified one and two decades from now and hopefully even longer.

That means all hardware and all OSes will be replaced by then, so preferably the executable and definitely the source code should be agnostic about such details. And of course the language should still be available and not have changed in a backward incompatible way.
You are holding a candle in the wind getting upset that the candle blows out.
 

iljitsch

Ars Tribunus Angusticlavius
9,637
Subscriptor++
All of this is especially bad as it's possible to virtualize old machines and old OSes, but for current ones that's quickly becoming more problematic with all the cryptographic checks that the boot process and OSes are enforcing.

Do we really want to live in a world where Star Wars goes away when George Lucas dies, or just can be bothered to update it anymore?

(Yes, slight hyperbole, but only slight.)
 

MilleniX

Ars Tribunus Angusticlavius
8,139
Subscriptor++
So how long should I keep looking for bugs and not finding any?

But I'm not arguing for code to be poured in concrete so it can never be changed. What I'm looking for is a set of practices that will let me write code with a decent expectation that that code will still run unmodified one and two decades from now and hopefully even longer.

That means all hardware and all OSes will be replaced by then, so preferably the executable and definitely the source code should be agnostic about such details. And of course the language should still be available and not have changed in a backward incompatible way.
x86 binaries compiled for Linux and Windows from 20 years ago absolutely could still run today on their present incarnations!
 

AndrewZ

Ars Legatus Legionis
11,860
So how long should I keep looking for bugs and not finding any?

But I'm not arguing for code to be poured in concrete so it can never be changed. What I'm looking for is a set of practices that will let me write code with a decent expectation that that code will still run unmodified one and two decades from now and hopefully even longer.

That means all hardware and all OSes will be replaced by then, so preferably the executable and definitely the source code should be agnostic about such details. And of course the language should still be available and not have changed in a backward incompatible way.
x86 binaries compiled for Linux and Windows from 20 years ago absolutely could still run today on their present incarnations!
And you know this because you've been actively building 20 year old packages :confused:

https://www.osnews.com/story/134516...ay-drivers-can-no-longer-even-properly-build/
 

Lt_Storm

Ars Tribunus Angusticlavius
21,346
Subscriptor++
perfectly good old software stops working because its dependencies change in ways that are not backward compatible.
Only if you change said old software to use the new dependency. If you leave the old software as it is -- i.e. the version of the software, all of its dependencies, and the operating system it runs on -- it will run until the underlying hardware fails.

Or some clever fellow figures out a new exploit like row hammer and you have to rewrite to fix it. Or alternately, your dependency suffers some bug like that log4J bug recently. Or alternately, someone changes the law in such a way that how your software works is illegal.

It's true you don't ever need to migrate to new dependencies, but, no matter what, even if you don't use a single external dependency, you need to be able to change your software. Making code live forever is impossible because you are a stupid human who will mess up.

Disposable software is just as much of a scourge on society as disposable physical products. But of course just as much of a business model for the producers: make something that's cheap rather than good, and people come back for more when it breaks! What could be better than that.
Yeah, I don't know about that. People do actually prefer using good software over bad software, and will do so if an alternative exists. Lock-in is more difficult to achieve with software than with other goods, so if your product really is "cheap rather than good" people are likely to move to "fair-priced and good" as soon as they can.

Moreover: good software is generally good because it was designed to make it really easy to change and really easy to verify after it has been changed. This is fundamentally how we cross this T: if we live in a changing world, then the best way to have a software system survive for the next hundred years is to make easy to change, which is to say: adaptable.

Iljitsch: do not mistake 'unchanging' for being the same thing as 'good'. No part of such a good system is designed to make it's code immortal, instead, we use the opposite assumption and make replacing and changing code and dependencies as easy as possible. In so doing, we ensure the code has quality because any part of the system that causes problems will be rewritten or replaced until it doesn't. This system, after a decade of active development, won't have exactly the same code that it had a decade ago, but, there will still be parts of it that are unchanged. The best design ideas we had will stick around, and our mistakes will be replaced.

So how long should I keep looking for bugs and not finding any?

If you have never deployed buggy code to production, then, congratulations, I guess you should be the one telling us how you managed to make code that lives forever. Otherwise, I would recommend that you avoid trying to make your code live forever because, again, we are all just stupid apes who try and occasionally fail to avoid writing buggy code. Thank god that, when we do fail, that buggy code (hopefully) doesn't live forever.

But I'm not arguing for code to be poured in concrete so it can never be changed. What I'm looking for is a set of practices that will let me write code with a decent expectation that that code will still run unmodified one and two decades from now and hopefully even longer.

And yet, this poured in concrete strategy is *exactly* how people usually try to make systems that 'must run unchanged for decades'. And it causes all the problems one might expect such software to create: from interoperability issues because it requires an insecure version of Windows 98, to maintenance issues when the machine that happens to run that old software finally gives out. The better solution is to drop this requirement and figure out how to write high quality software that can be updated easily as needed. Oh, and to make sure you have the source code for the drivers of expensive machinery.

That means all hardware and all OSes will be replaced by then, so preferably the executable and definitely the source code should be agnostic about such details. And of course the language should still be available and not have changed in a backward incompatible way.

Of course the software should be agnostic about OS details where possible. It's just that you aren't doing this to make it so the code will "live forever". Instead, that happens just so you can support both Windows and Linux.

As for language and library backward compatibility: there are upsides and downsides. On one hand, it means that language design issues can never really be fixed; this can be a serious problem. On the other hand, python's Python 2 vs 3 divergence was a bad idea. If you are going to do such things, then you probably need to either write a backport / forwardport library or code generators to handle the migration. After all, getting every downstream system updated for such changes is really hard.
 

iljitsch

Ars Tribunus Angusticlavius
9,637
Subscriptor++
The better solution is to drop this requirement and figure out how to write high quality software that can be updated easily as needed.
Not even one of the richest companies in the world, i.e., Apple, can manage that. Many code bases are so insanely large and all non-trivial code is so complex that making changes all but guarantees new bugs.

I'm not buying the "oh, security!" thing. Obviously there is code for which this is extremely relevant and a lot more for which is it is surprisingly more relevant than expected. But some stuff isn't exposed to anything that will trigger security issues. (I certainly hope all SQL injections are handled before the code that calculates my income tax is run.)

When given the choice between "works, but security issues" and "no security issues, but doesn't work", don't think that 100% of all users will choose the latter.

Requiring perfect state of the art security means that a lot of software will fall by the wayside because there's nobody who is prepared to pay for that ongoing cost.

The implicit expectation that software must be updated continuously means that very large classes of software will no longer be viable.

I mentioned I wrote some code that runs on 30 year old Amigas. Find it here on Aminet, a distribution platform for Amiga software. Lots of it is from the 1990s... and still works!

My code is definitely not bug-free, but it's very unlikely I'm going to revisit it as it accomplishes what I intended for it to accomplish and I'd rather spend time on a new project rather than spend time making an existing one 1% better. I'm sure there are buffer overflows. But who cares? This is non-critical software intended to run on non-critical systems to do non-critical work. Also, it doesn't touch the network, that always helps.

(I actually did most of the development on the Mac as even my upgraded Amigas are so slow, but hey, both platforms run standard C and I only had one serious platform-specific bug despite the endianness difference.)

And for anyone who is going to look at that code: please realize there's a reason that after software engineering school, I decided to go into networking. :p
 

Lt_Storm

Ars Tribunus Angusticlavius
21,346
Subscriptor++
TLDR: The underlying point here is that by designing software for readability, clarity, and change, we make it more likely that software will work well today and into the future. Moreover, by building on such foundations, we make it more likely that the things we build won't need to change very much and what changes do need to happen will be more isolated. Designing something to make it unchanging makes it fragile and that means you will have to throw it away. Software that is easy to read, easy to maintain, and easy to change is more likely to live forever without changes than software that is none of those things.

The better solution is to drop this requirement and figure out how to write high quality software that can be updated easily as needed.
Not even one of the richest companies in the world, i.e., Apple, can manage that. Many code bases are so insanely large and all non-trivial code is so complex that making changes all but guarantees new bugs.

And this is the flaw in your thinking. If you system crosses the threshold* where all changes introduce bugs, then it is impossible to get it to work correctly in the first place. In order to just get high quality working software, you need to be able to change it, so you need to learn how to deal with that need to change it. If you don't, then your software will be crap, and crap *cannot* survive the test of time.

* Also, it's worth noting: what that threshold will be depends on how well your software is built. If you build it well, then it can be more complex. If you build it poorly, this threshold will be lower and it will collapse sooner. To make it well, you need it to be easy to change.

I'm not buying the "oh, security!" thing. Obviously there is code for which this is extremely relevant and a lot more for which is it is surprisingly more relevant than expected. But some stuff isn't exposed to anything that will trigger security issues. (I certainly hope all SQL injections are handled before the code that calculates my income tax is run.)

When given the choice between "works, but security issues" and "no security issues, but doesn't work", don't think that 100% of all users will choose the latter.

First, "works, but security issues" = "doesn't work". If you have security issues, then the output of your code *CANNOT BE TRUSTED*. Someone will eventually find your vulnerabilities, and then they will fuck with the output. Security is an essential piece of working.

Moreover, "works" is a moving target. So, if you have software that "works" but is hard to change, well then, congratulations, you can calculate taxes in 2022, too bad that the tax codes in 2026 will be different and your software won't work anymore.

This is why readability and modifiability are actually more important than "works". In a changing world, what works today will not work tomorrow. And because we write bugs, even getting something that works today is difficult and usually requires modification. So, just to get to "works" (the first time) you are going to need to change the code, that means you will have to read it and modify it. And then, you never know when some foundational principal behind that definition of works will suddenly change; the government passes a new law, and now your company is going to get fined a million dollars a day for each day it takes to get to the new definition of "works".

So, again, focus on making your code easy to read and easy to change. If you do, it might even live forever. If you don't, it will be crap to be quickly discarded when some security vulnerability is discovered, one of your bugs breaks it, or the law changes.

Requiring perfect state of the art security means that a lot of software will fall by the wayside because there's nobody who is prepared to pay for that ongoing cost.

And this is why we don't require that demanding people get it right the first time is a bad idea. Instead, we write the source code well enough that, when an expensive vulnerability is discovered (or the definition of "works" changes), someone can easily read that code, easily find the problem, and easily write a bug free patch.

The implicit expectation that software must be updated continuously means that very large classes of software will no longer be viable.

I mentioned I wrote some code that runs on 30 year old Amigas. Find it here on Aminet, a distribution platform for Amiga software. Lots of it is from the 1990s... and still works!

My code is definitely not bug-free, but it's very unlikely I'm going to revisit it as it accomplishes what I intended for it to accomplish and I'd rather spend time on a new project rather than spend time making an existing one 1% better. I'm sure there are buffer overflows. But who cares? This is non-critical software intended to run on non-critical systems to do non-critical work. Also, it doesn't touch the network, that always helps.

If you want to know why the majority of software is crap that won't last ten years, you just explained the phenomena. Most software developers don't care enough about their craft to write quality software. They think that if they can get it to barely cross the most minimal 'works' threshold, then that is good enough. Then they are shocked when something built on that flimsy foundation collapses.

To be clear here: if you want software that lives forever, then it needs to be better than that. Authors generally know that their first draft is going to be insufficient. I never understand why software developers are stupid enough to assume that their first draft should be the published edition.

If you don't rewrite your code, it will be flimsy crap. So prioritize making it readable and rewriteable before making it work, because "works" is far too low a bar for software. If you do that well enough, you might even find that it will work really well and be living in the system a decade from now unaltered.

Edit: added TLDR
 

iljitsch

Ars Tribunus Angusticlavius
9,637
Subscriptor++
No, it's designing things under the assumption "we can always fix it later" that makes for poor code.

Now the bug discussion is unwinnable: either I say my code is perfect and I'll be classified as delusional, or I say it's not perfect and then I'm a maker of bad code.

The project in question is a little tool to convert old Amiga icons to newer encodings of Amiga icons. I had tons of trouble with especially the older one of the two newer encodings, which encodes binary data in text strings. Eventually I just wrote my own decoders in order to be able to test the encoders. And still for the life of me I couldn't get the run length compression encoding to work for the first type. So I disabled the compression off and the tool seems to do what it needs to do. Did I test it with 1000 icons? No, just a couple dozen. Am I confident that it catches all corner cases? Not very. But like I said, it seems to do the job, and spending any more time on it would be a bad investment.

Now obviously if this was part of a commercial product then the bar would be higher.

By using standard C and only stdlib (well, there are a few POSIX calls for better error handling but those are optional) I'm prettty confident that this thing will still be able to run in 2030 or 2040 if anyone cares. But even though this is a lot of low level bit manipulation, writing in C still was far from ideal. I guess Java will also still be available in 2030 and 2040, but I never got beyond "hello world" in Java but then people would have to install Java to run the program...
 

Entegy

Ars Legatus Legionis
18,256
You have written a tool pointed squarely at the past and declared it can live forever. Write something for Windows or macOS, and see how long it lasts without you ever modifying the code at all.

Now the bug discussion is unwinnable: either I say my code is perfect and I'll be classified as delusional, or I say it's not perfect and then I'm a maker of bad code.
No, there is not two options here. Like any product: "I know it has flaws, but I have something I can be proud to release." Having bugs doesn't automatically make it bad code. There has never been such a thing as a perfect product, code, hard tool, or otherwise. There is always iteration, improvements, steps back, iteration again. Absolutely nothing is static.
 

iljitsch

Ars Tribunus Angusticlavius
9,637
Subscriptor++
You have written a tool pointed squarely at the past and declared it can live forever. Write something for Windows or macOS, and see how long it lasts without you ever modifying the code at all.
My point exactly. Why would anyone use the native Windows or MacOS GUI environment for an app unless they have to?
 

iljitsch

Ars Tribunus Angusticlavius
9,637
Subscriptor++
Well, there's bad and there's worse.

Still no reason to break backwards compatibility for languages and OSes. The chance that this makes imperfect code run better is negligible, the chance that the new OS is buggy is huge, and the chance that the combination triggers new bugs is significant.

Just leave well enough alone.

Apple created MacOS in 1984. When did Microsoft create Windows? 1990 or something?

We're now 3 decades further and still these two companies that count their billions by the hundreds find it necessary to keep changing everything all the time, creating huge problems for their developers and significant inconvenience for their end users. What is wrong with these people? What is wrong with us that we keep buying their stuff?

</rant> (for now)
 

Haas Bioroid

Ars Tribunus Militum
1,792
Subscriptor
Well, there's bad and there's worse.

Still no reason to break backwards compatibility for languages and OSes. The chance that this makes imperfect code run better is negligible, the chance that the new OS is buggy is huge, and the chance that the combination triggers new bugs is significant.

Just leave well enough alone.

Apple created MacOS in 1984. When did Microsoft create Windows? 1990 or something?

We're now 3 decades further and still these two companies that count their billions by the hundreds find it necessary to keep changing everything all the time, creating huge problems for their developers and significant inconvenience for their end users. What is wrong with these people? What is wrong with us that we keep buying their stuff?

</rant> (for now)

I'm tempted to say that limiting language and API to POSIX-compliant C is its own set of problem. As a dev, I prefer the problems of an ever-evolving advanced framework and language than the ones of a low-level programming language with a minimal system API.

By the way, C (+ POSIX) have been the way of portability for decades, but even this is not set in stone.
 

Klockwerk

Ars Praefectus
3,763
Subscriptor
Well, there's bad and there's worse.

Still no reason to break backwards compatibility for languages and OSes. The chance that this makes imperfect code run better is negligible, the chance that the new OS is buggy is huge, and the chance that the combination triggers new bugs is significant.

Just leave well enough alone.

Apple created MacOS in 1984. When did Microsoft create Windows? 1990 or something?

We're now 3 decades further and still these two companies that count their billions by the hundreds find it necessary to keep changing everything all the time, creating huge problems for their developers and significant inconvenience for their end users. What is wrong with these people? What is wrong with us that we keep buying their stuff?

</rant> (for now)

I like being able to watch video with sound at 1080p in my browser like Netflix. Try doing that on hardware and software from the year 2000.

I like being able to connect to my bank over a secure channel. Try doing that on an operating system from 10 or 15 years ago.

Every single backwards compatibility is a potential exploit or yet another code path that needs to be tested for bugs. Keeping old cruft around is how you get ATMFD exploits (Adobe Type Manager Font Driver).

If you want to not deal with change, it's pretty simple - don't connect your devices to any network and hope that the hardware lasts as long it's needed.
 

Entegy

Ars Legatus Legionis
18,256
You have written a tool pointed squarely at the past and declared it can live forever. Write something for Windows or macOS, and see how long it lasts without you ever modifying the code at all.
My point exactly. Why would anyone use the native Windows or MacOS GUI environment for an app unless they have to?
Because you develop for other humans, and most users of those platforms are not developers and expect a GUI* with Internet connectivity. Computers have evolved far beyond the time when we needed to name apps cp because longer names actively ate into memory and disk space.

And I've already made the point about reinventing the wheel. Let's take datetime handling for example. Are you really going to do that yourself in C in 2022? Or, do you use the OS native library, which has far more development effort, man-hours, and is constantly maintained? Why would any one take on rewriting datetime code themselves for other than some masochistic desire for "pure" code?

Your small icon decode/encode utility sounds fine for this kind of pure ideology. An OS, or commercial software has different expectations.

*I was going to say users expect some kind of platform-native UI, but the proliferation of Electron proved that isn't needed for success.
 

Jehos

Ars Legatus Legionis
55,560
If you want to not deal with change, it's pretty simple - don't connect your devices to any network and hope that the hardware lasts as long it's needed.
Indeed. In that situation, your best bet is probably to just melt down your computer, forge it into an axe, and go build a log cabin somewhere.

Software is never buy it for life.
 

Apteris

Ars Tribunus Angusticlavius
9,591
Subscriptor
The notion that software MUST be ephemeral really annoys me.
Well, one thing you could do is take software you care about -- whether that is a utility, a line of business application, a game, whatever -- and make sure it can run on the latest OSs and platforms. Write a patch, or make a configuration change that gets it running, or fix its Wine support. Then, once you get said software running on all platforms you think should support it, move on to the next piece of software.

That way, you can contribute to software longevity. And I think you'll feel good about it as well.

I care about software longevity too, by the way: I consider video games to be cultural artifacts and I want to be able to play yesterday's and today's games 50 years from now. But it will take a bunch of work to achieve it.