Table of Contents

I am very curious about the D language and its community. Although, I do not have lot’s of experience with this language, I try to track news and important updates. Recently, I’ve noticed that there is another book released regarding the language: D Cookbook, by Adam D. Ruppe

Let’s see what’s inside this book

D Cookbook, by Adam D. Ruppe

First of all, you will notice that the foreword and the technical review was done by Andrei Alexandrescu. In my opinion this gives the whole book +5 points at start! Furthermore, Adam D. Ruppe is a very experienced software developer. He used D language even before it got 1.0 release. Additionally, I’ve seen a topic about OpenGL with D, so I needed to read it :). All in all, at first sight, the book looked very interesting.

What I liked  

The contents:

  • Core Tasks (ex. installing, external libraries, custom types)
  • Phobos – The Standard Library (ex. random numbers, regexp, zlib)
  • Ranges (ex. input ranges, sorting, searching)
  • Integration (ex. WinApi, C++, COM)
  • Resource Management (ex. garbage collector, smart pointers)
  • Wrapped Types (ex. referenced types ws structures, mixin templated)
  • Correctness Checking (ex. static assert, pure functions, unit testing)
  • Reflection (ex. list of child classes, user defined attributes)
  • Code Generation (ex. parsing a DSL, wrapping instance methods)
  • Multitasking (ex. threads, fibers, processes, parallelism)
  • D for Kernel Coding (ex. bare metal)
  • Web and GUI Programming (ex. parsing HTML, SQL database, simple OpenGL app)

As you can see the list of topics is impressive. Most important, majority of the recipes are done very well and are written in a clear way. You get not only ready to use code examples, but lot of valuable description with additional information.

For instance, in the recipe about the Phobos library and it’s random number generator as an example you get a small game. Then nice explanation how everything works with some potentials extensions.

A second positive example: In topic about string normalization there is a detailed discussion about design choices for Unicode usage in D. The author shows deep knowledge in the language specification.

I especially liked chapter 4 about Integration. Since D is a relatively young language, it would be nice to have possibility to use it with existing code in some other language. The author clearly presents here how to interface with C++, call a Win32 function or use Linux system calls. This is also one of the most powerful feature of D: if you can call something from C then it is also possible from D.

Little flaws  

In the introduction you can read

“Whether you are looking at D for the first time or have used it before and want to learn more, this book has something to offer you”.

I would argue, that the book is definitely for someone who already knows D language. I was hoping that in the first chapter there would be more introductory recipes. That way you would be able to learn D from only one book.

Additionally some of chapters might sound too ‘hardcore’ and not usable that much. I was impressed that you can use D on a bare metal, but instead of this topic there could more on file processing (a topic that is more common). On the other hand this chapter is quite short, so this is not a real disadvantage of course!

At the end of the book I got an impression that the last chapters were written in a hurry. Those last recipes are much shorter that in the beginning. That is a pity because the titles looked very nice. For instance, I did not expect much from OpenGL recipe (since it is not a Graphics in D book), but this part could be a bit longer (maybe using modern OpenGL).


Final mark: 4.5/5


  • Variety of useful topics: from concurrency and const correctness to even a simple OpenGL application.
  • Written in a nice, readable form.
  • Detailed discussions and descriptions. Sometimes too lengthy, but you can simply skip it and move to another topic.
  • Reviewed by Andrei Alexandrescu, with his foreword.


  • Last chapters feels like they were written in a rush. Could be extended a bit.
  • First chapter could be improved and written even more for beginners.
  • Sometimes too ‘hardcore’ - like bare metal programming. Some will argue that it is actually an advantage :)

This book, combined with “The D Programming Language” written by Alexandrescu, is a “power pack” to learn D!

If you know this language already, then “D Cookbook” is a must-have for you.

Disclaimer: I got a free copy of The D Cookbook ebook from Pack Publishing in exchange for a fair review.

Win an ebook  

The contest is over!
Winners: bartekmp, Nil Goyette, minipump
Thanks for participation!