DSL

Ruby on Rails: An Interview with David Heinemeier Hansson

More on Ruby and Rails in this interview.

Rails is becoming the main reason people decide to pick up Ruby, which is something worth pondering. The interaction between a programming language and a very dominant framework, which isn't part of the standard library of language, is quite interesting.

Some quotes from the interview:

Rails is opinionated software. It eschews placing the old ideals of software in a primary position.

One characteristic of opinionated software is the notion of "conventions over configuration." If you follow basic conventions, such as classes are singular and tables are plural (a person class relates to a people table), you're rewarded by not having to configure that link. The class automatically knows which table to use for persistence. We have a ton of examples like that, which all add up to make a huge difference in daily use.

I really like our domain-specific languages. The beauty of specifying relationships with belongs_to, has_one, has_many and has_and_belongs_to_many. The ease of using validations like validates_presence_of :name.

I think Rails feels, smells, and tastes like it does exactly because its very Ruby-like. It plays heavily on the best in Ruby. The blocks, the ease of creating domain-specific languages, and so on.

What has happened, though, is that Active Record has reduced the pain of dealing with the object-relational mismatch to a point where its a lot less appealing to seek alternatives—especially with databases like SQLite that give you the feel of flat text files, but within the context of SQL.

General Purpose Cellular Automata Programming

In this thesis, a new cellular automata simulation environment, jTrend, is introduced. jTrend was developed on the Java platform for cellular automata exploratory research. With a built-in high-level programming language and an easy-to-use graphical user interface, jTrend has become one of the most powerful cellular automata simulators, and can be used for most one- and two-dimensional cellular automata simulations.

My queries about DSLs for cellular automata didn't get many responses, so perhaps this master thesis would be of interest.

The language design isn't very radical, and the language is quite easy to grasp. The integration between the language and the simulation environment is a bit unusal (e.g., the cells neighborhood isn't defined in the code).

Behaviour: Using CSS selectors to apply Javascript functionality

An amusing library that lets you use CSS selectors to specify elements to add javascript events to.

The terms pattern matching, and declartive programming come mind.

You can also think about it as an embedded DSL.

I came across Behaviour via this simple example which shows the style of programming the library leads to.

Language Workbenches: The Killer-App for Domain Specific Languages?

(via the LtU DG)

Martin Fowler writes,

Most new ideas in software developments are really new variations on old ideas. This article describes one of these, the growing idea of a class of tools that I call Language Workbenches - examples of which include Intentional Software, JetBrains's Meta Programming System, and Microsoft's Software Factories. These tools take an old style of development - which I call language oriented programming and use IDE tooling in a bid to make language oriented programming a viable approach. Although I'm not enough of a prognosticator to say whether they will succeed in their ambition, I do think that these tools are some of the most interesting things on the horizon of software development. Interesting enough to write this essay to try to explain, at least in outline, how they work and the main issues around their future usefulness.

When I was learning to program, we simply called these things good programming...

Seriously, much as I like DSLs and am happy to see more people think about the role of language design in software design, I think it is important to stress that good sofware design comes from familiarity with a large set of techniques. Language oriented techniques are useuful, but they aren't a panacea. They deserve wider recognition, being almost totally unknown in the wider programming community compared to other techniques (e.g., patterns), but shouldn't promise more than they can deliver.

I vaguely remember a long "tutorial" we linked to a couple of years ago about becoming a professional programmer, which included language design along with other techniques one must master. If this rings any bells, please post the link since I don't remember any more deatils...

Links Demos

Philip Wadler has a pair of Links demos up and running. One is a to-do list (source) that runs on the server but keeps state on the client via continuations; the other is an input validator (source) that is translated into Javascript to run on the client. A sample of the latter:

<input l:name="word1" type="text" value="{word}"/>
{[ if word == "" then <font/>
   else if isdigit(word) then <font color="blue">ok</font>
   else <font color="red">error: {[word]} is not a digit as a word!</font> ]}

(Previous Links discussion on LtU)

Cellang

The system consists of a compiler for the Cellang cellular automata programming language, along with the corresponding documentation, viewer, and various tools. Cellang has been undergoing refinement for the last several years, with corresponding upgrades to the compiler...

The most important distinguishing features of Cellang, include support for:

  • named constants...
  • any number of dimensions
  • compile time specification of each dimension's size
  • cell neighborhoods of any size (though bounded at compile time) and shape
  • positional and time dependent neighborhoods
...

Well, I did ask for a DSL for cellular automata. Here's one...

Semantic Streams: a Framework for Declarative Queries and Automatic Data Interpretation

We present a framework called Semantic Streams that allows users to pose declarative queries over semantic interpretations of sensor data. For example, instead of querying raw sensor data, the user can query vehicle speeds; the system decides which sensor data and which operations to use to infer the vehicle speeds. The user can also place constraints on values such as the confidence with which the speed was measured or the amount of energy consumed to measure the speeds. This framework is designed to work in a shared sensor infrastructure, where multiple queries may coexist for extended periods of time, instead of a hand-designed, single purpose sensor network. We propose a semantic service programming model and describe a service description language and a query processor that support the programming model. We demonstrate how this system can be used with a network of video, magnetometer, and infrared break beam sensors deployed in a parking garage.

The declarative framework is based on Prolog and CLP(R) and implemented using SICStus Prolog.

Chris Coyne's Context Free Design Grammar, and SCIgen - Randomly generated CS papers.

Chris Coyne's Context Free Design Grammar was just mentioned by Perry Wagle on the #haskell irc channel. It's a beautiful use of simple concepts in a surprising manner. If you haven't seen the examples, you're missing out.

Chris mentions on the download page that's he's gotten a lot of hits because he's linked from SCIgen, the recently slashdotted automatic CS paper generation project at MIT. Even more amazing, One of their randomly generated papers was accepted.

Pugs, Practicing the Theories.

A lot of language theory goes past here on Lambda the Ultimate, but we rarely see that theory directly impacting commercial programmers.

I'm a great fan of theoretical concepts like arrows, but at the same time I'm a self-employed programmer interested in solving my clients' problems.

Pugs is notable in that it profitably uses recent developments such as GADTs and Template Haskell for an implementation of Perl6.

I recently became a regular on the #perl6 irc channel and soon after joined the list of committers.

In just a few days I've seen a lot. I've seen enthusiastic members of the Perl community learning Haskell. I've seen myself learning Perl. I've also seen how daily Perl programmers work with abstractions like monad transformers. I've seen how some structures are easy to extend for programmers new to both the Pugs codebase and Haskell.

The Pugs project was started 64 days ago by Autrijus Tang, as an exercise while reading TaPL. Pugs already includes network and threading primitives. New tests and code are add at an amazing rate, as evidenced by the smoke tests.

I don't know if I'll end up using Perl after Pugs is written, but I am learning how to practice the theory of programming language design and implementation.

Wheat - A Language for Web Sites

Wheat is a programming language, library and environment for creating internet programs. Its target audience is developers of small to medium sized dynamic web sites. Wheat's goal is to be the kind of environment you'd write Wiki or blog software in.

Wheat takes a fundamentally different approach to web programming than common web scripting systems. In Wheat, all objects exist in a single hierarchical name space, which in turn maps onto the URI name space. Hence, all objects in Wheat have a URI, and are accessible via the web. The Wheat virtual machine is in fact a web server. Requests via HTTP are mapped to objects, which are then rendered via XML templates, usually to XHTML, and then returned.

Just stumbled across Wheat and thought people here might be vaguely interested. At first glance, a bit like Squeak via a web server. It has been mentioned only briefly before.

XML feed