Live data from Hacker News

Tips for stable and portable software

begriffs.com

21–30 of 63 posts

Re: Tips for stable and portable software

#21

I've currently involved with a system, written in C, which has been going for 30 years: GAP - https://www.gap-system.org While I write a lot of C, I immediately disagree with the idea that C has a "simple (yet expressive) abstract machine model". Every so often we find a bug which has been present for over a decade, because some new compiler has added a (perfectly legal by the standard) optimisation which breaks some…

Oh I had a fun one like this just this morning. I have (C++) code spanning back to the early 1990's, although some of it was written (as C) a decade before that. It relies on checking the floating point unit status register for a bunch of its error checking. Turns out that at some point, casts from floating point to integer types started being implemented (by the compiler) using the cvttss2si instruction. And when the floating point value is too large to be represented in the integer, the fpu flag is set to 'invalid'. Which (I assume, from how everything else was implemented) didn't used to happen with whatever instruction(s) were used before SSE. And in my code, this only happens very rarely (basically it needs a combination of rare, rare and very rare circumstances to happen - too tedious to explain, not that anyone cares) so I only got bitten by this this week - probably 15 years after this started happening? And yeah the case is technically undefined behaviour, not that I'm enough of a language lawyer to know. If it hadn't been for some kind soul on SO to point this out I wouldn't even have looked in this direction because the last time this combination happened, it worked (and yeah it turns out that that program where 'it works' was compiled 20 years ago...)

Ugh, just venting, but it helps to know that there are others out there suffering through this :)

Re: Tips for stable and portable software

#22

Really weird that he recommends Motif. Motif is not comparable to Web/Gtk/Qt since it has only the most primitive widgets, and no 3D support. I would propose doing a web-app if you really care so much about compatibility. Web also allows for more custom widgets.

> I would propose doing a web-app if you really care so much about compatibility.

Still better watch your step. Features can be removed from the platform. https://stackoverflow.com/a/46689336/

Re: Tips for stable and portable software

#23

I'm currently "betting" on Go for making a back-end (just a REST API + sqlite database) that will last a decade; I'm betting on the tooling to stay backwards compatible or with minimal changes in the codebase; I'm betting on the readability of my own code for the next decade, and I'm betting on the language + tools to continue to be developed whilst sticking to their original goals. Generics is going to be fun.

> I'm betting on the tooling to stay backwards compatible or with minimal changes in the codebase

This is actually why I'm pretty bullish on things like RoR, Laravel, et al.

The sheer speed at which they go to a new version that breaks BC is actively making the web less secure. I've lost count of how many times I've found a new client with this software that's been working for years but suddenly broke, only to realize it's on an OS that's EOL, using a version of the framework that's EOL and a version of the language that's EOL. And now it's my job to bring it up to speed.

And typically the hardest part of that? The 3rd party dependencies that are either abandoned and don't support the newer versions of anything, or have moved onto Python 3 and no longer support Python 2.

It's why I vastly prefer something like asp.net core. I know in 5-10 years the code will probably just work with the latest version, and if there's an incompatibility, it's going to tend to be relatively small.

Re: Tips for stable and portable software

#24
post #7

This article certainly rings a bell, as I started rewriting my personal projects to C in the last year, precisely because I wanted to make them decades-proof. I still use the same vimscripts I wrote in early 2000', I want the same thing for all my tooling and apps. I'm not sure it makes sense professionally, though, as most codebase won't survive a decade : after three years, the dev team will turn over, and the new…

It's highly dependent on the domain. If you're in a web startup, software won't last 3 years, the next team will systematically rewrite. If you're in the bank, logistics, defense sector, it's very likely the software will go for a decade, as long as it's not killed the first or second year for being a pet project (initial manager left) and having no customer.

> If you're in a web startup, software won't last 3 years, the next team will systematically rewrite.

I have an old man rant about that actually... that rewrite is typically unnecessary if you actually use discipline when developing and learn how to read code.

I once took on a CakePHP 2 app and another developer asked me how in the world I got into, and understood, the framework so quickly. My secret? I read the CakePHP 2 source code. So many developers learn how to do that very well.

Re: Tips for stable and portable software

#25
post #2

> Tips for stable and portable software I think a more accurate title would be "Tips for stable and portable C programs"

The author lists a number of languages considered stable, C being one of them because of widespread support and portability. Java isn't portable for example because it depends on the JVM (and I know GraalVM is a thing but will you still be able to use it in ten years?).

The argument against Java is weak... You can take the latest JVM and run any jar from 1999. Also, Java has had jlink in the latest versions which compiles a runtime that does not require a JVM installation, you don't need GraalVM for that.

Re: Tips for stable and portable software

#26

Really weird that he recommends Motif. Motif is not comparable to Web/Gtk/Qt since it has only the most primitive widgets, and no 3D support. I would propose doing a web-app if you really care so much about compatibility. Web also allows for more custom widgets.

What widgets do you feel are missing from Motif ? And why would it need 3D support ?

Re: Tips for stable and portable software

#27

Earlier quoted context omitted.

It's highly dependent on the domain. If you're in a web startup, software won't last 3 years, the next team will systematically rewrite. If you're in the bank, logistics, defense sector, it's very likely the software will go for a decade, as long as it's not killed the first or second year for being a pet project (initial manager left) and having no customer.

> If you're in a web startup, software won't last 3 years, the next team will systematically rewrite. I have an old man rant about that actually... that rewrite is typically unnecessary if you actually use discipline when developing and learn how to read code. I once took on a CakePHP 2 app and another developer asked me how in the world I got into, and understood, the framework so quickly. My secret? I read the Cake…

> that rewrite is typically unnecessary if you actually use discipline when developing and learn how to read code

"But developers that can exercise discipline and know how to read (and modify) code instead of rewriting cost so much money..." is what you'll typically hear in response to this.

It's cheaper (and often faster) to have cheaper, less disciplined, less experienced developers rewrite something multiple times than it is to have more expensive, more disciplined, more experienced developers write something and maintain it. It's also harder to keep the more experience developers because most developers I work with start looking for another job when their project goes into maintenance.

The typical "we never have enough time/money to do it right the first time but we always have to make the time/money to do it twice" situation.

Re: Tips for stable and portable software

#28

I've currently involved with a system, written in C, which has been going for 30 years: GAP - https://www.gap-system.org While I write a lot of C, I immediately disagree with the idea that C has a "simple (yet expressive) abstract machine model". Every so often we find a bug which has been present for over a decade, because some new compiler has added a (perfectly legal by the standard) optimisation which breaks some…

-pedantic only enables warnings, it cannot change the meaning of code; not even on newer compilers.

Right, but that's not the concern.

You compile your code with -pedantic, it works, and then you distribute the source. A user gets that code, compiles it, it works, and they integrate it into their product. Later, that user upgrades or changes their compiler and your code doesn't build anymore because there's a new warning. Now they have to patch your build.

Re: Tips for stable and portable software

#29

I'm currently "betting" on Go for making a back-end (just a REST API + sqlite database) that will last a decade; I'm betting on the tooling to stay backwards compatible or with minimal changes in the codebase; I'm betting on the readability of my own code for the next decade, and I'm betting on the language + tools to continue to be developed whilst sticking to their original goals. Generics is going to be fun.

> I'm betting on the tooling to stay backwards compatible or with minimal changes in the codebase This is actually why I'm pretty bullish on things like RoR, Laravel, et al. The sheer speed at which they go to a new version that breaks BC is actively making the web less secure. I've lost count of how many times I've found a new client with this software that's been working for years but suddenly broke, only to realiz…

The same reason why my default stack is still Java/Kotlin with Spring and Hibernate. A stable environment, stable runtime that is guaranteed to not change too much and has a culture of backwards compatibility.

Re: Tips for stable and portable software

#30

I've currently involved with a system, written in C, which has been going for 30 years: GAP - https://www.gap-system.org While I write a lot of C, I immediately disagree with the idea that C has a "simple (yet expressive) abstract machine model". Every so often we find a bug which has been present for over a decade, because some new compiler has added a (perfectly legal by the standard) optimisation which breaks some…

-pedantic only enables warnings, it cannot change the meaning of code; not even on newer compilers.

You are right, I mis-remembered what the flag did, sorry.

I've seen projects with -pedantics -Werror, which are particularly annoying (-Werror in general to be honest, I understand why people might want it for CI of course).

Post reply on HN