It appears that you have JavaScript disabled. Click here to find out what you're missing on this site.

The Site Formerly Known as Bit Working This site has moved to http://bitworking.org

by Joe Gregorio

Language-Centric Software Development

Think of a really good piece of software, a program that is either really popular, has a really fanatical following, or is just your personal favorite.

I predict that the program you chose has a scripting language embedded in it. That's it. That simple. I'm right aren't I? Mere coincidence? No.

Benfits of language centric design

All really good software development takes place around a language. Why? Having a language embedded into a piece of software gives several important benefits:

  1. Seperability
  2. Testability
  3. Expandibility
  4. Flexibility

Seperability

An embedded scripting language allows modules to be seperated. Each module just interfaces to the script engine to export it's functionality.

Testability

Test cases are faster to write in a scripting language. This speeds up your test, code, integrate cycle.

Expandibility

New functionality can be added to the program just by adding to the set of scripts the program ships with.

Flexibility

It is easier to adapt your program to specific customers just by changing a script rather than re-building a new executable.

Attributes of a good embedded language

Just because you have a scripting language doesn't mean your going to get all the above benefits. There are some attributes that your embedded language should have:

Size

How much of the program is touched by the scripting language. The higher the percentage the better. This means that the scripting language is central to the operation of the program and that a large percentage of the program can be manipulated from, or is implemented in, a script.

Focus

The language you choose must be focused on solving the problem at hand. Don't build just any language, build a language in the domain of the problem you are trying to solve.

If you are writing a text editor, write a language that makes string and buffer manipulation easy.

If you are writing blogger software, write a language that makes short work content manipulation and formatting.

If you are writing drafting software, create a language where geometric shapes and transformations are fundamental operations.

If you are writing a statistical software package, create a language tailored to manipulating data sets.

Examples

How about some positive examples of good programs organized around languages:

Layoutpostscript
StatisticsSAS
MathematicsMathematica
Text EditingEmacs Lisp
EngineeringAutoLisp

Other programs that have scripting languages:

How about a list of poor programs? Just because a program has a scripting language doesn't guarantee success. Well in this case I am just going to list one item:

Why are these programs slow, clunky and difficult to work with? How often to you write a 'quick' little script in Word? Excel? Access? Outlook?

What is the difference between:

The latter are languages tuned to solve problems in a very specific domain. The former are all the same language with a different object model stuck on the side of it. Applications with Visual Basic in them ignore the Size and Focus attributes of a good embedded scripting language.

Think about how many languages you know. Personally I program in these on a weekly basis: C, C++, HTML, XML, XSLT, CSS, Perl, JavaScript, and several tiny languages of my own devising...

How come I can easily switch among 10 languages with out missing a beat yet I can't retain the object model for Word?

Summary

When developing a piece of software concentrate on building a languge to solve problems in the domain you are working in. No one fixed language can solve every problem so build a customized language just for that domain.