HACKER Q&A
📣 hexo

Is this how anyone programs?


Recently, I wanted to write a simple piece of code in J, but immediately found a bug. I went ahead to fetch the source to see if I can fix it. But, hell no. I couldn't believe my eyes. Is this how someone programs, really? I just can't believe it didn't go through some kind of obfuscator.

Here are some samples, but almost anything in the repository is beyond me:

https://github.com/jsoftware/jsource/blob/master/jsrc/xo.c https://github.com/jsoftware/jsource/blob/master/jsrc/k.c https://github.com/jsoftware/jsource/blob/master/jsrc/j.h

What's your opinion?


  👤 t-3 Accepted Answer ✓
https://k.miraheze.org/wiki/Arthur_Whitney#Programming_Style

https://code.jsoftware.com/wiki/Essays/Incunabulum

The rationale I've heard is that taking the time to read the code written in this style doesn't take longer than if it was written in a more conventionally verbose style, but more fits on the screen, so it can be comprehended more easily once it's understood. I don't really buy that for C, because the language is so ugly and hard to read in normal style, but for array languages it strikes me as being true.


👤 dusted
> Copyright (c) 1990-2022

I don't know the full history of this file, it might have started out less terse, might have developed to this state during the years.

It's not bad per-se, personally, I got almost nothing out of it at a glance, but I'm also not a J developer.

It's easy to jump on something and say "I couldn't understand this in 10 minutes! Such a mess!" but on the other hand, you don't know the alternatives..

I notice it's very short, doing anything useful in 186 lines of C is pretty good. It's entirely possible that when you know all those macros and is intimate with the style, this becomes easy and comfortable to read and write.

Something about walking distances in other shoes, don't be quick to judge.


👤 dcminter
More so in the past than the present. I note that the copyright range goes back to 1990 so it's not tooo surprising.

Edit: Oh, and I note this is J which is based on APL which to me looks like line noise, so I guess we shouldn't be too surprised that the original authors liked terse code.


👤 rak1507
What was the bug?