Prometheus: Overview

Last time I gave a brief introduction to my understanding of the agent-oriented programming (AOP) paradigm. To me, it’s a deeply interesting perspective from which to consider the operation of a computer program: as though it were a human system composed of a number of people interacting and working towards their own desires to achieve an overall system goal. At a high level, designing such a system is akin to designing a business process and selecting humans to fill the roles.

I imagine it’s something Alan Turing would have considered inevitable. If computers could be intelligent to the extent that they were conversationally indistinguishable from humans, then surely we could slot them into our logical processes in place of such a human.

Of course, a good little software engineer shouldn’t jump right into solutions; engineering is about repeatable processes, and the traditional object-oriented processes are not entirely appropriate for the level of abstraction that AOP offers.

Prometheus is a design methodology developed specifically for agent-oriented systems. It is similar in the sequence of activities to the more traditional object-oriented methodology, providing a number of concepts represented in a number of diagrams and detailed descriptions which compose a complete design. It goes through three familiar phases of specification (essentially requirements), architectural design and detailed design, with a number of artefacts that are developed concurrently and iteratively. Many of these artefacts can be cross-checked against each other to ensure consistency along the way, and the Prometheus Design Tool helps to automate this auditing.

The overall methodology is well described in the 2004 paper The Prometheus Methodology, and represented in the diagram below, with the phases as horizontal swimlanes and the artefacts as boxes in the appropriate phase. The solid arrows show how each artefact is derived from others, and the dashed arrows represent the cross-checks you can perform between them.


A high-level overview of the Prometheus methodology.

It’s a neat little diagram, and provides a good visualisation of the way in which various artefacts are developed and feed into other artefacts and so on. As a high-level diagram it doesn’t capture a lot of the detail (which the paper goes on to explain), so for a little more precision I prefer to break the phases down into separate, more comprehensive diagrams.

I’m hoping to find some time to cover each of them in future posts, but it’s a hefty process and we’re still busy trying to fit everything together outselves. I’ll try to divide them and conquer each stage in a separate post, then combine them at the end with a practical Prometheus tutorial, with reference to some of the work that has gone into our year-long software project.

As an addendum, Prometheus was created by Lin Padgham and Michael Winikoff, researchers from RMIT University’s Agents Group, just down the road from my University of Melbourne. For the record, Melbourne also developed an AOP design methodology called ROADMAP, but it’s much more abstract and incomplete beyond the requirements phase. Padgham and Winikoff wrote a book on Prometheus called Developing Intelligent Agent Systems: A Practical Guide if you’re interested in learning more, and there are a number of papers (that say much the same thing) with a wealth of references at the end of each.

* Without diving too deep into semantics, a process is a series of activities performed to achieve an end, whereas a methodology is a combined set of principles, methods and processes; a process is a subset of a methodology. Prometheus provides a set of tools as well as a way to go about using them, and hence is considered a methodology. This kind of completeness is essential for something so fundamental to provide real value.

Agent-Oriented Programming: A Brief Introduction


Not quite the same, but much catchier.

Agent-oriented programming (AOP, not to be confused with aspect-oriented programming) is a programming paradigm in the same way that object-oriented programming (OOP) is; it provides a set of concepts, and a way to think about the world in terms of those concepts. AOP is a more recent development, and still an area of considerable research and standardisation. Wikipedia traces OOP back to the 1960s, while AOP came about from research into artificial intelligence by one Yoav Shoham in the 1990s. As someone who is fascinated by new ways of thinking about software and its development, AOP is of great interest to me, and I’ve been quite fortunate to fall into a year-long university project centred around it (on the Android platform, appropriately enough).

So what is AOP? What is an agent (more precisely a “software agent“), and how does one orient one’s programming around them? AOP sits one level of abstraction above OOP, such that agents are effectively abstractions of objects. Intuitively, agents can be thought of as software entities with intelligence, just as we think of science fiction AI robots. They are machines, or in this case computer constructs, but at runtime we provide them with instructions as if they were people, like everyday colleagues. In particular, we try to avoid micromanagement of communications between agents; ideally, we would like to provide them with a task to perform and allow them to talk with each other to determine how best to accomplish it.

As if computers weren’t already making humans redundant in enough ways, taken to the logical extreme you might think of AOP as a blueprint for the obsolescence of human labour. Agent-oriented software engineering (AOSE) goes through the typical software engineering phases of requirements and design, but it does so in, again, a more human fashion. It’s more similar to designing a business process workflow than a set of modules; the focus is on the dynamic communications, the flow of information through the system, rather than the static structure, and the communication takes the form of messages passed between ‘roles’. Roles are more or less what you would expect: responsibility for an area of functionality, and the separation of concerns principle applies to keep individual roles coherent and independent. These roles are eventually adopted by agents, and then each agent has its capabilities specified hierarchically (multiple levels of sub-capabilities to achieve each capability), and the abstractions are peeled away layer by layer until each agent is composed of a set of concise, almost atomic, functions. Ultimately quite similar to OOP, but overall we’re more concerned with what an agent can do, and which other agents might be interested in that service.

The main application of AOP that comes to mind is artificial intelligence for autonomous robots, and the canonical example is one such robot that inhabits some arbitrary environment which it scans for rubbish, and upon detecting some rubbish, picks it up and drops it off in a rubbish bin. Even in such a simple case (well, it’s no driverless car), it’s interesting to consider what types of components are required. One common class of agents have beliefs, desires and intentions (hence BDI agents), just like humans, and can operate autonomously with very few ‘moving parts’:

  • Beliefs represent what the agent knows to be true or false about its environment (e.g. there is some rubbish at location (X, Y)). Beliefs are updated when the agent perceives some unexpected change in the environment (much like an event-driven programming model);
  • Desires describe the agent’s goals, or the state it would like the environment to be in (e.g. no rubbish at any location (X, Y));
  • Intentions are the actions which the agent can take to affect its environment, based on its beliefs, in order to change the state of the environment to achieve its desires (e.g. if some rubbish exists, the agent will intend to pick it up; having picked it up the agent will intend to move to the rubbish bin, and then drop it off, and so on).

Firstly, it’s interesting to consider that these basic constructs alone can theoretically describe much of the field of physical human endeavour (where the environment is the physical space-time continuum that we inhabit). However it may also be interesting to consider what human activities cannot be modelled in such a way. For example, I can’t quite picture how machines will be able to emulate the mental creativity of humans (though I’m sure they will eventually), and this is difficult to model since there is no tangible environment and often no precise desires. Empathy, or the natural understanding and sharing of emotion, would also be difficult to emulate for similar reasons, but also because an emotionless machine wouldn’t have that individual experience to fall back on. It comes down to the idea of understanding, which raises the question of what is meant by the phrase machine learning. I consider this roughly equivalent to becoming statistically more accurate by the modelling of some logical process, but whether this is actually increasing any kind of understanding on the part of the machine really depends on your definition.

Of course, there are many less fluffy applications for agent-oriented programming, and I look forward to exploring some of them in future posts. It’s a genuinely thought-provoking topic, and I hope I’ve got your mind ticking over too. It’s a field that appears easy to understand (they’re just like people, right?) though very difficult to really get your head right around, but one that I think might just be worth the time.

A Post A Day Keeps The Procrastination Away

I always say it, right? I’m going to start writing things again! I know it’s a great idea, that it’s beneficial in all kinds of ways, and that it only takes a few minutes (depending on how pedantic I’m feeling). It’s a creative outlet that takes weight off the mind and in doing so shares that weight with others who might have a use for it. Blogging is a thinking person’s hobby.

But inevitably I don’t. Why?

Doesn’t matter. This time it’s for real. “Hah!” you may exclaim, and you may even be right to do so. However I have a comrade in arms now, a little Chrome extension called Blockr which doesn’t let you use the internet until you’ve written X words or made Y code commits for the day. In effect you’re buying internet time by achieving goals you set for yourself. Pretty neat if you ask me. I discovered it via Lifehacker, another neat source of inspiration I’ve been growing increasingly attached to (life is too important not to hack into shape).

Blockr reminds me of the Beeminder concept of TagTime, in which you’re occasionally and unpredictably accosted by a popup box asking what you’re doing right now. Over time, that random self-reporting will form a statistical picture of what you’re likely to be doing at any given time, and thus it can subconsciously (and occasionally actively) drive you to work on ‘the right things’ at the right times.

Well, I’ve decided time and time again that writing some words about what I’m working on (projects, challenges, technologies, general trivia) is a good thing to be doing, so let’s see how it goes. I’m doing so many varied and interesting things these days that I’ll always have something to write about, even if it doesn’t seem terribly exciting at the time. Story-telling is an art, and arts take practice.

So here we go. Wish me luck.

Farewell Semester 7

Agile wall

Smells like progress!

Today marks the end of my seventh semester of university, having finished my last exam. Hooray! What happened?

First of all, exams went very well! Not much more to say there.

‘Twas a good semester of subjects, with some fundamental theory but unfortunately very little coding. Linear Algebra was surprisingly engaging, and Software Requirements Analysis and IT Project Management were about what you’d expect: valuable but fairly dry. Looking forward to some dirtier hands next semester.

Our year-long software project has been pretty exciting! Working with the Nossal Institute, we’re developing an agent-oriented medical platform with applications for diagnosis, treatment and drug dosage calculations. After a lengthy requirements engineering period we’re now digging into the code, which is almost all Prolog (I know!). Watch out for us at Endeavour, and in future posts right here! I’ve been learning a lot about agent-oriented software engineering, and it’s more than a little fascinating. I look forward to exploring it further.

It was also my first semester of tutoring first/second year students which was an experience. It really provides a fascinating perspective on the education process. Kids these days… Actually it was fantastic, I had two great classes full of (mostly) enthusiastic students that I tried to encourage as much as possible. It’s very rewarding work. I probably won’t tackle it next semester however due to time constraints, due in large part to…

MUtopia! MUtopia is a university research program I’ve been working on as project manager and software engineer for the past few months, and it appears to have a very bright future lined up. In a sentence, it’s a sustainable urban design, simulation and 3D visualisation web application. It can be used to model planned urban developments, run cutting-edge research simulations and analyse the outputs under custom scenarios to perform cost-benefit analyses. Check out the brochure in the link for some more details.

This is most exciting because come the end of July, we’ll have doubled our development team from two to four, and I’m going to be running it as an Agile project. Yes, that means we’ll have our own Agile wall! I’m looking forward to the challenge of managing a real project with the freedom to experiment. We’ll be having retrospectives every week, so hopefully I’ll have some reflection to post up here.

Whew.

So now I have about a month of holidays, but I won’t be getting a moment’s rest. Not only is MUtopia being kicked up to roughly full-time work over the break, but I’ve got a bundle of side projects lined up to attack in any time I have left over. How people manage to be bored in this day and age is beyond me. I’ll try to keep this blog updated with what I’m up to as I go. I know I keep promising that, but hey, n’th time lucky?

Excitement!

Photo courtesy of http://www.gerrykirk.net/options-for-team-task-board-when-one-team-member-remote/

Oh, Hello!

So I’ve been away for a little while. I know, and I feel a little guilty, but hey, that’s what holidays are for. I’m now officially getting back to some degree of work, and to that end have created myself a goal with the pretty cool Beeminder to work for at least 20 hours per week on Piemaster-related stuff. Currently no pledge, but it’ll start going up if I start failing. Wish me luck!

So what am I up to now?

The main coding focus at the moment is Buffex, which I still haven’t written much about, despite promising to do so multiple times. Maybe I should write about it first to hash out the scope of the MVP. In any case, it’s coming along rather well, and I’m currently working on wrangling all the data.

In non-programming news, I’ve been spending a lot of time over the past couple of months cleaning up the garden (it’s been a jungle for years) into a presentable state, and performing some dedicated research into the wonders of aquaponics (see this Practical Aquaponics video for 12 minutes of introduction). I want to write lots about it because I’m kind of obsessed at present, but I’m afraid no one much cares. Once constructions starts in earnest (have to order a few more parts) I’ll get onto it.

I’m also heading back to uni this year and applying for a couple of jobs. One is pretty standard tutoring of relatively simple computing subjects, and the other is a pretty exciting engineering faculty project called MUtopia, for which I may be responsible for developing some kind of stakeholder feedback management system, rather than the actual simulation stuff. Still a cool project to be involved with (if approved), and the role sounds like a great experience (from what little I currently know).

Finally, I’ve had a request pop up to write a few sheets of drum tablature, for which I’ve resurrected the old Taboo! Talk about a blast from the past. Ran into a whole bunch of exceptions since I wasn’t a fantastic programmer back then, but it got me thinking again about my old plans to take Taboo to the web as a JavaScript application. Now that I’m actually using some JS in anger, I may give it a go when/if things cool down for a while.

So that’s me. I’ve been very busy with all kinds of things, but am now getting back to being busy with the right things (from this site’s perspective, anyway).

Automatically Expand Facebook “Older Posts” Links

This evening I had that not-uncommon need to track down some dusty old Facebook comments from a couple of years ago. Naturally, Facebook makes it difficult to see anything more than a week old, but if you keep clicking “Older Posts” at the bottom of your (or a friend’s) Wall for long enough, you can see all posts back to the beginning of time.

This is kind of nice, but very tedious. Surely there’s a way to automate this process? I’ve seen numerous attempts, but many are either too complex for such a simple task (such as the sprawling Social Fixer browser extension), or too simple for the ever-changing complexities of Facebook. I decided to take a couple of pointers and put my new-found jQuery skills to a quick test. The result: FBExpand, a simple tool for a simple purpose.

The code is up on Bitbucket for inspection, but to put it to work right away it’s much easier to use this bookmarklet: FBExpand. Drag that link to your bookmarks bar, and simply click it when you want to expand some Facebook history (e.g. when viewing your Wall). Too easy!

The code

(function(){
// The text in the link you wish to automatically expand.
var expandText = "Older Posts";
// Timer delay (ms) between 'clicks'. Set to roughly the time it takes to load
// the next link text. May need to increase value for slower connections.
// Too short may freeze the script, however too long will waste time.
var delay = 1500;

These couple of lines allow for some minimal customisability. The script locates the link button based on the text within it, chosen by the expandText variable. This strikes me as more future-proof against Facebook’s endless interface changes than an otherwise more precise approach of drilling down the DOM or picking out element IDs and classes. The delay variable is more or less explained by its comments.

/*
Reduced from Karl Swedberg's jQuerify bookmarklet script at:

http://www.learningjquery.com/2009/04/better-stronger-safer-jquerify-bookmarklet/

*/
// Ensure jQuery is available as $jq

(function(){
if(typeof jQuery!='undefined'){$jq=jQuery; return;}
var head=document.getElementsByTagName('head')[0],done=false;
var script=document.createElement('script');
script.src='http://code.jquery.com/jquery-latest.min.js';
script.onload=script.onreadystatechange=function(){
if(!done&&(!this.readyState||this.readyState in ['loaded','complete'])) {
$jq=jQuery.noConflict();
script.onload=script.onreadystatechange=null;
head.removeChild(script);done=true;
}
};
head.appendChild(script);
})();

This block is simply Karl Swedberg’s jQuerify script reduced to its bare bones (i.e. removing the visual feedback). It ensures that the jQuery library is loaded and bound to the variable $jq before proceeding. Read his post for an explanation; it’s about the third version, and it’s quite neat.

// Keep clicking the links until there's none left
var loop = setInterval(function() {
var a = $jq('a:contains("'+expandText+'")');
if(a.length) eval(a.attr('onclick').split('return')[0]);
else {clearInterval(loop); console.log("All posts expanded.");}
}, delay);
})();

Here’s my stuff – it looks awfully straightforward after all that. Essentially, it follows a few simple steps, outlined below. Since the code is wrapped in a setInterval() function call, it is called again every delay milliseconds. This allows Facebook a little time to load the next batch of posts before performing another click.

  1. Find the expand link based on the text contained within it using a jQuery DOM selection.
  2. If the link exists, grab its onclick code and execute it, effectively emulating a user’s mouse click. For some reason simply calling .click() on the jQuery object wasn’t working, so this was my workaround.
  3. If the link doesn’t exist, there’s nothing to expand, so the script ends, putting a stop to the repetitive interval execution and printing a simple debug message to the browser’s console.

Thoughts

This little exploration has done little to change my perception of JavaScript as a rather hacky approach to software development. Of course, any language can only be as elegant as the task (and developer) allows, and if you’re trying to do hacky things like this, then JS/jQ are fantastic. As far as modern web UI design goes however, I’m still looking forward to spending some quality time learning Dojo in the future. Coupled with Backbone.js, it looks like a very powerful tool for any serious web development.

Naturally, such a tiny script should be very possible without any jQuery-like library. In retrospect, the only thing I use it for is to select the expand link node. Perhaps I’ll rewrite it tomorrow to do that in standard JS and cut the script in half. It’s all good practice, in any case.

Finally, my efforts went somewhat unrewarded, since I didn’t find the exact post I was looking for. I realised too late that it was a comment on an activity (Liking a Facebook page) rather than on a post. Since activities aren’t really shown on one’s Wall the same way any more, neither that Like or its comments could be found. If anyone knows how I might be able to locate something so specific, please let me know! I’ll own you one.

Holiday Direction

The updates have been fairly sparse recently, but as Christmas (or equivalent) approaches everyone gets pretty busy. Fortunately, a few of the things I’ve been very busy with are Piemaster-related: I’m breaking some new ground with Forgbook and Buffex, and exploring a couple of other potential projects on the side.

Forgbook has received a lot of competition lately, as numerous development teams small and large have release highly polished task management applications, such as AsanaDo.com and Orchestra. Many of these have a strong emphasis placed on collaboration across tasks, but still none offer the ability to arbitrarily break down tasks into subtasks. This seems like a pretty fundamental thing to want to be able to do, and is of course the cornerstone of Forgbook.

However all of these applications do offer very slick user interfaces, and to at least be competitive, I’ve realised that Forgbook requires a modern makeover. As such, I’ve finally taken on learning some JavaScript properly, because against my wishes it has undoubtedly become the modern web’s lingua franca. I’ve been mocking up a few single-page AJAX applications with the very handy Backbone.js library, which drastically simplifies (or at least provides structure to) the MVC design of the user interface. It’s quite reminiscent of my time with Adobe Flex, minus the constant annoyances of Flash, and I’m hoping to write a bit about it once I’m a little more comfortable.

On that note, I’ve been approaching Buffex from a more modern perspective as well. I noticed I haven’t mentioned Buffex in a post before, and indeed the project page has been a rather misleading “Coming soon.” for the past year or so, but you’ll hear a lot more about it soon. Since the minimum viable product (MVP) incarnation of Buffex is relatively simple, I’ve decided to focus my efforts on that for the time being before pressing on with Forgbook (which is looking much slicker than it used to, but has a lot of work to go). I’ll be taking a Backbone approach to Buffex too, to try and have nice, snappy interface and keep everything nice and simple.

That’s more or less where my head is at the moment. Those couple of other ideas I mentioned will get some more attention next year, but I can say that one of them has been born out of my recent fascination with gardening. If there are any gardeners out there, let me know! I’m trying to bring a rather unorthodox approach to it, and would love to discuss it with others. Techies tend not to be very enthusiastic garderners however, which is both a good thing and a bad thing in some sense. Regardless, I know I’m looking forward to it.

Pre-introducing: Carrot

Jario was never supposed to be a full-blown game, it’s merely a tech demo for Artemis, and something of a framework to go onto bigger and better platformers. I thought I should mention that one such game is now in the works. It’s still very early days, but it’s codenamed Carrot.

Like Jario, Carrot is a 2D platformer using the Slick game library and Artemis framework. Unlike Jario, I intend to build it up to be a good and proper game. I’ll keep you all posted and release some more details once we’ve actually figured them out ourselves!

Forums Are Up!

So as I mentioned, one of the nice things about Drupal is the integrated forums. There’s a WordPress plugin called bbPress which provides integrated forums for WordPress, but it’s still early days in terms of a number of features. For one, it seems happy to style itself independently of the rest of the site.

You may have noticed the shiny new white theme around here; it’s the same Twenty Eleven theme I was forced back to yesterday, but the white version. Why? Forums.

The bbPress forms insist on being white. They looked rubbish in the old Mystique theme, clashed with the black Twenty Eleven theme, but work quite nicely in this new one. Hence I’ve finally settled on the bbPress 2.0 plugin as the implementation of the Piemaster.net forums. For one thing, this means you can go ahead and start posting things right now! For another, it further reduces the urgency to migrate to Drupal. I suspect I won’t be after all now, to be honest. There’s so much else to do!

Near the top of that list is updating the existing project pages. They’re a bit… boring. I need to spruce up the content, and tell everyone to post their questions, comments and inevitable problems to the forums. Answering recurring questions via email is no fun for me, and doesn’t scale at all, since I can only help one person at a time, if that. Answering those questions in a forum lets everyone keep track of the situation and maybe even help each other out if they’re feeling generous. This is obviously the way to go, and now that I’m happy enough with the bbPress implementation, it’s the way we’re going! Go have a look!

Speech Freer: Working Under PHP safe_mode

So I’ve mentioned I’d really like to migrate from WordPress to Drupal, for a number of reasons. One of those reasons was that my WordPress has, over time, become gunked up with errors about write access that I kind of understand but have been unable to resolve. Particularly, the awesome automatic updating of WordPress and its plugins had ceased to work, and every update had to be applied manually, which was never going to happen. I was hoping starting from scratch with Drupal would let me keep everything running smoothly.

However in trying to fix a similar issue with my new Drupal install, I can across a post detailing a solution for How to Get WordPress Working Under PHP safe_mode on NearlyFreeSpeech.net, and believe it or not it works. Thank you, Sarah Pin! It’s a long process written out, but really just SSH and 4 shell commands to change the group of everything to web rather than my account. This allows WordPress scripts to write to the server, and hence allows automatic updates. The name of the site, “I Am Completely Serious“, inspired some confidence that I might just be able to fix this mess, and I’m so happy with the results that I’m definitely reconsidering the value of switching to Drupal.

Now the main drawcard of Drupal is the integrated forum module which, while not as full-featured as say phpBB, is plenty good enough for me to offer simple support, and integrates natively with the Drupal user database. In addition, I like the way Drupal is engineered; it’s a programmer’s CMS. Everything is extremely decoupled and customisable, and although that may not add much to the site itself, I suspect it would be more extensible in the future. WordPress is positively rigid in comparison. Finally, I’d just like to learn Drupal for future use, so what better place to start.

One last thing, you’ll notice the theme of Piemaster.net has changed as well. I was so eager to update everything that I didn’t really consider the consequences. The Mystique theme I was using had been customised a bit, and it turns out that since my last update a while back a bunch of features were removed and moved to “Mystique 3+”, leaving the site a bit of a mess. Reverting to the WordPress default theme Twenty Eleven is quite serviceable for now, however.

So in conclusion, I’m actually pretty happy with WordPress for the minute now that it’s all smooth sailing again. Migrating to Drupal is possible (I’ve more or less done it locally), but inevitably hits a few snags. The menus need to be reconstructed, the themes aren’t very pretty, users will need to re-register (not that there really is any atm), etc. I will get around to it, but maybe not just yet.