One Server, Three Languages
Learn C, Go and Rust from scratch by building the same Redis-compatible server three times, and understand the power and the weakness of each
- C17 · Go 1.27 · Rust 1.99
- One server, built three times
- 39 exercises with solutions
- 77-row scorecard
- Every listing compiled and tested
You learn by building, you used C at university and Go a few years ago and forgot both, and you have heard that Rust is the systems language now. This book teaches all three from scratch by building one project three times: kv, a key-value server that speaks the Redis protocol, so that the real redis-cli and redis-benchmark can talk to it from chapter 4 on. It starts in 1969 with why C exists, then why Google made Go and why Mozilla made Rust, and builds the server one feature at a time, always in C first, then Go, then Rust: an echo server, the protocol parser, GET and SET, your own hash table, modules and packages, fifty clients at once, keys that expire, a log that survives a crash. Then it does what a working programmer must: tests, fuzzers and sanitizers, benchmarks and profilers, cross-compiling and static binaries, and calling C from the other two. Every chapter opens with a comparison table, teaches each language with an exercise whose full solution is folded underneath, and closes with a scorecard that names a real weakness of each. The last chapter gathers the 77 rows into one table and says when to choose C, Go, Rust, or none of them. Every listing is pulled from code that is compiled and run against the same protocol tests on every change. Read it in about four and a half hours, and keep the appendices: a rosetta cheat card of the constructs you use most, side by side, and a glossary linked from the text. Press ⌘K to search, and 1, 2 or 3 to put your language first.
Read online