programming languages on a screen Alamy

The Problem with General-Purpose Programming Languages

Nearly all of the newer programming languages are general-purpose. And that's a problem. Here's why we still need domain-specific languages.

Software development use cases vary widely. You might think, then, that it makes sense for most developers to learn general-purpose programming languages that can support a wide range of programming requirements.

But arguably, we need more domain-specific programming languages and domain-specific developers. Indeed, one could make the case — as I'd like to do in this article — that the demise of domain-specific programming languages, which has quietly taken place over the past decade or two, is one of the greatest challenges facing the world of software development today.

Allow me to explain by discussing the differences between general-purpose and domain-specific languages and explaining why we need more of the latter.

General-Purpose vs. Domain-Specific Programming Languages

All programming languages fit into one of two categories: general-purpose programming languages and domain-specific programming languages.

As the term implies, general-purpose languages are ones that can easily support a wide variety of use cases. Java, C, and C# are popular examples of general-purpose programming languages.

In contrast, domain-specific languages focus on specific niches or needs – such as data science, text manipulation, or web development. SQL, gawk, and HTML are examples of domain-specific languages. (Technically, they're not all programming languages; some are markup languages.)

The Slow Demise of Domain-Specific Languages

If you look at most of the programming languages that have debuted relatively recently — such as Swift and Go — you'll notice that almost all of them are general-purpose languages. The only possible exception is Rust, which debuted in 2013. You could try to make the case that Rust is domain-specific because it's designed for security-centric programming needs. But that's a stretch because Rust can support a wide variety of development use cases. By most definitions, Rust is a general-purpose language.

Now, if you look back at programming language history, you'll see that a lot of historical programming languages were domain-specific. The most important domain-specific languages still in widespread use today — such as, again, SQL, gawk, and XML — have been around for decades.

Plus, some of the languages that are now general-purpose originated with a narrower domain focus. Python was originally created mostly for system administration tasks on Amoeba, although Python is now used for almost every programming use case under the sun. Likewise, C was created initially to help develop Unix, not for the wide variety of application and operating system development use cases to which C is applied today,

I mention all of this to make the case that we've arguably seen the demise of domain-specific programming languages over the past couple of decades. Whereas it was once common to create domain-specific languages, almost all of the languages created in recent years have been general-purpose. And some of those that were not originally general-purpose have been adapted to fit that bill.

The Case for Domain-Specific Languages

Is it a bad thing to live in a world dominated by general-purpose programming languages?

Arguably, yes. After all, as the Unix philosophy tells us, it's better to have many tools, each of which does one thing well, than to have one tool that tries to do a bunch of things but does none of them well. Maybe we need more languages that excel at, say, web development or mobile development or data analytics, but that don't try to cater to all of these use cases at the same time.

To be fair, the fact that most programmers seem happy enough using general-purpose programming languages might seem to suggest that developers don't feel a strong incentive to leverage domain-specific languages. But I'd argue in response that the reason why most developers today use general-purpose programming languages is because they face pressure on the career front to be generalists. It's easier to find (and keep) a programming job if you can support a wide variety of software development needs than if you specialize in just one domain.

After all, you do see developers who choose to specialize in particular niches making heavy use of domain-specific languages. For instance, most coders who work in the data science realm use R, which is a domain-specific language in most senses. If general-purpose languages were ideal, R should have been totally replaced by, say, Python at this point within the context of data science.

There are, of course, plenty of situations where you might use general-purpose and domain-specific languages together. It's pretty common for data scientists to use R and Python within the same workflow, for instance. But here again, if general-purpose programming languages were so great, you'd think that data scientists could do everything they need using just Python. They don't, because general-purpose languages just can't do some things as well as domain-specific languages like R.

Conclusion: There's Still a Place for Domain-Specific Languages

To be clear, I don't mean to suggest that every programming use case is best served by a domain-specific language. The flexibility that general-purpose programming languages provide will always be necessary for many projects.

But in situations where developers are building domain-specific apps, they're likely to create applications that are more efficient, reliable, and secure if they take greater advantage of domain-specific languages — and if the software development ecosystem in general gave domain-specific languages more love than they've received over the past couple of decades.

About the author

Christopher Tozzi headshotChristopher Tozzi is a technology analyst with subject matter expertise in cloud computing, application development, open source software, virtualization, containers and more. He also lectures at a major university in the Albany, New York, area. His book, “For Fun and Profit: A History of the Free and Open Source Software Revolution,” was published by MIT Press.
Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish