A long-time contributor to the D community, Kai Nacke is the author of ‘D Web Development‘ and the maintainer of LDC, the LLVM D Compiler. In this post, he tells the story of how his book came together.
At the beginning of 2014, I was asked by Packt Publishing if I wanted to review the D Cookbook by Adam Ruppe. Of course I wanted to!
The review was stressful, but it was a lot of fun. At the end of the year came a surprising question for me: would I be willing to switch sides and write a book myself? Here, I hesitated. Sure, writing your own book is a dream, but is this at all possible on top of a regular job? The proposed topic, D Web Development, was interesting. Web technologies I knew, of course, but the vibe.d framework was for me only a large unit test for each LDC release.
My interest was awakened and I created a chapter overview, based solely on my experience as a developer and the online documentation of vibe.d. The result came out well and I was offered a contract. It came with an immediate challenge: I should set up a small project plan. How do you plan to write a book?!?
Without any experience in this area, I stuck to the following rules. For each chapter, I planned a little time frame. Each should include at least one weekend, for the larger chapters perhaps even two. I reserved some time for the Easter holiday, too. The first version of the book would therefore be ready at the beginning of July, when I started writing in mid-February.
Even the first chapter showed that this plan was much too optimistic. The writing went off quickly – as soon as I had something I could write about. But experimenting and testing took a lot of time. For one thing, I didn’t have much experience with vibe.d. There were sample programs that I wanted to develop Saturday to write about on Sunday. However, I was still searching for errors on Monday, without having written a single line!
On the other hand, there were still a few rough edges in vibe.d at the time, but I did not want to write that these would be changed or implemented in later versions of the library. So I developed a few patches for vibe.d, e.g. digest authentication. By the way, there were also new LDC releases to create. Fortunately, the LDC team had expanded, so I just took care of the release itself (thanks so much, folks!). The result was, of course, that I missed many of my milestones.
In May, the first chapters came back from the review process. Other content also had to be written, such as the text for the back of the book. In mid-December, the last chapter was finished and almost all review notes on the other chapters were incorporated. After a little Christmas break, the remaining notes were quickly incorporated and the pre-final version of each chapter was created in January. And then, on February 1, 2016, the news came that my book was now published. I’d done it! Almost exactly one year after I had started with the first chapter.
Was the work worth it? In any case, it was a very special experience. Would I do it again? Yes! Right now, I am playing with the idea of updating the book and expanding a chapter. Let’s see what happens…
Good work. I just noticed that the link at the top ‘D Web Development‘ is broken.
Thanks! It’s fixed now.
thanks for fixing it.
Vibe.d is not the only way to do web development with D. If you can read and write to standard in and standard out, respectively, you can do web development. CGI/FCGI is an option, as well as rolling your own HTTP implementation. I prefer the CGI/FCGI route. There is tones of documentation on web development in C, which directly translates to D. It’s about understanding the Protocols that drive the modern web and how to implement those features. So I sure hope this book covers the basics of web development and isn’t just a pure puff piece on vibe.d, because vibe.d not the only way, just a way. The more diversity we have in the web development space the better D will be.
But why reinvent the wheel when you don’t need to? Especially when it comes to optimization. If you’re serious about doing web-development in D then using vibe.d in one way or another is the correct way to go. If you don’t like certain things of vibe.d then building on top of it with your own front-end works perfectly fine. That’s what I did with Diamond.
CGI is very slow and FCGI is not only still slow but is a pain to make it get along with D on M$ Windows. Vibe.D not only is much faster than both of the the separate Web-server driven options but is also easier to use and has a lot of other useful features like timers and database access. In fact almost everything you need in a Web framework is at least partially included. The package has its own quirks and bugs and its dependency on DUB is an other issue but D itself is not a completely mature and standardized language and DMD still has bugs so it is to be expected. Diversity is good and all and there are other frameworks available like Dweb for example but Vibe.D is definitely the most advanced of them all. I just prefer not to bother about being the lazy ass I am and have as much of my work as possible already done for me by some other developers.
thanks for the fix. thumb up 🙂