The Lazy Programmer

February 26, 2008

Learn to Tango with D

Filed under: Books,Opinion — ferruccio @ 9:38 pm
Tags: , ,

A brief review of the book and the language.


Learn to Tango with D

In the fall of 1980, I built my first computer. It was a HeathKit H89. I was a high school sophomore at the time and spent every dime I made over that summer to buy a computer kit. I had taught myself BASIC and 8080 Assembly Language programming by reading every book and magazine that I could get my hands on. I had managed to audit a Pascal programming course at a nearby college (nearly two hours by public transportation) and I was eager to try out some of these newly learned language skills.

I used HDOS, which included a somewhat odd BASIC interpreter (Benton Harbor Basic) and an Assembler. I managed to get a copy of Tiny Pascal which was, to say the least, extremely limited. I really wanted to get a real Pascal compiler but couldn’t afford the price at the time. It was then that I discovered in the back of a HeathKit-centered magazine and ad for a company called The Software Toolworks which sold a C compiler for HDOS for $39.I immediately sent out a money order and received the software a few weeks later. I copied the compiler to a bootable HDOS floppy and started tinkering with it. I quickly discovered that I had no clue about writing C programs. Undaunted, I headed to my favorite bookstore at the time: The Harvard Coop. I headed to the engineering section (Computer Science? What’s That?) and discovered a book titled: The C Programming Language.

Since I had a long ride home on the MBTA, I started reading the book. It was quite an eye-opening and mind-expanding experience for me. By the time I got home (two trains, one bus), I had read almost the entire book and I was hooked on C. The most amazing thing to me was that the C language seemed to match how I thought about coding. I could write code without having to first translate my ideas to fit a language’s notion of how programs should be structured. I quickly lost interest in Pascal at that time. I did eventually have to use Pascal in a couple of projects in my career because of the lack of a C compiler on those platforms at the time, but I spent more time beating the compiler into submission than actually getting stuff done. Java and C# seem to carry on this tradition today. šŸ™‚

So why did I just bore you with this story of how I learned C when this article is ostensibly about a book called “Learn to Tango with D”. Because, reading this book gave me the same eye-opening experience that the K&R book did. It is written in a simple, straighforward style with no fluff. It is does not try to teach you how to program. It assumes that you are already a competent programmer and lays out this new language in a clear and concise manner.

I’ve had a deep interest in programming languages for a long time. To me, the D programming language represents an exciting development in language design. There have been attempts to create new languages based on C. Some strive for backward compatibility while adding new features (C++). Some try to hold the programmer’s hand every step of the way (Java, C#). Others look to other languages for inspiration (Objective-C).

None of these approaches have lead to particularly satisfying results. D takes many modern developments in programming languages and packages them in a C-style language. It maintains C compatibility where possible but sheds it where necessary thus avoiding some of the truly odd syntactic constructs that languages like C++ force on us. I’m not going to list D language features here. If you want to see what a truly modern programming language can be like, go to the D website and look around.

The book is 188 pages long. It spends the first 116 pages describing the D language itself and the rest describe Tango, which is an alternative run-time library to the standard D runtime called Phobos. The book does not go into excruciating detail about every language feature. What it does is explain language syntax and concepts overall and has plenty of examples to demonstrate the topics discussed. The sections on Tango do not cover the entire library. That would be impossible anyway, since it’s still evolving. What they do is give you a feeling for some of its capabilities and encourage you to look to the Tango website for more information.

It’s hard to write a review of this book without it becoming a review of the D programming language. I’ve read the technical descriptions of D. I’ve downloaded the D compiler and development tools (all available for free) and played with it a bit. All I can tell you is that I’m really excited about this new language and look forward to an opportunity to use it in one of my projects. I don’t know if it will ever become a mainstream language, but it certainly deserves a closer look.

If you’re interested in learning more about D, I encourage you to visit some of these D-oriented websites.

The D Programming Language site

dsource.org: The D source community site

The Tango project site

The 2007 D Conference site

Advertisements

2 Comments

  1. Glad you liked it šŸ™‚

    Comment by Lars Ivar — February 27, 2008 @ 1:24 pm

  2. I’ve been watching D on and off for a while and I have some hopes for it, in particular that it doesn’t grow too much in the core language. I see it as a great language to implement critical paths of projects implemented in higher level languages like Python/Perl. Also its the first low level language in years that is flexible enough for me to consider not using a higher level language at all šŸ™‚

    Comment by Spacebat — February 28, 2008 @ 6:37 am


RSS feed for comments on this post.

Create a free website or blog at WordPress.com.

%d bloggers like this: