120 points
*

Bash script. Not necessarily hard to understand but very unintuitive in my opinion. I’ve written so much bash script over the years and still have to look up how to do simple things like iterate over associative arrays or do basic string manipulation. Maybe it’s just a me problem though 🤷

permalink
report
reply
40 points

I have to write powershell scripts and bash scripts at work. I hear people saying bash is great, powershell is bad, all the time in public, but honestly I feel like these people have barely actually written powershell. It’s a bit wordy, but it feels much more intuitive to me, much more akin to regular programming languages.

permalink
report
parent
reply
22 points

It’s newer and Microsoft based. Easy way to get a bunch of people on the hate train for those reasons alone.

permalink
report
parent
reply
10 points

PS was built from the ground up to be intuitive. There are some interesting videos from the MS devs talking about the design process.

permalink
report
parent
reply
4 points

I can see how PS might be better for writing actual programs in but the wordiness really gets in the way when youre just trying to write something on the command line so it feels poorly optimized for cli usage. Bash is very poorly optimized for writing programs otoh.

permalink
report
parent
reply
3 points

It’s not necessarily PS itself, I bet it would be fine on a Linux machine with a typical Linux terminal. It’s just that I cannot stand the rest of Windows, especially the CLI part, especially cmd: Awful to no tab complete support, no command history across cmd restarts, if tab complete works its only for files and even sucks there because of the ignore case design and completing a full name instead of to the next clear step (eg. “tes” for a dir containing “test.exe” and “test.mp4” will complete to “test.exe” instead of “test.”). Additionally, I associate PS with Windows and tasks on it. Most things I want to run on Linux only I write in C/C++ (depending on the task itself ofc). If I want compatibility with Linux and Windows I use python. To install that script to a usable state it’s literally a single command on Linux, if the method of transferring the script (probably a git repo) supports saving the executable permission bit: sudo cp script.py /usr/local/bin/patchjar.py. Even if you want an own directory with your own path, that’s no problem: Just cp a .sh file to /etc/profile.d/ that appends to the path. And removing it is as easy as deleting that file. On Windows? Chocolatey has a ~100 line script just for that purpose, backs up the path just in case and even explicitly states uninstall it can break your whole system? Why? Because Windows uses a single global PATH variable for everything. You need to edit the registry, extract your path with loops, remove it and write it back. And that’s a pattern being repeated through the whole OS. You want to move a window on the screen or start something on another monitor? Well fuck you. On Linux? assign [app_id=TuxKart] workspace gaming. For an OS claiming to be integrated with everything in itself that seems like pretty damn dumb and frustrating to a dev.

permalink
report
parent
reply
7 points

You shouldn’t really use CMD at all anymore. It’s pretty shit. Just use PowerShell (I prefer the newer version 7)

permalink
report
parent
reply
4 points

You’re talking about PowerShell but then complaining about cmd. Are you unaware that PowerShell is its own cli?

permalink
report
parent
reply
3 points
*

My main issue with PS is that it is JavaScripty. And by that I mean, it makes tons of assumptions on what I “mean” by my command. And it’s usually right and thus I don’t see any issues. But when those assumptions are wrong, I have to do all kinds of parameter fuckery to make it be what I “expect”.

None of that is true is bash. It doesn’t make many assumptions at all (at least none that I’ve come across). Things act the same when I’m using bash in a script vs the cli vs over an ssh connection vs within a subshell, etc.

And ya the whole “it’s pretty verbose” is irritating too (though that could also be a counter argument against bash relying on magic variables and abusing the shit out of symbols).

I don’t hate PS but I don’t enjoy spending time in it. I don’t hate bash but it hurts me less when I use it

permalink
report
parent
reply
2 points
*

I have done a lot of powershell scripting and found some very annoying edge cases, they all have solutions, but feels unnecessary. I once had a issue, where I had a dynamic array of strings and if thst array was only 1 long it would give you the first character instead of the first string. I don’t know exactly what made that happen, but I think it had something to do with functions or classes.

permalink
report
parent
reply
1 point

The object model is much easier to understand in PowerShell.

permalink
report
parent
reply
14 points

Bash does have a weird syntax. I too have to look stuff up all the time.

permalink
report
parent
reply
13 points

Yup, same. I’ve been a developer for years and used to code way before that and to this day I can’t write any non trivial bash script without looking up half a dozen of things lol, glad I’m not alone.
I’ve recently come across nushell, and it’s everything I’ve ever wanted when it comes to shell scripting. It’s not POSIX compliant so you can’t just run it anywhere but it helps keep my sanity in personal projects and whatnot. See also, elvish, xonsh.

permalink
report
parent
reply
8 points

Even worse is Windows batch scripts. The syntax also changes depending on if it’s in the terminal or run from a file

permalink
report
parent
reply
7 points

In shell languages, concurrency is easy and everything else is hard.

permalink
report
parent
reply
13 points

Concurrency is not easy if you need the output and exit status of the commands. Fire and forget concurrency/parallelism is easy in any language. It is when you need to sync state up that it becomes hard.

permalink
report
parent
reply
5 points

Yeah, anything to do with iterative over strings. Basically anything that involves IFS is unintuitive.

permalink
report
parent
reply
2 points

My running joke, after four different friends told me they were using ChatGPT to help them with it, is that the language is so hard to learn that we invented an entirely new class of AI to help.

It’s a joke, of course, but it does have some “surprising” syntax, since some stuff is whitespace sensitive, and there are subtle differences between () and [] and [[ ]], for example. All of that’s due to the long history of shell behavior, so I don’t necessarily blame bash.

permalink
report
parent
reply
2 points

I don’t think it’s just a you problem :)

I’ve been curious to try fish or zsh to hopefully run into less weirdness.

permalink
report
parent
reply
2 points
*

I don’t think it’s just a you problem :)

I didn’t think so. I guess Reddit has conditioned me to not state my opinion without a disclaimer, lest someone wants to start arguing :D

Btw. I don’t think you’ll find ZSH more intuitive to program. While it is an awesome interactive shell, the scripting part is Bash taken to the extreme.

permalink
report
parent
reply
52 points

Brainfuck

permalink
report
reply
16 points

Actually one of the few languages you can learn in its completeness in less than a day, so I wouldn’t really say it’s “hard to understand”. More like hard to read and understands programs written in it.

permalink
report
parent
reply
6 points

You have a point

permalink
report
parent
reply
43 points

Have you ever taken a look at Windows API, it’s disgusting.

permalink
report
reply
2 points

Uh? It’s about what I expect. Anything in particular?

permalink
report
parent
reply
1 point

I honestly don’t think it’s so bad. There are some things which make it look ugly, the Hungarian notation, the fact that it’s a C API which means everything has to be functional and there are many limitations, and there is a lot of legacy stuff kept for backwards compatibility. There is a lot of "we did it this way before we knew the right way of doing it, but now we’re stuck with it because of backwards compatibility.

I think MFC is a lot worse. It’s basically a C++ API that wraps a lot of things from the win32 API. It heavily relies on macros, and I really dislike it in general. And don’t get me started on COM.

permalink
report
parent
reply
42 points

If by “hard to understand” you’re including trying to understand someone else’s code, Perl can be a nightmare.

permalink
report
reply
22 points

I’ve heard a few people refer to perl as a “write-only” language.

permalink
report
parent
reply
46 points
*
// Dear programmer
//
// When I wrote this code, both 
// God and I knew how it worked. 
// Now only God knows!!
//
// Therefore if you are trying to 
// optimise this routine and it fails 
// (most surely) please increase 
// this counter as a warning for the 
// next person
//
// total_hours_wasted_here = 254
permalink
report
parent
reply
8 points

There’s some truth to it, but it’s mostly that junior developers and senior developers with no discipline that give it a bad name.

The major problem is that it has one of the the highest capacities for writting incredibly dense code there is, paired with very powerful language transformation tooling (i.e. switch statements were added as a module, but can also be used for funny evil.)

permalink
report
parent
reply
5 points

When I was a Perl programmer, I had to modify this other guy’s code, and all I could think was that this guy was writing code with job security in mind.

permalink
report
parent
reply
3 points

Imo the amount of magic variables in perl is too damn high.

Like I don’t want to have to keep all that in my head while parsing through thousands of lines of code. I spent a few years working as a perl developer and even near my last days there I still found myself digging through docs to figure out what certain symbols meant and did.

My first developer role was as a junior developer and I was tossed into single letter variable loop hell in perl lol.

I was telling my mentor that if I were introduced to perl now that I’ve got several years of experience in a variety of different languages and thought models, it probably wouldn’t bother me as much. I kind of like bash (sometimes) and perl is really a hyper extended scripting language so going from bash to perl isn’t too bad. But given that that is what I was started in, I have a massive distaste for it and I doubt that will ever change.

permalink
report
parent
reply
2 points

OK just checked out that Hodor module. That is hilarious.

permalink
report
parent
reply
4 points

Perl isn’t particularly worse than JavaScript. Which itself has a lot of quirks, of course. The big thing with Perl is getting your head around list and scalar context. There’s a learning curve to it, but can be very powerful once you understand. I wish more languages would do list flattening by default.

permalink
report
parent
reply
3 points

Or your own after six months.

permalink
report
parent
reply
39 points

Depends on what you already know.

Functional languages like Haskell, Clojure or Erlang have a reputation of being hard to grasp.

Rust’s borrow mechanics are hard for some people at first, especially because it’s very unique to the language.

Javascript can be frustrating because it also has some rare features among popular languages, and uses the same keywords for different concepts. It’s not bad at all once you let go of your assumptions and dedicate the time to understand how it works under the hood.

C++ is also notorious for being hard but I haven’t used it for a very long time so I can’t say anything about it.

permalink
report
reply
11 points

Javascript can be frustrating because it also has some rare features among popular languages, and uses the same keywords for different concepts.

I don’t think those are the reasons JS is frustrating.

permalink
report
parent
reply
8 points

For Erlang I would say that the hard part is not the language itself (maybe a bit because it is influenced by prolog) but because of the mental model. Using concurrency and parallelism as core concepts of the language and understanding that you don’t need a lot of the external tools you would with the more mainstream languages is what’s hard imo.

permalink
report
parent
reply
2 points

Yeah I bet, I’ve always wanted to learn Erlang. People always speak to highly of it. The guy that made Sonic Pi was saying he wished he would’ve used it because Sonic Pi involves a lot of music loops playing at the same time and stopping individual ones and modifying them etc and because so many of those concepts are baked in he said it would’ve been nice

permalink
report
parent
reply
6 points

Clojure : if lisp had an illegitimate baby with java. Add to it the pain of setting up fireplace in vim or having to use emacs. At a former employer we had one area in closure. I could read it without much difficulty but damn if it didn’t take me weeks to write or update it

permalink
report
parent
reply

Programming

!programming@programming.dev

Create post

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person’s post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you’re posting long videos try to add in some form of tldr for those who don’t want to watch videos

Wormhole

Follow the wormhole through a path of communities !webdev@programming.dev



Community stats

  • 3.2K

    Monthly active users

  • 1.8K

    Posts

  • 30K

    Comments