Hacker News new | past | comments | ask | show | jobs | submit login

I find that terseness has a real downside when debugging code. If you need to get down to the level of what is actually executing, having to unpack all that compact code involves many more things than I can keep in my short-term memory.

Compactness is great for things that are true and work, but when there's a bug in there somewhere, terse code requires a lot of scribbling on paper.




Mathematicians use very terse notation in formulas, but accompanied by a lot of natural language text. The equivalent in programming would be terse code with long comments and documentation.

Many programmers instead see self-documenting code as the ideal outcome: maybe not very compact, but virtually free of comments (and with documentation at least partially autogenerated).

In reality, successful open-source projects tend to have many comments in the source code. Often not one-liners, but detailed descriptions of functions, their arguments and algorithms, motivation for the choice of the implementation and so on.


I used to believe this but i don't anymore.

From https://github.com/tlack/b-decoded

Arthur is famous for his very dense programming style. Most C programmers would scream when seeing this code.

In his view (and others in the terse scene), it is much better to have everything in your application readable on the screen at once than to have great names for things or a lot of white space to comfort the first timer reader.

To them, once you've sufficiently studied that screen or two of code, you can understand all of it at the same time. If it's spread out over thousands of files, it's very difficult to understand all of it, which leads to bugs, unnecessary abstraction, and the need for advanced tooling just to work with your own project's code.

He wants to see the code "all at once" so he can understand all of its behavior without paging around and shifting his focus to another tab, window, etc. To get there he makes a lot of tradeoffs in terms of the code formatting and naming conventions. He also, in b, creates a dense set of interlocking macros and abstractions that can make the code very hard to follow.

Critics and the uninitiated say that his code is like old school modem line noise: random punctuation intermixed with bits of understandable code. I would suggest that he's actually quite careful with the abstractions he chooses and they are actually not always the most dense, highly compressed code structures available to him. He chooses wisely and his code rewards deep study.

Interview with Arthur Whitney: https://queue.acm.org/detail.cfm?id=1531242


I looked at the two-line code sample at the link, and it is extreme.


Yeah, Arthur Whitney's code is extreme (he is one of a kind) but the sentiment is something i wholeheartedly subscribe to.

The key point is this; once you've sufficiently studied that screen or two of code, you can understand all of it at the same time. If it's spread out over thousands of files, it's very difficult to understand all of it,

Because there are so many interlocking concepts in code you have to keep as much as possible in your head to build up the entire picture. This is where concise, terse and direct-to-the-point code shines; nothing gets in the way of putting all the pieces of the jigsaw puzzle in front of you so you can "get" everything at a glance. A good example is K&R C style espoused in their book which i used to find difficult in the beginning but now understand. Always put as much of relevant code as possible into one screenful.


This a case for more powerful debuggers that can unroll code for you.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: