Hacker News new | ask | show | jobs
by nicce 357 days ago
I don’t know anything about shaders and this is not personal against Evan, but if someone wrotes code that nobody understands, isn’t it bad thing and not good thing? I thought similarly (admired) many years ago, that those people are wizards and that is cool, but the older I get, less I think so. You often can write the same thing so that it is also easier for others to understand. In most cases, when we talk about compiled languages, compiler optimises it anyway, if you use some extra variables and so on.
6 comments

The first startup I worked at was in typography. Writing a full typographic rendering engine in webGL shaders is going to result in code that is difficult for others not experienced in webGL and typography.

It’s inherently (and likely irreducibly) difficult, not accidentally/gratuitously difficult.

It’s a bad thing if you make a simple thing more complicated than it needs to be.

But there are plenty of Hard Problems out there, for which no sufficient code could be called “simple.” Plenty of aspects of font rendering fall within this bucket. It’s notoriously difficult.

That's what I was thinking, but then, it is very specialized and high performance code well outside of my domains (font rendering, shaders, C++, high performance / frequently called code is very much not my bread and butter). I frequently glaze over whenever trying to read a post about some optimization problem. Fast inverse square root [0] is succinct and cleanly written even though it uses math symbols instead of variable names, but I have no idea how it works and don't have the math basics to even know when / where / why to use it.

[0] https://en.wikipedia.org/wiki/Fast_inverse_square_root

Usually it is dangerous to let such people write application level code, but according to the reports in the comments, the guy might be one of the few exceptions, who gets the low level right, but also created flexible extensible structure of code in other places, without it becoming obscure on the application level.

Usually when I see some mathematical code that's not explained at all and has obvious flaws in terms of simple improvements that could be made to improve readability or even something as simple as some comments, I just keep thinking: "Please don't let this person touch application level code!"

Computer typography is a dark art. It requires understanding a whole domain with its own terminology and traditions as well as aesthetic sense, then combine that with the programming knowledge.
As others have pointed out: if the complexity is in the domain then that's perfectly acceptable. I always remember reading some lines of code in Linux that had a comment above them: "This code is meant to be read by a CPU, not by a human."

The hard part is knowing when the code is complex because the domain/performance requirements demand it be that way vs when the code is complex because the engineer was just trying to appear smarter than they are.

Exactly, I had the same issue when I was younger. I thought if I read code I could not understand was because the other dev was a legend. Now its the opposite, I am amazed by code that does its job well, its understandable and has low complexity.