Polyglot Programming: Death by a thousand DSLs
Apr
1
Written by:
Joe Brinkman
4/1/2009 4:36 AM
In 2006, Neal Ford wrote a blog post on the topic of Polyglot Programming which foresaw a future where applications will be increasingly built using multiple general purpose languages and domain specific languages. Ted Neward has a recent article from MSDN Magazine which follows up on this theme with a discussion of Polyglot Programming in .Net. Both Neal and Ted address some of the issues with Polyglot Programming, but I think there is one that they have missed. Polyglot Programming can quickly lead to performance rot in application development. In DNN Tips and Tricks #10, I presented an example of how you can use the DotNetNuke Report Module to display you data using the advanced capabilities of XSLT. Greg Lahens pointed out an issue with my SQL code which is really highlights one of the downsides to Polyglot Programming. As programmers, we often employ a variety of tools to solve a particular programming challenge. Many of these tools are DSLs – XSLT, SQL, CSS, HTML are just a few of the many DSLs in common use throughout the web development world. The problem comes into play in that few developers have the luxury of being an expert in every DSL they use. Most developers I know, are extremely proficient in their primary language – whether it is C#, VB, Java, Ruby or whatever. Those same developers will often have a working knowledge of the secondary languages and DSLs used in their day to day programming. Yet the number of DSLs is rapidly expanding. We have DSLs for styling applications (a different one depending on whether it is Silverlight/WPF or Html), a DSL for transforming data, a DSL for querying data (possibly multiple DSLs for a single depending on how much you trust your ORM), a DSL for searching some text element, and even a DSL for merging our data with our presentation structure and styles, and several DSLs for exposing our data in a raw format to users. After learning all those DSLs, I then have a handful of additional DSLs to learn to build my application, package it into an installation package, and possibly one more for building the Help files. Ohh wait. You are doing automated unit testing right? You’ll need another couple of DSLs for that. And let’s not forget the DSL that we use for configuring the application after it is deployed. I don’t know about other programmers, but I am drowning in DSLs. It is hard enough keeping up with my primary development language and the associated platform APIs, but these DSLs are going to be the death of me. The end result is that I have a pretty decent handle on maybe 3 or 4 of these DSLs but rarely do I have the requisite knowledge to make the right choices in anything beyond that. Yes I know SQL. But as Greg Lahens pointed out in my last post, it leaves a lot to be desired in terms of performance. Now some might argue that SQL should be handled by a DBA who specializes in SQL. That is great. I know have 14 DSLs instead of 15 to learn. Oh wait. Sorry, I have just been informed that we don’t have a budget for a dedicated DBA. So I guess the requests for dedicated XSLT, CSS, and Regex developers probably are not going to be approved either. In most of the development shops I have worked in, the developer has no choice but to learn many of these DSLs. Most projects are not large enough to warrant the use of specialists, however almost every project demands great performance and minimal bugs. One false move in your CSS, XSLT, Regex, JavaScript, SQL or any of the other DSLs in use and you will severely impact the performance of your application. What is worse is that the methods and tools used for testing performance in each DSL is often vastly different. I have great tools to help me profile my VB/C#/Java code. Not so much when it comes to CSS, JavaScript, XSLT or many of the other DSLs in use. And even when good profiling tools exist, learning to use them often requires a significant time investment. I don’t know the ultimate solution to this problem, but I do know that every day it is only getting worse. The Computer Science community is cranking out languages and DSLs at a rapid pace. On top of that we continue to evolve our development methodologies and architectures such that the average programmer is left wondering how they can possibly keep up. Sure, the alpha geeks among us will be able to grok it all and crank out applications using the latest DSLs, but the average developer (who make up the vast majority of the programming resources building application today) is being marginalized more and more. I believe that DSLs have their place and certainly provide a lot of value, however we need to take a hard look at where we are going in this profession. I believe we need to find solutions that meet programmers “where they live” and not “where we want them to be”, by this I mean we need to find solutions to our CS problems that recognize that not all programmers are computer scientists. Not all programmers have the time or motivation to learn 15 different DSLs just to create an application. Not all programmers want to learn a new programming methodology because the old methodology is no longer en vogue. We need to simplify what we are doing so that it doesn’t take an army of specialists to build a decent application.
17 comment(s) so far...
re: Polyglot Programming: Death by a thousand DSLs
Ah I get it, it's April Fools Day. I was starting to get hot thinking that you wanted to dumb down software development. Whew. I'm taking cold meds, so it took a minute to get the joke.
By Amanda Laucher on
4/1/2009 10:10 AM
|
re: Polyglot Programming: Death by a thousand DSLs
I don't know if I agree with this. I agree with the fact that making something more complicated when it doesn't need to be doesn't really do any good. But most DSLs are designed to help me do something easier or better than the old way.
If I'm using ASP .NET MVC, I could write all of my HTML out by hand, or I can use the HTML helpers to help me do it. Why would I want to write all of that HTML by hand? Sure, I have to take some time to learn the HTML helpers (not much time), but I'll get that time back really quickly because I'll write better code and I'll do it faster.
Honestly I get tired of the "we shouldn't use technology X because it will be hard for the average developer to learn all of this new stuff". Certainly I have a problem with using a tool or a technology when it's not needed. But I'm not going to leave out tools that will help me do something faster or better just because someone doesn't want to learn how to use it. I'm more than willing to teach people how to use stuff, and I'm going to be careful to not overcomplicate things because of reasons that you've mentioned.
By Jon Kruger on
4/1/2009 10:17 AM
|
re: Polyglot Programming: Death by a thousand DSLs
You nailed it!
By Stuart on
4/1/2009 10:29 AM
|
re: Polyglot Programming: Death by a thousand DSLs
I agree that the number of DSLs is increasing. But does the presence of a DSL mean that you *must* use it? The existence of regex does not mean that I have to use it every time I manipulate a string. Aren't DSLs just more tools? Can't you just use them where they are beneficial. I didn't look at your SQL example, but was the way that you did it worse than putting the results of 'SELECT * FROM foo' into an ADO recordset then maipulating the RS by hand to get the data you wanted? I doubt it. So even though the use of the DSL wasn't optimal, it was probably better than the alternative.
By EBGreen on
4/1/2009 10:33 AM
|
re: Polyglot Programming: Death by a thousand DSLs
Only because I had never heard the term DSL used before. http://en.wikipedia.org/wiki/Domain-specific_programming_language
By Jonathan on
4/1/2009 10:34 AM
|
re: Polyglot Programming: Death by a thousand DSLs
Great post Joe.
As a manager, I take away from this the importance of good project planning from a DSL perspective (as much as possible). And also proper team planning. Many consider 3 developers to be the optimum team size, and if you're working with as many DSLs are you mention, 3 people lets each be skilled in 5, with a bit of overlap (in a perfect world).
Lone wolf developers are obviously without the "luxury" (a term I use loosely) of a manager and a team around them. In my own team I've found my devs certainly have a tendency to work on their own naturally, but there are times when forcing them to collaborate on a project has seen exponential improvement for the exact sort of reasons you're talking about.
By Jonathan Puddle on
4/1/2009 10:52 AM
|
re: Polyglot Programming: Death by a thousand DSLs
Excellent post. It doesn't help any when Microsoft or some other vendor just totally tosses a perfectly good DSL because they get excited about something else. All of a sudden you're not just trying to keep up with the DSLs you DO know but you're trying to unlearn a whole method of doing something and relearning it. This seems to happen about every 3-5 years within EACh DSL you're trying to track. Take SQL Server for example. Do you know how many times Microsoft has completely changed the interface for importing data from other sources. At least 3 times in under 15 years. It's maddening. You just get good at using one tool and someone decides - oh no, that's not worth improving we'll just toss it, screw the users. Microsoft Content Manager? Gone. Microsoft Ecommerce Server - totally replaced. I can't tell you the number of times they've reengineered their messaging infrastructure. Or their Office Application automation tools. This sort of thing isn't limited to MS of course, others do the same. As a Gold Authorized Partner we do a ton of MS work, and just keeping up with that is crazy! :)
By Lee Drake on
4/1/2009 11:29 AM
|
re: Polyglot Programming: Death by a thousand DSLs
@Jon - The point is not to avoid using the tools available. It is more about the pace of change in our industry and the increasing number of tools we need to use to get the job done. There is a cost associated with that. In most modern websites I will use 1) CSS 2) HTML 3) Javascript 4) Web template language (asp.net, NHaml, Brail, NVelocity, XSLT, Spark View Engine, JSP, etc) 5) GPL (vb, c#, java, ruby, etc.) 6) SQL or some alternative like an ORM. This does not include any discussion of testing, building, documenting and deploying the app which often have their own languages/DSLs/tools. Given that most modern development teams have limited number of devs to cover all these areas, you will often be forced to make sacrifices in expertise. Few people are experts in all these areas which means we often deliver apps with built in deficiencies because a dev knew enough to get the job done, but not enough to do it efficiently - either the code is substandard or it took a lot longer to build/deliver. Either way, there is a cost associated with the lack of expertise.
By jbrinkman on
4/1/2009 12:10 PM
|
re: Polyglot Programming: Death by a thousand DSLs
Ha ha... My little comment from before resulted in a full blog post and plenty of comments. :-)
As the subject of the article, I must say that I totally agree with you Joe. Sometimes it gets a little silly jumping around in the 15 DSL's involved in a project. There's always a way to improve the components of what we build, like cleaner, faster SQL but I find that many times that it isn't worth the time. But sometimes it is worth the time which is why I'm not shy about discussing these things.
Personally, I think developers just need to be people that are always open to new ideas and aren't offended by the suggestion of a "better way" to accomplish a task. Lord knows I've hired plenty of people who have schooled me and I've enjoyed it. It's the only to survive in this business..
Just for laughs we should do a poll... "What are the average number of acronyms that you see on developers's resumes?" It's silly sometimes!!! (XML, XHTML , HTML, VB, C#, T-SQL, CSS, JS, p/SQL... blah blah blah)
P.S. - My father is a retired 30+ year IBM'er and if you ask him he'll tell you that everything we do they already did 20 years ago on the mainframe. So we're all just really behind ;-) ha ha...
-Greg
By Greg Lahens on
4/1/2009 1:06 PM
|
re: Polyglot Programming: Death by a thousand DSLs
@Greg - I agree with you that I think developers need to be open to new ideas and should be in a constant learning mode. But there is a limit to how much you can learn. Using myself as an example in the last year I have jumped in cold turkey to jQuery (necessitating a revisit of my Javascript skills), SilverLight and Linq. I need to improve my skills on PowerShell, XSLT, CSS (where everyone is always behind), Javascript, SQL (specifically OLAP) and probably a few more. I need to drastically improve or learn skills in Automated Unit Testing, Automated Functional Testing, MVC, and a few more areas. This in addition to keeping up with DotNetNuke which we continue to expand and which necessitates a knowledge of things like server farms, Active Directory and many other topics that I left behind in my Network Engineering days. These are things that all directly impact my day to day job and do not take into account things that I dive into because I want to. I cannot possibly expect that every developer on my team will match my level of learning. That is unrealistic. So for those developers who don't have the time or the same drive as me, how do I keep them productive? How do I ensure that they are not being left behind because our applications are becoming increasingly more complicated? In the last 20 years, I have watched as programs went from being able to fit on a single floppy to applications spanning CDs and even DVDs. In many cases these large applications are still being written by very small teams requiring a very diverse skillset, and the problem is only getting worse.
By jbrinkman on
4/1/2009 1:30 PM
|
re: Polyglot Programming: Death by a thousand DSLs
I would much rather use the best tool for the job. Sure you can do carpentry with just a saw and a hammer but you'll do a darn sight better job if you use a plane, sandpaper, router, etc.
Yes, there's a cost with learning how to use more tools. Yes, you can do the same job without them. But will the job be as easy to do and produce as good a result?
By Garry Shutler on
4/2/2009 2:36 AM
|
re: Polyglot Programming: Death by a thousand DSLs
Feel free to use the best tool. But your analogy breaks down. It doesn't take weeks of dedicated use to learn how to use most carpentry tools. The other issue is that even the carpentry industry recognizes that that they are not also electricians and plumbers. I am all for the use of tools that make my job easier, but at some point the language and technology explosion is going to catch up to the industry and we would be wise to recognize the problems this is creating for us.
By jbrinkman on
4/2/2009 2:57 AM
|
re: Polyglot Programming: Death by a thousand DSLs
I'm not an expert in carpentry, but I would imagine it takes a significant amount of time to become proficient with a new tool rather than just being able to use it.
There is a danger of becoming a handyman (jack of all trades, master of none) if you explore and attempt to use every tool out there for anything vaguely related to your core trade.
If you want your sink to stop leaking you bring in a handyman, if you want to refit your kitchen you bring in an electrician, a carpenter and a plumber. If you want to be a handyman that's fine, but I want to be an electrician.
That is why there are separate roles of web designer, developer and database admin. I know a bit of web design, a bit of database admin but I by no means know how best to use all the tools available for those roles. I just muddle by with my hammer and saw when required.
When I'm developing software I use multiple tools which I am very proficient in and I am constantly evaluating new tools and removing redundant ones from my toolset.
We (as developers and designers of software) need to realise that we cannot do everything and if we do we will dilute our skills or drown in a sea of information attempting to keep up.
There is room for software handymen in the world, but I want to do more in my work than write 5 page websites for small companies.
By Garry Shutler on
4/2/2009 3:11 AM
|
re: Polyglot Programming: Death by a thousand DSLs
@Gary - I completely understand the need for specialization, unfortunately large parts of our industry are not setup to actually employ specialists. And some forms of development see this problem more than others. When I worked in Desktop app development the number of specialties was much more limited. In the web world, it is just the opposite. Many web developers may have access to a designer or a SQL developer, but when you are dealing with teams of only 3-5 people, there is not much room for specialists. When you consider the number of languages and technologies involved in a typical web app you really start to see that we are getting on shaky ground.
By jbrinkman on
4/2/2009 4:19 AM
|
re: Polyglot Programming: Death by a thousand DSLs
This is the joy of working in a maturing industry. The bar has been raised everywhere so that specialist tools are required whereas before a few general tools could do anything with a little knowledge.
Posts like this that stand back and go "hold on a minute, the landscape is changing" are required to move us forward. The first part of solving a problem is identifying it.
I've had situation like this at work recently where I suggested we got a web designer in to apply some proper design skills to a new project. However, my idea was rejected out of hand as "we can do a good enough job, web design is easy". That approach is becoming outdated fast in my opinion.
By Garry Shutler on
4/2/2009 4:36 AM
|
re: Polyglot Programming: Death by a thousand DSLs
The carpentry analogy of "right tool for the job" breaks down. You simply cannot drive a nail with a screwdriver, and if you hammer a screw the result will be ugly.
But using the "wrong" tool in software development just means extra work for the developer. It does not necessarily mean a low quality result.
Instead of the hammer/screwdriver analogy, a better analogy might be having a hundred specialized saws. These saws have overlapping capabilities, but each is best at one particular task. You have to decide whether it is worth the expense to purchase (and store, maintain, insure, ...) each kind of saw or whether you want to use a saw that you already own that will do the job.
By John Cook on
4/3/2009 2:25 AM
|
re: Polyglot Programming: Death by a thousand DSLs
Jesus, so my analogy doesn't map one-to-one to real life. You surely understood what I meant.
I'll make a bet I can drive a nail with a screw driver. Might take me a while though!
By Garry Shutler on
4/3/2009 3:59 AM
|
|
Tagcloud
Categories
Archives
|
|