A ''D'' in Programming, Part 1

[article]
Summary:

In certain company, the topic of favorite programming languages can elicit the same response as other taboo subjects, such as religion and politics. But, Chuck's going out on a limb to discuss his new favorite language, D, and some of its best features, such as its being strongly typed and compiling to native code, yet it is garbage collected.

They say there are three things you should never discuss if you want to get along with other people: politics, sports, and religion. Since I want to stay on your good side, I'll steer clear of these topics, but I would like to discuss something else that often elicits religious-like fervor from developers--favorite programming languages.

Language Wars
What's the best programming language? Be honest--how many times have you defended your favorite language du jour? And how many languages have been your "favorite" at one time or another?

To seed the discussion, let me relate my first and only exposure to COBOL, one of my "unfavorites." In 1975, I was standing in line, card deck in hand, waiting to submit my job to the IBM 360 expediters at Brigham Young University. I had about forty cards containing a Fortran program that numerically solved a system of ordinary differential equations. Complex stuff. Behind me stood another student with a deck of cards more than a foot thick--800 to 1,000 cards, I'd guess. Impressed and intimidated, I asked the student what his program did. "It writes a report." Hmmm. Since I had written reports in Fortran in considerably fewer statements, I decided right then and there I would never use COBOL. No offense to the many COBOL aficionados out there--I just knew it wouldn't work for me. My mathematical background has ingrained within me a constant yearning for economy of expression.

One language is not necessarily better than another, of course. For example, I prefer Python to Perl, but both are fine scripting languages as well as general-purpose, multi-paradigm programming languages. I see Python as cleaner and more orthogonal in its design--your mileage may vary. Nonetheless, you may appreciate the following "Jedi wisdom":

YODA: Code! Yes. A programmer's strength flows from code maintainability. But beware of Perl. Terse syntax ... more than one way to do it ... default variables. The dark side of code maintainability are they. Easily they flow, quick to join you when code you write. If once you start down the dark path, forever will it dominate your destiny, consume you it will.

LUKE: Is Perl better than Python?

YODA: No ... no ... no. Quicker, easier, more seductive.

LUKE: But how will I know why Python is better than Perl?

YODA: You will know. When your code you try to read six months from now. [1]

Not too many years have passed since the Java "revolution," fueled not only by Sun's leveraging the sudden popularity of the Internet but also in part as a "reaction" to C++. I well remember public discussions at conferences and online debunking C++ as unsafe ("pointers are evil and Java doesn't have pointers"--a deception) and too difficult to learn (Java is no cakewalk either). These comments were relentlessly proffered as context for evangelizing the so-called superiority of this new programming language. I respect Java and its inventors, have used the language professionally and taught it in academia, but I still wince when I recall the bad form that characterized Java's rise to popularity. There is a certain irony in the fact that the HotSpot JVM is written in C++.That said, there is always room for improvement.

That said, there is always room for improvement. Java does have a simpler object model and a more flexible execution model than C++. It has brought portable concurrency and GUI tools to Joe Programmer. The relatively new Scala language is in turn an improvement on Java, combining high-level, functional programming constructs with static type safety. Scala translates to Java byte code providing

About the author

Chuck Allison's picture Chuck Allison

Chuck Allison developed software for more than twenty years before becoming a professor of computer science at Utah Valley University. He is a technical editor for Better Software magazine and founding and current editor of the online journal, The C++ Source. He spent most of the 1990s as an active member of the C++ Standards Committee and is author of two C++ books, including Thinking In C++, Volume 2, with Bruce Eckel. His company, Fresh Sources, Inc., gives onsite training in C++, Python, and design patterns. His current top technical interest is the resurgence of functional programming. Whenever he finds a little down time he plays classical guitar or bikes the country roads of central Utah. Contact Chuck at chuck@freshsources.com.

AgileConnection is one of the growing communities of the TechWell network.

Featuring fresh, insightful stories, TechWell.com is the place to go for what is happening in software development and delivery.  Join the conversation now!

Upcoming Events

Nov 09
Nov 09
Apr 13
May 03