Follow Slashdot stories on Twitter

 



Forgot your password?
typodupeerror
×
User Journal

Journal darenw's Journal: Using the D Programming Language

Hmm, what to write about - my recipe for clam-sauce pasta casserole? Clever ways to feed the cats so one won't steal food from another? Touchy-feely poetry about flowers? Hmmm.. hey this is Slashdot - how about software development? Okay. I don't actually write code that much, or write anything bigger than five or six lines of curve-fitting code in Python, or image processing filters in IDL or C++. Ew, C++. That is a topic!

Where I currently work (fill in the blank, any company in 2013 will do), Almost everything is written in C or C++, some Python and Java in certain places. This is for the company's product, and half their in-house stuff. Web apps and services use the usual technologies, but aren't the focus of the company's market or my interests, so beside the point.

Large C++ projects take hours to compile. A few weeks ago, someone complained about a build taking too long - about 11 hours, iirc, instead of the expected 5 hours. Huh? Is it really okay for an allegedly intelligent carbon-based species to be needing 5 hours to compile and link a large piece of software. Yes, I heard, it's "large". But still... I know we can do much better.

Ten years ago, or thereabouts, I wrote some stuff in Ada95. It compiled fast. It ran fast. The execution speed wasn't different enough from C++ or C to concern me. And I do image processing, scientific simuations, 3D graphics, stuff like that where speed *is* important. Developer time is expensive. Ada95 all the way! I thought then. But there are other languages. In the last few years we now have Google's Go programming language, and Walter Bright's excellent D programming language, and if you like things that have faded from glory, the Modula3 language had some nice features (and some show-stopper lapses in syntax.)

Why is C++ so heavily used? It's popular, and an example of "nothing succeeds like success", and has had an infinite number of developer tools(*) on the market since the late 1980s. It allowed (almost) OO style thinking and designs in a tight pointer-based C-style world. It provided enough power to enough different programmers in enough different fields, including large fields such as business infrastructure and consumer products, that it caught on.

But C++ dragged in #include headers, certain syntax peculiarities that annoy compilers but please Humans, and a lack of useful complex data types except as defined through headers and templates (such as STL). There are oddities of the C++ language that prevent the easy and reliable development of tools for easy and reliable procedures such as static analysis, and automatic creation of interface code for connecting to other modules/libraries/whatnot in other languages. Yeah, pre-compiled headers help, but still, the lack of a real module system in C++ puts it way in back for compile time compared to almost any other language in widespread use today. Slow for compilers, and difficult for Humans who never master all the aspects of the language. ("Just use the features you like!" No, most of us work on code others wrote, so must know all aspects of the language.) Remember also that C++ took a lot from C, where it's easy to forget "break" in switch statements, and many other syntax errors trip us up every day.

C++ development is slow, and C++ builds are slow, yet projects written in Go, D, Ada95, Java, C#, Modula3, ..., can be written in half the time, and compile and link in seconds instead of minutes. Why does this not translate into financial pressure for most companies who develop software in-house or as product? Developer time is expensive. (Oh, I said that already.) Seems like executives and project managers would be pushing hard for everyone to switch to D, or something. Anything but C++. Wouldn't faster edit-compile-test-think cycles go faster and therefore result in better products and therefore better profits?

It can't be mass-think or institutional inertial holding C++ in place. Such forces aren't a match for profit, but beside that, just look at how fast Java became popular, and C# (after some initial wobbles), and other new tools are being adopted all the time.

Studies have been done showing other languages beating C++ for developer time, for compile time (obvious from personal experience), and occasionally even execution time, though that's pretty hard these days. Many languages and their toolsets can meet C++ execution times, but not beat. That is a minor issue - it is developer time that costs businesses and other organizations.

So far, few programmers use D but all say it's quicker to get the code written correctly, compiles blazingly fast, and overall have a better experience with it. It allows use of existing libraries with C-style APIs. I don't think it can be used to write a *nix kernel or device drivers, yet, but there's no reason in principle preventing that. You cannot reject a language due to lacking some feature - someone will add it! If D cannot be big right now, it's in a great position to become big.

Note that I care nothing for web app tools, big-time enterprise business tools, databases and their tools, beyond what I need to deal with for my science, engineering, animation and art projects. Someone who has a foot in those other worlds should think about and comment on this from their point of view.

(*) - some exaggeration may be involved.

This discussion has been archived. No new comments can be posted.

Using the D Programming Language

Comments Filter:

"Here's something to think about: How come you never see a headline like `Psychic Wins Lottery.'" -- Comedian Jay Leno

Working...