wood burning stoves 2.0*
The moose likes Other Languages and the fly likes The power of scripting languages Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Languages » Other Languages
Bookmark "The power of scripting languages" Watch "The power of scripting languages" New topic
Author

The power of scripting languages

Peter den Haan
author
Ranch Hand

Joined: Apr 20, 2000
Posts: 3252
In another thread, someone praised Python (Jython) for being so well-integrated with Java. Other scripting languages have been specifically designed to be as Java-like as possible, e.g. BeanShell or DynamicJava. I would contend that embedded languages might be most useful when they are as Java-unlike as possible.
When the possible creation of this group was discussed in the moderator's forum, I said:
[...] scripting techniques (in the broadest sense) are undervalued, underused, and genuinely important. One of my frustrations with Java is that it is often used inappropriately. When applied well, Java's object orientation means that the solution can be formulated in terms of concepts from the problem domain, but that doesn't mean that Java is the best tool to do so. How much time would it take you to write Java code to transform an XML document from one vocabulary into another? The obvious answer is, you would never do that. You'd want to use XSLT in all but the most trivial cases.
Scripting can be a superior way to formulate solutions and business logic. It can use a more-or-less traditional programming language to add ease of development and agility (jRuby, when matured, might work wonderfully) or something completely different for problem-specific expressive power (such as XSLT). [...] For example, Ofbiz uses RuleML to express business rules. I understand they plan on adding a Prolog interpreter - another great example of a language that can reduce the effort to solve some problems by an order of magnitude (rule inference in this case).
Template languages are another example, even though despite worthy aims most of them are a poor excuse for a programming language.
At this point, I am particularly interested in the second way to use a non-Java-like embedded language: to solve certain classes of problems more more flexibly and quicker than you could achieve with Java or any of its peers. I have this gut feeling that there are enormous productivity gains and, heck, large quantities of fun to be had that way.
What are your thoughts? Do you have any success or horror stories to share? Am I spouting nonsense?
- Peter
[ February 15, 2002: Message edited by: Peter den Haan ]
Mapraputa Is
Leverager of our synergies
Sheriff

Joined: Aug 26, 2000
Posts: 10065
Originally posted by Peter den Haan:
Template languages are another example, even though despite worthy aims most of them are a poor excuse for a programming language.

I am not sure what you call "template languages", maybe something entirely different from what I have in mind. I worked with Clarion, a template-based code-generation engine, before moving to Java. Since then I have a feeling that Java isn't quite an adequate development tool
Here is an old article about it.
Clarion "hides" great amount of code in its templates, and you as a programmer only have to
1) choose an appropriate template ("table", "form" to edit a record, "report"...)
2) substitute parameters (which file you want to edit, which index to use for sorting etc.)
3) "plug in" your own pieces of code to do something that isn't in a template.
Clarion provides a lot of places where you can add your code: before file content is shown, before a record content is shown, after user closed the window, after user pressed given key... You communicate with templates through GUI and all job is pure joy We used templates that output code in Clarion language, but they had templates for C, Pascal, and maybe even Java, I am not sure.
We had a set of templates for a standard desktop application, and everything worked just fine until once we had to support hierarchical data and here standard templates weren't big help. Amount of "added" code probably exceeded amount of generated. We really should have thought about developing our own templates instead of misusing standard ones, but when you are in a "production mode" and all your code has to be written yesterday, you do not think, you code :roll:
An ideal variant would be to have one highly-qualified "template" developer in a team, who would analyze domain and modify/write new templates for the rest of gang. I believe that would speed up the development on an order of magnitude.
In my understanding, both a template-based and object-oriented approaches aim to achieve code reusability. OOA is more powerful, but it is much more difficult to master.
Of course, really thing would be to combine the best from both approaches: to keep all power and dynamics of OOA and to liberate a programmer from mundane coding. I did not think much in this direction, but I also have strong "gut feeling" that it is where enormous productivity gains and all fun is.
[ February 15, 2002: Message edited by: Mapraputa Is ]

Uncontrolled vocabularies
"I try my best to make *all* my posts nice, even when I feel upset" -- Philippe Maquet
 
jQuery in Action, 2nd edition
 
subject: The power of scripting languages