Live data from Hacker News

Tips for stable and portable software

begriffs.com

11–20 of 63 posts

Re: Tips for stable and portable software

#11
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…

"I'm not sure it makes sense professionally, though, as most codebase won't survive a decade"

That is highly context sensitive. For example CAD packages are generally decades old.

They can't be rewritten from scratch. There is too much code. Too much of it is domain specific. The features can't change or else customer projects worth billions might suddenly go tits up when they migrate to a newer version (customers don't migrate to newer version very often though).

So, if there is some domain specific use case, worth millions to the software vendor and potentially billions to clients then stability is far more critical than keeping the codebase "modern".

Re: Tips for stable and portable software

#12

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.

Re: Tips for stable and portable software

#13
post #5

One day, maybe when I am retired, I am going to develop a programming language-agnostic algorithm specifying language with which you can generate code for programming languages ;-). A kind om Mathematica, but than for software.

Many compilers target C, that seems like a decent approach - any problem with that?

Re: Tips for stable and portable software

#14
post #5

One day, maybe when I am retired, I am going to develop a programming language-agnostic algorithm specifying language with which you can generate code for programming languages ;-). A kind om Mathematica, but than for software.

Like this?

https://github.com/imatix/gsl

Re: Tips for stable and portable software

#15
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?).

Re: Tips for stable and portable software

#16
That forceinline definition is just tip of the iceberg. It's so hard to define in a way that works with different versions of GCC, -Werror, instrumentation, MSVC, and profiling. If you care about portability, consider just not caring and using static. Too much special casing code can actually make it harder for people in weird environments to use your code, since something is going to break it, and reading past the ifdef soup becomes the biggest obstacle.

Re: Tips for stable and portable software

#17
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.

Re: Tips for stable and portable software

#18
Hm, decades is not that much, most enterprise code fits into that. But how about 200 years?

It is about people. Documentation, paper trail why some decisions were made, archiving build tools, VMs, dependency source code..

Also C, POSIX and Motif are terrible choice for their fragmentation. Java is very booring, but compiling and debugging 20 years old code is very common.

Re: Tips for stable and portable software

#19

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…

The changing meanings of compiler flags are a personal pet-peeve, as it leads to strange situations where you have to add both "-Wall" AND "-Wextra".

Still in programs that I expect to be used on wildly different systems I tend to enable all the flags that are common in the development-builds, and be more conservative in the production/deployed version.

Re: Tips for stable and portable software

#20
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.

Post reply on HN