So I will aks you all: What's been a pice of nice source code you have read and would recommend it to others?

We should read more source code from other people that are actually a role model showing good skills, organisation and style.

So what would you recommend?

Reading 'A little smalltalk' shows some nice idea how a whole class library can be built. It is not a toy and small enough to be comprehensible and it talks about the VM implementation in more detail than the blue book.

@ckeen Check out the book, Beautiful Code from O'Reilly. Good place to start. Other than that, check out the original unix utils from one of the BSD's, GNU grep or similar. Highly distilled code that does a lot in few lines, and use the language to the fullest.

@ckeen I think seeing `not not x` in some part of OpenComputers was such a thing?
It wasn't so much a life changing thing but it just showed how deeply the programmer understood the language and kept the chaos under control.
(`not not` in Lua is a very cheap and fast way of coercing a value into a boolean)

@grainloom @ckeen that's done a bunch in C, to make bools strictly {0,1}

@kelbot Yeah I think I am one of the few people that have read the whole source code of their window manager...

@ckeen code from is dense yet pretty well-structured:

I've learnt a lot already and I'm still studying it.

@ckeen I haven't actually checked but I think I remember people talking about the Sqlite codebase being very good to learn and things like that ;)

@ckeen When someone talks about writing a new privilege separated daemon for , the developers have often recommended reading the code for OpenNTPd. Relatively small and simple, but has those different parts.

I ran this for a year or so:

Some highlights:
- GNU true and false
- sleep
- GNU yes, OpenBSD yes

The real thrill for me was comparing them against each other - it helped draw different priorities and coding styles out.

@ckeen I have enjoyed the series of books from the "Architecture of Open Source Software". I have used them to dip in to the implementation of different software. The first two provide a nice intro to the ideas behind the code of the programs they cover. Thew newest is "500 Lines or Less", which provides small implementations of commonly encountered software.

The books are CC licensed and can be read online or purchased (proceeds go to Amnesty International).

@ckeen I'm a fan of nicm@openbsd's codebases, i.e: tmux/fdm. It tends to match other developers as well, thanks to style(9).

@ckeen Anything that -actually- has comments that give a fig about intent.

Everything else is kind of moot if you dont understand the intent of a LOC.

Sign in to participate in the conversation

Server run by the main developers of the project 🐘 It is not focused on any particular niche interest - everyone is welcome as long as you follow our code of conduct!