While it takes just a few keystrokes and mouse clicks to post a tweet on Twitter or “friend” someone on Facebook, it may require thousands of lines of code to accomplish the task.
Dog, a new programming language, could make it easier and more intuitive to write all sorts of social applications—anything from peer-to-peer question-and-answer sites to online dating. And because Dog incorporates natural language, this may make it easier for newbies to learn to code, too.
MIT Media Lab professor Sep Kamvar, who developed Dog with the help of some graduate students, hopes to release the language in a private beta version in the next few months, and offer a public release of it in the spring.
Dog emerged from Kamvar’s frustration with existing programming languages, such as Java, which he felt were needlessly difficult to use to write code governing social interactions. Things that were easy to describe in English—such as a command to notify a person of something—had to be thought of in terms of data storage and communication protocols when he sat down to write it in code.
“I had to write code at a lower level of abstraction than I had to think about the interactions,” he says. “And so I thought it would be interesting to start writing a programming language that allowed me to write at the same level of abstraction that I think.”
Kamvar started working on Dog by defining specific challenges he has with traditional programming languages when building social applications, which include identifying people and talking and listening to them. He came up with some ideas for solving these problems with a new programming language—for example, to make it easier to identify people, he made people a basic data type that the language could recognize, just as other languages recognize strings of text or integers.
Then he created a simple syntax around these ideas that uses natural language (since the language deals with coordinating and communicating with people) and focused on a small set of very clear commands: ask, listen, notify, and compute. A sample line of code in a simple social news feed application reads, “LISTEN TO PEOPLE FROM mit VIA http FOR posts,” which would have the application monitor the Web for updates from a group of MIT-affiliated people.
While all these things can be done in other programming languages, Kamvar contends it’s not generally very easy. And users can import functions from other programming languages, Kamvar says, so interaction design and social processes can be written in Dog while other functions can be written in another language.
Over the past year, Kamvar and students have been developing the Dog compiler—the software that turns code into a task that a computer will execute—and writing demo programs in the language to test it out such as a Twitter-like news feed. One is a peer-to-peer teaching-and-learning platform called Karma that works within a user’s extended social network; it is expected to be publicly available by next summer.
Dog will be free and open source, so users will be able to add to it and modify it as they wish. And while Dog is a server-side language, which means it relies on sending data to a server in order to execute tasks, the group is also building a client-side version.
Kamvar is likely to face some Dog skeptics, such as Robert Harper, a computer science professor at Carnegie Mellon University who studies programming language theory. While Harper says it makes sense to create languages that are easier for non-coders to understand, he doesn’t see programming for social computing as a niche that needs to be filled. And though a language such as Dog may start out as being geared toward a special type of coding, “you invariably get involved in more complex issues, and if you’re using a language that’s coded to stereotypical scenarios, it quickly breaks down,” he says.
While Kamvar emphasizes that he doesn’t see Dog as natural language programming in the vein of, for example, Wolfram Alpha or Inform 7, the inclusion of natural language phrasing should make Dog more easily understood by non-programmers, such as interaction designers or product managers at startups, who often come up with ideas about what needs to be done but then must wait for a software engineer to make those changes to the company’s code.
More generally, Dog could make it simpler for anyone to program or at least understand what’s going on behind the scenes of a website. Despite the attention paid to online code-learning startups like Codecademy, not much attention has been focused on the fact that programming may just be harder than it has to be, Kamvar says.
“Maybe that attention should go toward designing programming languages that are inherently more learnable, but still industrial strength,” he says.
Copyright Technology Review 2012.