Which high-level language should I choose for server-side systems programming?

John1776

New Member
Joined
Oct 4, 2020
Messages
7
Reaction score
1
Credits
110
I work on a project which a hardware product that runs a Linux OS with custom server-side software. Currently, we have a lot of legacy C code base that is glued together either with linker shenanigans or loosely coupled bash scripts. There are several cons of this solution/current architecture:
* There are many small programs written in C that do not reuse each other's code
* Its old C code base which requires a tremendous effort to maintain and God forbid develop a new feature for an existing program
* Because the programs are written in C they can span thousands of lines of code just to do something that would take a maximum of a few hundred in a more high-level programming language. The actions that most of those programs perform are operations on files, system components like drives/partitions, etc, and typical systems programming

I plan to introduce a higher-level language to take care of such programs. Im considering things like Python, Perl, Lua, Go, etc. But I do not have extensive experience with all of them. My team has quite a lot of experience with Python but given that the project itself has to be easily maintainable for a long term (even up to 10 years) we really want to use a language that will not change much in this period which basically already excludes Python as even fairly new language releases are not being supported.

Thus there are several things we would like our perfect language to be able to do:

* Be able to work with/alongside C/C++
* Be testable. Have some built-in or easily added testing framework just like Pythons Pytest, and maybe additionally be able to test C code if that's even a thing
* Be long-term stable and maintainable
* Have good ongoing and future support
* Be easy to learn and pretty generic
* Capable of performing systems programing
* Be as light-weight as possible, we cannot allow ourselves to have a 500meg runtime
* Have a good ecosystem that supplies the developer with tooling during the development e.g. linters, formatters, packaging etc

I would really like to know your advice on which language we should choose?
 


f33dm3bits

Gold Member
Gold Supporter
Joined
Dec 11, 2019
Messages
4,900
Reaction score
3,526
Credits
35,667

kc1di

Well-Known Member
Joined
May 14, 2021
Messages
1,131
Reaction score
948
Credits
8,097
From my very limited experience in the matter, Rust is much easier to learn and use than python.
 

f33dm3bits

Gold Member
Gold Supporter
Joined
Dec 11, 2019
Messages
4,900
Reaction score
3,526
Credits
35,667
From my very limited experience in the matter, Rust is much easier to learn and use than python.
Someone I know told me I will have an easier time understanding and learning Python if I learn Rust first.
 

Lord Boltar

Well-Known Member
Joined
Nov 24, 2020
Messages
1,795
Reaction score
1,205
Credits
13,368
Here are a few that come to mind Java - C# - PHP - Python - Node.js and Ruby - In general, there is no perfect programming language that will lead your project to success. Every language has its own strengths and weaknesses

There is Kotlin but this is relatively new and finding a coder may prove difficult

Of the main languages I would choose something that has been around for a while has good support, like either Python, Ruby or Rust
 

kc1di

Well-Known Member
Joined
May 14, 2021
Messages
1,131
Reaction score
948
Credits
8,097
To me python is very confusing but as I said I have very limited experience with it and I'm no programmer
 
OP
J

John1776

New Member
Joined
Oct 4, 2020
Messages
7
Reaction score
1
Credits
110
Well we have a problem that of some preconceived notions in the team, and Rust would be unfortunately very hard to introduce, and Python is too unstable itself (aka features being removed and added to the language etc). So something like Ruby sounds good to me. It has to be a simple scripting language
 

captain-sensible

Well-Known Member
Joined
Jun 14, 2019
Messages
2,913
Reaction score
1,969
Credits
18,126
To me python is very confusing but as I said I have very limited experience with it and I'm no programmer
once you have no hair left , due to pulling it out over its indent system and code not running if indent
is either not consistent eh tab mixed with spaces and the fact there is no ";" at the end of lines its not bad.
 

JasKinasis

Well-Known Member
Joined
Apr 25, 2017
Messages
1,514
Reaction score
2,153
Credits
10,890
If you want to get away from C and C++ - then Rust or Go would probably be your best bet if performance is a priority. Both are compiled languages and are suited to systems software development. They also take care of some of the perceived problems/shortfalls of C and C++ and will perform a lot better than scripted languages like Python or Ruby, which are a little slower and can incur a lot of extra overhead.

But if performance is not critical, then Python or Ruby will probably be fine!

That said - as a programming language - C++ has improved a lot over the last few iterations of the C++ standard. Thanks to the introduction of smart pointers - memory leaks are less of an issue than they were. Plus you have lambdas and numerous components from the boost library have been incorporated into the C++ standard. And there is the already mature, standard-template-library and standard containers. So C++ has become slightly more high-level than it used to be. Especially compared to C.

It's a lot easier to write portable, safe/secure, high performance C++ code than it ever used to be. So porting the legacy code-base from C to C++ might also be an option?!

Any valid C program is also a valid C++ program - so you could initially set up the build-system to build the programs as C++, then gradually port individual modules from C to C++.
 
Last edited:

SlowCoder

Gold Member
Gold Supporter
Joined
May 2, 2022
Messages
456
Reaction score
314
Credits
3,611
Not knowing exactly what types of operations you're performing, I'd first see if bash can do it. I know it's not a full programming language, but it's quite capable, using tools most likely already installed, and having a small memory footprint. I think it would tick a lot of the requirements you mentioned.
 

captain-sensible

Well-Known Member
Joined
Jun 14, 2019
Messages
2,913
Reaction score
1,969
Credits
18,126
@CrazedNerd

I've used python for a program on AUR which via the use of a GUI it , depending on which you choose from a drop down list, will update your pacman mirror list for repositories .I also wrote in python a program to help very young kids learn their ABC . via the use of buildozer i converted python to a .apk for Android file.
 

CrazedNerd

Gold Member
Gold Supporter
Joined
Mar 31, 2021
Messages
593
Reaction score
235
Credits
5,017
@CrazedNerd

I've used python for a program on AUR which via the use of a GUI it , depending on which you choose from a drop down list, will update your pacman mirror list for repositories .I also wrote in python a program to help very young kids learn their ABC . via the use of buildozer i converted python to a .apk for Android file.
I've been learning the basics of coding over the years in several different languages, currently i'm just interested BASH commands and BASH scripting, i made the comment about python because i've realized it has very widespread use, lots of different programs and servers are set up for python interpretation...i even read that Netflix uses python, which seems kinda weird to me given what a high level language it is.
 

dos2unix

Well-Known Member
Joined
May 3, 2019
Messages
1,472
Reaction score
1,074
Credits
9,160
But if performance is not critical, then Python or Ruby will probably be fine!

If performance matters, then compiled byte code will always beat interpreted run time languages.

i'm just interested BASH commands and BASH scripting,

Not sure Bash qualifies as "high level" :) I use it more than anything else. It is handy for a lot of things.
But you can't do things like make system calls directly. Most of the time you're really calling other binaries
to do something for you with bash.
 

SlowCoder

Gold Member
Gold Supporter
Joined
May 2, 2022
Messages
456
Reaction score
314
Credits
3,611
If performance matters, then compiled byte code will always beat interpreted run time languages.
Absolutely.
Not sure Bash qualifies as "high level" :) I use it more than anything else. It is handy for a lot of things.
But you can't do things like make system calls directly. Most of the time you're really calling other binaries
to do something for you with bash.
Yes, Bash relies on other binaries to do stuff. And that makes it practically extensible. Need to process image batches? Install imagemagick. Need to parse text? sed and awk. Linux makes this type of stuff too easy.

Bash is an interpreted script, but the binaries it runs aren't. It's sort of a mixed bag, and might depend on how you prioritize data processing needs.
 

gvisoc

Well-Known Member
Joined
May 29, 2020
Messages
433
Reaction score
507
Credits
4,442
Thus there are several things we would like our perfect language to be able to do:

* Be able to work with/alongside C/C++
* Be testable. Have some built-in or easily added testing framework just like Pythons Pytest, and maybe additionally be able to test C code if that's even a thing
* Be long-term stable and maintainable
* Have good ongoing and future support
* Be easy to learn and pretty generic
* Capable of performing systems programing
* Be as light-weight as possible, we cannot allow ourselves to have a 500meg runtime
* Have a good ecosystem that supplies the developer with tooling during the development e.g. linters, formatters, packaging etc

I would really like to know your advice on which language we should choose?
I have some bias as my whole career has been around Java. Here it is, point to point to the requisites:
  • Java is interoperable with C/C++ in several ways. You can link and invoke native code through the JNI (Java Native Interface) and it's pretty good on the sockets SDK, so you can also stick to the protocol level, if you have the chance to do so.
  • It is testable. There are lots of frameworks to all the testing phases: Unit/Component (JUnit, TestNG,...), Contract (Pact-JVM),... and if you combine your project with Docker, you can spin up containers with the dependencies (e.g.: a database) to be able to test everything on your machine or on the pipeline's machine
  • Current Java Long Term Support (LTS) is Java 11, and soon to be Java 17. It is maintainable and there are companies that give support on JDK implementations, like Red Hat and Oracle of course.
  • It is easy to learn, but it has a lot of boilerplate code. There is a big use case for IDE and plugins for autocompletion. You can also check out "simplified forks" like Kotlin.
  • Systems programming in Java depends a lot on what you place in that scope. You can provide low level services to user space processes, either through a socket protocol, providing a client library or through systemd if you're so much into encapsulating your process on a systemd service, but I'm afraid it's way outside of the kernel space.
  • I am afraid it is not that lightweight when compared to non-VM languages. It runs on the Java Virtual Machine, and while it is highly performant thanks to flags like the JIT compiling, where the JVM itself optimises the bytecode as it runs, and while there are real-time JVM implementations, the process footprint is higher than a native binary. Not 500 MB in memory, but sensibly heavy (in the dozen to the hundred MB footprint for an executable that follows the UNIX-philosophy of do one thing but do it well)
  • The ecosystem is truly massive, we're talking about a language that has been in the top-3 of enterprise application development for about 20 years. You have linters, formatters, code coverage tools, packagers, build automation tools, lots of useful dependencies, frameworks, ides,... just kick to the air and you'll hit some Java cr*p!
However, your lightweight requirements are concerning. I'd recommend to play with it a bit.
 

dos2unix

Well-Known Member
Joined
May 3, 2019
Messages
1,472
Reaction score
1,074
Credits
9,160
Current Java Long Term Support (LTS) is Java 11, and soon to be Java 17. It is maintainable and there are companies that give support on JDK implementations, like Red Hat and Oracle of course.

I thought 17 already has been for a while.


It is easy to learn, but it has a lot of boilerplate code. There is a big use case for IDE and plugins for autocompletion. You can also check out "simplified forks" like Kotlin.

Easy to learn is kind of subjective :D
 
$100 Digital Ocean Credit
Get a free VM to test out Linux!

Linux.org Hosting Donations
Consider making a donation

Members online


Top