Language-Centric Software Development

Joe Gregorio

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. Separable
  2. Testable
  3. Expandable
  4. Flexible

Separable

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

Testable

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

Expandable

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

Flexible

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:

  • Large
  • Focused

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 of 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:

  • Telix
  • Kermit
  • Almost any text editor, including vi.
  • Even modems understand their own AT language.

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:

  • Any application with Visual Basic in it.

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:

  • Visual Basic in Word and Emacs Lisp?
  • Visual Basic in Excel and Mathematica?
  • Visual Basic in Access and SQL?

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.

Tools to add a scripting language to applications are missing from most  languages. Weird since I see languages everywhere - In almost every application.

Is the cost of this ending up with a VB equivalent that does everything badly and is not focussed as you suggest? I's like to think that is not the case and a common set of tools could provide the basic kit to create whatever language facilities you require - imperative, functional, declarative, logic, oo? What tools would you really need in a language to support this?

Another toolset missing is simple database support facilities. Nevermind highend RDBMS/SQL support I just mean GDBM type stuff.

How about some integrated tools for the internet? say get file from web/ftp? send/get mail? What about a md5 checksum checker/generator integrated too? PGP signing?

I feel like i've gone off topic - but I am also suggesting that the proposed scripting language has a subset of these features too.

Good artice. Got me thinking.

s.

Posted by Stephen on 2004-05-31

i am nirmal,studing engg ,i want study networking,soplease help what are basic need to want to study the networking,so please help me,thanking you.........

Posted by nirmal.r on 2005-06-30

comments powered by Disqus