Live data from Hacker News

Ask HN: What open source project, in your opinion, has the highest code quality?

news.ycombinator.com

221–230 of 294 posts

Re: Ask HN: What open source project, in your opinion, has the highest code quality?

#221
post #40

SQLite. and for this reason alone! https://www.sqlite.org/testing.html As of version 3.23.0 (2018-04-02), the SQLite library consists of approximately 128.9 KSLOC of C code. (KSLOC means thousands of "Source Lines Of Code" or, in other words, lines of code excluding blank lines and comments.) By comparison, the project has 711 times as much test code and test scripts - 91772.0 KSLOC.

Automated testing is useful and good. But I really feel it's reached a lever of fetishisation that is quite concerning. Testing code is code which needs to be written, read, maintained, refactored. Very often nowadays I have to wade through tests which test nothing useful, except syntax. Even worse, with developers who adopt the mock-everything approach, I often find tests which only verify that the implementation is…

Oh boy, I would give your comment an infinite number of up-votes. Yes, testing has reached fetish-like levels.

Some of the test code I've encountered recently has been more voluminous, complex and has taken more man hours to develop and maintain than the application or library it's assigned to.

For the love of God, develop the damned software! It's either going to work or it's not.

Re: Ask HN: What open source project, in your opinion, has the highest code quality?

#222

I'm a bit surprised nobody mentioned qmail yet: https://cr.yp.to/qmail.html

I don’t know about qmail, but postfix sources are really nice.

They're better than most C software of the era, but not better than qmail --- qmail has a better vulnerability record than Postfix does (perhaps because it does less, but that's beside the point).

Re: Ask HN: What open source project, in your opinion, has the highest code quality?

#223
post #181

Earlier quoted context omitted.

The TeX language itself, and the logs and error messages of TeX are so bad, that I would hardly believe it.

Are you sure you aren't thinking of LaTeX? TeX (plain TeX, not LaTeX) has phenomenally good logging and error messages IMO — everything you need is there, each error message comes in a “formal” and “informal” form and points you to exactly the place the error happened, and TeX lets you fix things on-the-fly without restarting the program. All this of course assumes you use TeX the way it is described in the manual (T…

Plain TeX is different to TeX:

..."virgin" TeX...knows just primitive commands, no macros. Plain TeX is the set of macros (developed by Knuth) which makes TeX usable in everyday life of a typist. ... The available commands can be classified into primitive commands and macros. ... The "virgin" TeX knows only the primitive commands. ... Formats (plain TeX, LaTeX, etc.) extend TeX's vocabulary by defining macros. ...For example, plain TeX defines macros \item, \rm, \newdimen, \loop, etc. Plain TeX defines about 600 macros.

https://tex.stackexchange.com/questions/97520/what-is-plain-...

Re: Ask HN: What open source project, in your opinion, has the highest code quality?

#224
Julia. Julia / Julialang is so pedantically tested and the names are pretty meticulously chosen. The algorithms in Base are almost all generic and handle a very wide variety of inputs without catering to them. If you want to learn Julia, along with good software engineering, looking at the Base library is quite recommended.

Re: Ask HN: What open source project, in your opinion, has the highest code quality?

#225
post #175

Earlier quoted context omitted.

I was pretty certain most libraries shuffle then quicksort. No need for documentation. Does go not do this?

Ever heard of Timsort?

Timsort always reminds me of monkeysort ( http://leonid-shevtsov.github.io/monkeysort/ )

Re: Ask HN: What open source project, in your opinion, has the highest code quality?

#226

LLVM and associated projects such as clang. Bazel is good too. OkHttp and Retrofit by Square.

I've been working with LLVM for a few years and I still find the code difficult to navigate and badly documented. And every single function's argument list is a random jumble of pointers and references (almost all arguments should be references, but many aren't).

Indeed. And it's not just medium to low-level stuff that's not well documented, it's the high-level stuff too. I personally don't mind that much if I have to spend a few minutes to understand something on a a very local scope, but if the bigger picture is unclear, that's quite bad. For LLVM one largely has to grep for a bunch of other users and try to figure it out from that.

While I think it has some clear deficiencies, I found a lot of e.g. the optimization passes in GCC a lot easier to read. It's probably above par, but e.g. https://github.com/gcc-mirror/gcc/blob/master/gcc/gimple-ssa... is really well explained imo.

Re: Ask HN: What open source project, in your opinion, has the highest code quality?

#227
post #181

Earlier quoted context omitted.

Are you sure you aren't thinking of LaTeX? TeX (plain TeX, not LaTeX) has phenomenally good logging and error messages IMO — everything you need is there, each error message comes in a “formal” and “informal” form and points you to exactly the place the error happened, and TeX lets you fix things on-the-fly without restarting the program. All this of course assumes you use TeX the way it is described in the manual (T…

Plain TeX is different to TeX : ..."virgin" TeX...knows just primitive commands, no macros. Plain TeX is the set of macros (developed by Knuth) which makes TeX usable in everyday life of a typist. ... The available commands can be classified into primitive commands and macros. ... The "virgin" TeX knows only the primitive commands. ... Formats (plain TeX, LaTeX, etc.) extend TeX's vocabulary by defining macros. ...Fo…

Yes of course; see this answer I wrote about typesetting with “virgin” TeX: https://tex.stackexchange.com/a/388360/48 (it's not easy). “Virgin” TeX is never (and was never) used by typical users, and is used only by the system administrator (or these days, the people behind the TeX distributions) to pre-load formats (like plain or LaTeX).

Knuth wrote both the TeX program and the “plain” set of macros; when you start `tex` it is with `plain` that it starts up, and The TeXbook describes both the TeX program and the plain format without being careful to distinguish what comes from where (you have to look at Appendix B to see the proper definition of plain.tex), so when we speak of TeX as Knuth intended/imagined it to be used, it is plain TeX that is meant.

Re: Ask HN: What open source project, in your opinion, has the highest code quality?

#228
post #141

Earlier quoted context omitted.

While I agree in general I disagree here. If you read about the Sqlite tests you will find that they do test sensibly. One suite I'm particularly impressed with will run tests from zero bytes with slowly increasing available memory until the program passes. The tests verify that at no point the DB is corrupted by an OOM event.

Just to clarify, I wasn't criticising sqlite, I was criticising the idea of judging their code quality "for this reason alone!" - ie that they have so much test code vs implementation.

Sure! Can't judge a book by its size.

As a heuristic the code versus test-code ratio serves well as an indicator of quality. Just like consistent indentation does. You don't know whether a well-indented program is good. But if the indentation is inconsistent you'll expect worse.

Re: Ask HN: What open source project, in your opinion, has the highest code quality?

#229
post #40

SQLite. and for this reason alone! https://www.sqlite.org/testing.html As of version 3.23.0 (2018-04-02), the SQLite library consists of approximately 128.9 KSLOC of C code. (KSLOC means thousands of "Source Lines Of Code" or, in other words, lines of code excluding blank lines and comments.) By comparison, the project has 711 times as much test code and test scripts - 91772.0 KSLOC.

Automated testing is useful and good. But I really feel it's reached a lever of fetishisation that is quite concerning. Testing code is code which needs to be written, read, maintained, refactored. Very often nowadays I have to wade through tests which test nothing useful, except syntax. Even worse, with developers who adopt the mock-everything approach, I often find tests which only verify that the implementation is…

You may not be able to judge code quality by the presence of test code, but you can by its absence.

Re: Ask HN: What open source project, in your opinion, has the highest code quality?

#230

Earlier quoted context omitted.

I was pretty certain most libraries shuffle then quicksort. No need for documentation. Does go not do this?

JVM and Python use timsort, which is O(N) on mostly sorted data of all kinds.

timsort is full of win, and such a clever approach.
Post reply on HN