Comment by foxfluff

4 years ago

> Yeah that sounds like the easiest way to make your colleagues hate you

Well I'm not Whitney's colleague but I really like his code.

What do you like about it? I don’t think it needs to be stated why the majority of people here probably hate it, but I am curious why anyone would actively like it. I can maybe see that there’s a sense of achievement in being able to grok a codebase that is often described as unreadable

  • It might be unreadable in the same sense as Chinese or Russian is to someone who hasn't learned to read it. Learn to read and it turns out not to be unreadable?

    I like it because it makes it easier for me to see the big picture. The forest and the mountain. It doesn't over-emphasize the bark on the trees; it doesn't drag on and make me scroll & jump through a maze of boring minute detail. At the same time, it doesn't actually bury and hide whatever detail there is; it's all there for when you need it. Whitney also generally simplifies things a lot and avoids tedious contortions others would make for portability or some theoretical conception of maintainability, readability, or vague "best practices". It's very straightforward and -- once you get past the Whitney vocabulary and general style -- there are no mountains of abstractions and layers you need to grok before you can work on the code.

    The biggest problem is that after getting used to that style, "normal" code starts to feel like kindergarten books with very simple sentences written in horse sized capital letters, a handful per page. Except that those letters are not used to write a short children's story, but a complex labyrinthine machine, and the over-emphasis on minute detail just obscures the complexity and you end up with cross cutting concerns spread over thousands of lines of code and many many files. It might look clean and readable on the surface, yet: there be dragons. And nobody wants to tame those dragons because there's so much code. And then I find myself sighing and asking: why on earth do we need an entire page for what would really amount to a line of code if we didn't insist on spelling everything out like it's babby's third program after hello world? It's just tedious.

    Whitney certainly writes his own sort of dragons, but it's easier to keep them all in your head. For example, the b compiler won't work out of the box on multiple platforms. I'm fairly confident I could port it without much effort, as long as the platform meets some basic requirements.

    • Yeah I don't think anyone likes over-engineered architecture astronaut code with too many layers and unnecessary abstractions, whether that's been formatted in the Whitney style or in a more conventional one. I think what I can't get over are the short identifiers (and filenames) and the way it just looks like a wall of text without any breathing space, though looking at another example someone posted[0] it seems there's a bit more whitespace and structure than I remember.

      > Learn to read and it turns out not to be unreadable?

      There's the thing, if someone learns Russian they can converse with 140 million people in Russia, similarly Ukrainians and Belarusians will be fine and they could probably make themselves understood through the Caucasus and Central Asia. If you learn to read C written in the Arthur Whitney style you can "converse" with a fairly small number of people who like the Whitney style[1]. So taking the example a bit further, I learned the Cyrillic alphabet in an afternoon and through knowing another Slavic language I can roughly parse the meaning of many Russian things I read (audio is another thing entirely, I can only pick out a handful of Czech/Russian homophones). If I had gotten up to speed with the ngn/k codebase would I be productive on one of the projects you wrote in a similar style, or is there a similar productivity wall where I'd have to first learn some idioms local to your codebase?

      Sorry for the questions, I know people who like this style probably have to answer these questions fairly frequently. I am genuinely just quite curious though.

      [0] = https://codeberg.org/ngn/k/src/branch/master/h.c

      [1] = is there a proper name for this or is it ok to refer to it as "Whitney style"?

      4 replies →