Programming languages

For those of you who write programs, for sys admin tasks, or other fun things, what languages do you like?

For most of my career, it’s been shell, C and Perl.

But lately I’ve discovered Crystal - a beautiful and elegant Ruby-like language, but with better performance.

So, in addition to working through the crystal lessons on exercism, I’ve been going through the drill of replacing all my shell and perl Nagios scripts with crystal equivalents.

Good times

5 Likes

I’ve mostly worked with PHP and Python myself, but I’ve been learning BASH more recently so I’ve been challenging myself to do scripts in pure BASH without any forks/execs where possible and I’ve really enjoyed that challenge. I’ve also been picking up some Rust as well, which I’ve also enjoyed learning.

Perl is on my list of languages to learn though!

4 Likes

Perl is very handy, and was at one time called “the duct tape of the internet”

5 Likes

Every time I’ve seen someone use Perl, I am amazed at what it can do and how versatile it is. That’s on top of how blazingly fast it seems to do those things. I can’t wait to get around to it!

5 Likes

Usually writing in Bash or C , ( or both in the same application). :slight_smile:
bash, because it is for me the software equivalent of LEGO®
C, because it enables me to create my own bash commands. :grin:

The choice of C and bash means that what I wrote 10 years ago will still run in the coming 20 years without any modifications or rewrites.

Often people say that bash is getting unweildy when programming more than one- or twohundered lines of code. I don’t understand that. It is not uncommon for me to end up with over 1200 lines of relatively polished, modular, easily maintainable and structured bash code.

5 Likes

@J_J_Sloan , My primary work-horse language is BASH.

My secondary task-language, my compute work-horse, is C-language.

The two other languages I would love to properly master (but have had issues in that regard) are

  • Python, because of its extensive use as the “connector tissue” for all things technical, especially in the CAD/CAM world! It would allow me to integrate a lot of my past knowledge with FreeCAD, which uses that as its primary development language, at least from the API standpoint.

    (For me, the critical stumbling block is the fact that indentation is meaningful, which for me is an absurd concept, where every language I have previously mastered had definite clause terminator characters for proper nesting delimitation and visibility!).

  • Prolog (or ECLiPSe), because I have felt, for more than 35 years now, that it has so much potential to “break out”, if only there were readily available libraries of pre-defined constant/functional/IO predicates and canned routines for specific application domains, such that the only thing left would be the context-specific task logic to be defined. What I’ve seen (Packs for SWI-Prolog) seems too low-level and not very “cross-domain” portable. I would dearly love to be able to build a simple App for some medical issues of personal interest, like specific dietary intakes for influencing the evolution/trends of some specific medical conditions (please don’t ask what those conditions are).

Benjamin, if you are looking for BASH stuff, did you happen to visit my GitHub repository of various util and admin tools?

5 Likes

I had not seen your BASH repo yet, but I dropped it a star and will be checking it out more in depth over the next few days! I appreciate you sharing this!

I am most definitely not an expert, but I’ve started to put some of the scripts I’ve written in a repo of my own: A collection of BASH scripts I often use. These scripts are definitely not portable haha, but I like having a central place to keep them and keep learning.

4 Likes

Benjamin, I am looking to migrate away from certain “locations”!

How are you finding Codeberg compared to GitHub, if you don’t mind my asking?

Also, can you indicate if those are Business-context oriented, or Personal Desktop-context oriented?

For myself, my code is intended for the latter, but the extent of discipline I use in the coding is from my past multi-national corporate multi-host sysadmin role.



P.S. If your interest carries over into the corporate world, and only if you are interested, I can share (directly) a lot of script and sample data files for a home-built firewall which, while grossly out of date, and, at this time needs some “care”!

Just let me know via private message, or preferrably email.

:slight_smile:

3 Likes

I was also looking to migrate for (what I’m assuming by reading between the lines) the same reasons!

So far, I’m finding Codeberg to be a great alternative. Their migration path is really good, I’ve not had an issue pulling in all history/issues/branches/etc and Codeberg hasn’t really been “down” (GitHub, I’ve found has been frequently “down” over the past few months).

I’d say the only real noticeable difference, for me, is that pushes/pulls are a tad bit slower. I’m not sure if that’s Codeberg’s fault or my own config’s fault, but it’s not a problem nor has it caused any issues with what I’m doing so I’ve left it alone for now.

I’ve only used Codeberg from a personal perspective. I have not had a chance to test it in a business context. My personal use cases have worked just fine though, pushing/pulling/commits/commit history/using Ansible to clone a Codeberg repo/etc has all been just fine.

Needless to say, I’m a fan and would recommend Codeberg!

3 Likes

For about a decade I use Python for the outlined purposes and I never had a desire to switch to something else.

4 Likes

Python works and is popular, nothing wrong with that.

2 Likes

@ericmarceau How lovely to see Prolog mentioned here! I’ve used Prolog in the context of generating ad-hoc explanations for machine learning during my undergraduate studies :slight_smile:

I have also moved my personal work to Codeberg. Aside from supporting their mission, I also love the “simplicity”, in a good way, of their platform. It’s not absolutely riddled with (corporate, AI) features as is the case with GitHub and GitLab.

Personally, my most used programming language is definitely Python at the moment (also for work). I have used Prolog and MATLAB in the past. I started out with Java though (I really wanted to write Minecraft mods and server plugins!) and also learnt a bit of PHP for web development.

4 Likes

Dear JJ, language changes not much. I wonder why such a multitude of languages exists. Paradigms matter more, though people forget and reinvent them, say, like Java reinvented ideas of ALMO. Performance is more often connected with a certain implementation. I can do everything at a low level using C. We can make C memory safe and more efficient though its efficiency with O3 is fantastic. Better is an enemy of good :wink: – Dima

3 Likes

I took a peek at your code, easy on the eyes and relaxing to read.
Beautiful codingstyle. :hugs:
Bookmarked ! :grin:

5 Likes

I took a peek at your code . . . :ok_hand: :+1:

3 Likes

Wow, prolog, that takes me back.

I had prolog in a class my final semester of college. It was a completely different way of thinking, but could solve certain kinds of problems more simply than normal imperative languages.

5 Likes

That’s pretty close to what I’ve done too. I’d say I’ve written more Bash code than anything else. C is probably my most used development language, but I don’t use it a lot. Perl and Python are tools that I use for small scripts; I don’t consider myself an expert in either of them, and my C skills are hardly “expert level” either; I’ve been retired for quite a while now.

3 Likes

I ought to be retired but I have bills to pay and I still enjoy the job.

2 Likes

OMG – Try Julia ! Why do I like it?

  1. The way you can write mathematical code in a LaTeX-like way e.g.: ema(x::Vector{Float64}, x̄ₙ₋₁::Vector{Float64}, α::Vector{Float64}) = (1 .- α).*x̄ₙ₋₁ .+ α.*x
  2. It’s very fast once compiled: So you can write a function at the REPL and the first time you use it, it get compiled and then run, but in all subsequent usages you get the speed of the compiled version, often as fast as C.
  3. When writing applications, they can be pre-compiled or you can create a binary sysimage. This also preserves the execution speed.
  4. The language is designed to help you use good coding patterns (i.e. design patterns).
  5. It uses “multiple dispatch”, which is a bit like, but not the same as, operator over-loading. As well as making the code very easy to read, it helps the compiler to make the executable more efficient.
  6. It was designed from the start to run on multi-core architectures. On a real-time Linux box with dedicated cores for executable code, it is so easy to tell Julia on which core to run what.
  7. Julia supports distributed programming (code that runs on server farms), parallel processing, asynchronous tasks and processes. Also CUDA of course.
  8. It is the “Ju” in “Jupyter”, but it has a fully reactive (using observables and reactive programming) version called Pluto.jl – try it now!
  9. Julia is similar to MATLAB in some ways. In fact, the guys at MIT designed Julia to be FOSS so that scientists and mathematicians could share code freely without users having to buy expensive MATLAB toolboxes.
  10. It solves the two language problem: With MATLAB/Scilab/Octave it was great to prototype ideas, produce plots etc. etc. but in the end you have to re-write everything in C++. Sure you can export your MATLAB code to C++, but who is is responsible for the design, testing, maintenance and support? Julia is FOSS and it’s as fast as C++ (in most cases) – this depends on the code author not being a complete numpty, of course anyone can write slow, inefficient code. Fast Julia is not difficult even for a beginner to write. Anyway – No need for two languages!
  11. Documentation is a synch.
  12. Integration with git is natural and expected.
  13. Works beautifully with VSCode and other IDEs.
  14. Julia is fun to write!

BTW: In my code snippet I annotated all the function arguments with their types. This is not necessary as Julia is designed to be dynamically typed and doing so does not improve the efficiency of the code but it does reduce the size of the image as the compiler already knows what the data-type is and doesn’t have to guess. So my sole reason for laborious annotation of types is purely for readability. The subscripts in my code aren’t variables! They are just intended to make the code readable. This was just cut and paste from a program I was testing. It’s not an exemplar of the best code by any means!

Code is for humans. Binary is for computers.

Edit: P.S. It uses the same low-level virtual machine (LLVM) architecture as Rust.

7 Likes

I’ve noticed, as I go through the crystal challenges on exercism, that a lot of the same tasks that I had to solve in perl are also being presented for crystal.

One simple task was to write a program that takes a date as input, and returns the time/date that would be 1 gigasecond later. Comparing the perl and the crystal code is informative

4 Likes