5 ms·
the only known metric for code complexity is as number of lines grows complexity grows
by foolfoolz 4y ago
the only known metric for code complexity is as number of lines grows complexity grows
- marginalia_nu 4y agoI'll just leave this here: https://github.com/KxSystems/kdb/blob/master/c/c/odbc.c https://github.com/KxSystems/kdb/blob/master/c/c/odbc.c
- newaccount2021 4y ago
- gilch 4y agoAnd that's... bad? Culture shock, sure, but this looks like fairly clean APL-style C to me. I would have wrapped some of those lines though.
- IshKebab 4y agoOf course it's bad. Is that a serious question?
- gilch 4y agoNo, it was rhetorical, because it's obviously (to an APL-family programmer), not bad! Your cultural prejudice is showing. There are good reasons APL is written the way it is, and this example is simply bringing those benefits to C by writing it in the dense APL style. There are other APL derivatives, like J[1] that are written in C the same way. These projects are well-maintained. They aren't collapsing under a load of technical debt. The style works. To them, it's clean code. [1]: https://github.com/jsoftware/jsource https://github.com/jsoftware/jsource
- IshKebab 4y agoMy cultural prejudice for readable code? Yes I guess it is. As far as I can tell the main reasons for APL being written like it is are 1. it's ancient, from the world of teletype where character count was way more critical, and 2. some programmers love code-golf write-only syntax. It reminds me a lot of regex. You could say "there are good reasons regex is so terse" and "people successfully use regex all the time" but that doesn't change the fact that it is a very write-only syntax and would be much better if it was more verbose. There are actually a lot of recent efforts to do that. The jsource repo you linked seems to have had only 4 contributors ever, which suggests to me that it is not a popular style and not easy to read. As far as I can tell APL had some interesting ideas in terms of data manipulation, but there's no reason those ideas have to be expressed all on one line with no comments or spaces.
- marginalia_nu 4y agoIf the thesis is that fewer lines = less complex, APL-style C is the blackest swan I ever saw flying past me. Is it bad? Apparently it's possible to write software in this style, so it can't be that bad, but it sure takes some getting used to.
- joshuacc 4y agoI’m not sure what you’re trying to say, but that’s not true at all. There are other metrics for code complexity, including fairly simple but useful ones like number of logical branches.
- f1shy 4y agoIrony, right?