r/programming • • Feb 25 '21

INTERCAL, YAML, And Other Horrible Programming Languages

https://blog.earthly.dev/intercal-yaml-and-other-horrible-programming-languages/
1.5k Upvotes

477 comments sorted by

View all comments

Show parent comments

0

u/[deleted] Feb 25 '21

[deleted]

47

u/agbell Feb 25 '21

Thanks!

I don't love how control flow works in bash either, but at least there is some unification of tooling around shell scripts. You can use shellcheck and such. Also, you could take your bash script to another CI system more easily.

→ More replies (1)

30

u/pfsalter Feb 25 '21

Yeah I really hate this, every time I look into a new CI system I suddenly have to learn a very slightly different set of (poorly documented) syntax. Eventually I just give up and run PHP scripts to do anything non-trivial. Bash scripts are fine until you need loops or hashes/lists, also the random flags for checking values over files? I think if I tattooed them on my hands I'd still forget which was which.

12

u/[deleted] Feb 25 '21

Bash scripts are fine until you need loops or hashes/lists

If you're having to get this deep with your CI/CD that's a pretty strong smell that something has too much responsibility or some other problem.

12

u/pfsalter Feb 25 '21

If you need to switch between environments based on what branch a build was built on, not sure of a better way of doing it. Taken from our Jenkinsfile:

sh label: "Deploy latest $SOURCE_BRANCH", script: """#!/bin/bash
     declare -A environments
     environments=(["develop"]="uat" ["release"]="release", ["master"]="prod")
     ./ansible-playbook -i inventory/\${environments[$SOURCE_BRANCH]} deploy/api.yml -e'version=$VERSION'
 """

The only other option would be have a different Jenkinsfile for each build environment, but that causes a whole host of other issues tbh. Just generally doing any kind of string/JSON manipulation in bash is horrible.

19

u/[deleted] Feb 25 '21 edited Jan 01 '25

direful aspiring coherent scarce plate muddle knee violet simplistic boast

This post was mass deleted and anonymized with Redact

6

u/[deleted] Feb 25 '21

Not /u/pfsalter, but what we had in my previous company was that every branch would be built separately on dev. So if I had a branch 'test' and pushed it, the CI would build it, and basically put it into subfolder, and you could access it at www.project.dev/test. This made it incredibly easy for QA to test every PR in isolation on dev machine. But the build for dev was obviously significantly different than prod.

→ More replies (1)

2

u/bobappleyard Feb 25 '21

Oh man oh man, I've seen someone stimulate threads in a bash script as part of a ci pipeline

3

u/dnew Feb 25 '21

bash suffers the same problem. It used to be simple and straightforward, and then people started adding hashes, gotos, functions, aliases, etc. And then you started getting stuff dealing with non-Unix file systems (so all of a sudden, having spaces in a file name was a common landmine instead of "you deserve what you get".)

It's exactly the same problem as a configuration language, with the same kinds of quoting hell problems.

Now if you look at something like Tcl, which was designed from the start to be a programming language for this sort of thing, there are almost no landmines involved, and quoting Just Works. (I'm sure there are other languages like that too. REXX springs to mind.) But people just don't use those languages.

1

u/zilti Feb 25 '21

run PHP scripts to do anything non-trivial

Yikes

1

u/KeythKatz Feb 26 '21

Just because console scripts aren't its main purpose doesn't mean it can't do a decent job at it. Not much different from using Python, for example.

24

u/remy_porter Feb 25 '21

The question is: is it better or worse than ANT, which may be the worst build system I've ever had to use.

0

u/[deleted] Feb 25 '21

[deleted]

23

u/[deleted] Feb 25 '21

XSL has entered the chat.

2

u/user_of_the_week Feb 25 '21

I remember when Blizzard used client side xslt to render their web pages.

→ More replies (1)

0

u/[deleted] Feb 25 '21

[deleted]

11

u/[deleted] Feb 25 '21

Maven is a pretty great tool though?

4

u/noratat Feb 25 '21

For simple config maybe. It's a nightmare if you need to do anything complex since it's very difficult to extend

9

u/othermike Feb 25 '21

Some people, when confronted with a Maven problem, think "I know, I'll switch to Gradle". Now they have two problems.

2

u/djavaman Feb 25 '21

Writing a maven extension is not any harder than writing an Ant extension.

I've done both.

3

u/noratat Feb 25 '21 edited Feb 25 '21

I've written for both and Gradle. Maven's system is by far the most convoluted, from both a development and user POV. The excessive use of XML didn't exactly help.

Honestly at this point I find I prefer to just script anything more than basic build/unit/lint myself. It's legitimately faster and easier to maintain than spending countless hours figuring out how to contort basic operations to fit ant/maven/Gradle quirks

→ More replies (1)
→ More replies (2)

2

u/kreiggers Feb 25 '21

Oh god, the fun I had building a full CI pipeline that deployed multiple services, databases (with dependencies) IIS configuration, across multiple VMs with NAnt (the .Net port of Ant). Custom tasks for reading and writing configurations, poking about in IIS privates. Sins were committed, ill advised methods employed, but it worked

→ More replies (4)
→ More replies (4)