Angel \”Java\” Lopez on Blog

February 25, 2012

AjRools (1) Rule Engine in C#

Filed under: .NET, AjRools, Open Source Projects, Rule Engine — ajlopez @ 6:50 pm

Since last year, I was conducting a bit of research about rule engines, specially in Java:

http://delicious.com/ajlopez/ruleengine

I reviewed JBoss Drools Expert (see http://delicious.com/ajlopez/drools). Past December, I assisted to Buenos Aires JBoss Meetup (see Spanish post)

In the old eighties, I met Rete Algorithm (see The Rete Matching Algorithm, Dr.Dobb’s). After all that, I decide to implement my own rule engine, in C#. You can check my progress at:

https://github.com/ajlopez/AjRools

This is the current solution:

As usual, it was coded using TDD.

I have facts, that are asserted, like Temperature = 38. And rules, that based on the asserted facts, produce other asserted facts (I plan to add actions, too, beyond fact assertions). A rule example:

# Rules example
rules
# Rule for Child Fever
rule
	when
		Temperature > 38
		Age <= 12
	then
		HasFever is true
end
# Rule for Adult Fever
rule
	when
		Temperature > 37
		Age > 12
	then
		HasFever is true
end
end

I have ideas to extend the rule engine to support objects with properties, not only variables:

rule
when
	p is_a Patient
	p.Temperature is 39
then
	p.HasFever is true
end

but this feature is still in progress. I didn't adopt the Rete algorithm, yet, or something similar. I want to have a running implementation, with tests. Then, changing internal algorithm is like an exercise on refactoring.

Pending work: more object+properties support, session (client use of the internal implementation), etc.

Keep tuned!

Angel “Java” Lopez

http://www.ajlopez.com

http://twitter.com/ajlopez

February 19, 2012

Scala: Links, News and Resources (1)

Filed under: .NET, Functional Programming, Java, Links, Programming Languages, Scala — ajlopez @ 7:43 pm

Next Post

These are my first Scala programming language links.

http://en.wikipedia.org/wiki/Scala_%28programming_language%29

Scala (play /ˈskɑːlə/ skah-lə) is a multi-paradigm programming language designed to integrate features of object-oriented programming and functional programming.[3] The name Scala is aportmanteau of “scalable” and “language”, signifying that it is designed to grow with the demands of its users. James Strachan, the creator of Groovy, described Scala as a possible successor to Java.[4]

The design of Scala started in 2001 at the École Polytechnique Fédérale de Lausanne (EPFL) by Martin Odersky, following on from work on Funnel, a programming language combining ideas from functional programming and Petri nets.[5][not in citation given] Odersky had previously worked on Generic Java and javac, Sun’s Java compiler.[5]

Scala was released late 2003 / early 2004 on the Java platform, and on the .NET platform in June 2004.[3][5][6] A second version of the language, v2.0, was released in March 2006.[3]

On 17 January 2011 the Scala team won a 5 year research grant of over €2.3 million from the European Research Council.[7] On 12 May 2011, Odersky and collaborators launched Typesafe, a company to provide commercial support, training, and services for Scala. Typesafe received $3 million investment from Greylock Partners.[8][9][10][11]

Scala comes to .Net | The Scala Programming Language
http://www.scala-lang.org/node/10299

Scala In 5 Years – My Prediction « GridGain – High Performance Cloud Computing
http://gridgaintech.wordpress.com/2011/06/28/scala-in-5-years-my-prediction/

Why Java Folks Should Look Forward to Scala | Javalobby
http://java.dzone.com/articles/why-java-folks-should-look

Scala eXchange opening
http://www.slideshare.net/Odersky/scala-exchange-opening

Ruminations of a Programmer: Composing Heterogeneous DSLs in Scala
http://debasishg.blogspot.com/2011/06/composing-heterogeneous-dsls-in-scala.html

Scala Labs – Home
http://scala-labs.github.com/

Spark Cluster Computing Framework
http://www.spark-project.org/
Spark is an open source cluster computing system that aims to make data analytics fast — both fast to run and fast to write.

Along Came Betty » Clojure and Akka: A match made in …
http://blog.darevay.com/2011/06/clojure-and-akka-a-match-made-in/?utm_source=twitterfeed&utm_medium=twitter

Scala: The Static Language that Feels Dynamic
http://www.artima.com/weblogs/viewpost.jsp?thread=328540

Compiling Scala to LLVM
https://days2011.scala-lang.org/sites/days2011/files/ws3-2-scalallvm.pdf

Why Java folks should look forward to Scala | /var/log/mind
http://blog.dhananjaynene.com/2011/05/why-java-folks-should-look-forward-to-scala/

Functional Languages will Rule (but not this year) – Good Stuff
http://goodstuff.im/functional-languages-will-rule-but-not-this-y

Scala: A Better Java for Android
http://robots.thoughtbot.com/post/5836463058/scala-a-better-java-for-android

Ruminations of a Programmer: Combinators as the sublanguage of DSL syntax
http://debasishg.blogspot.com/2011/05/combinators-as-sublanguage-of-dsl.html

Typesafe
http://typesafe.com/
Typesafe makes it easy to build web-scale software based on the open source Scala programming language and Akka middleware. From multicore to cloud computing, it’s purpose built for scale.

The Pragmatic Bookshelf | Programming Concurrency on the JVM
http://pragprog.com/titles/vspcon/programming-concurrency-on-the-jvm

InfoQ: Actor Thinking
http://www.infoq.com/presentations/Actor-Thinking

Clojure or Scala for bioinformatics/biostatistics/medical research – Stack Overflow
http://stackoverflow.com/questions/5250459/clojure-or-scala-for-bioinformatics-biostatistics-medical-research

InfoQ: Guardian.co.uk Switching from Java to Scala
http://www.infoq.com/articles/guardian_scala

Asynchronous Event Sourcing using Actors
http://jonasboner.com/2009/02/12/event-sourcing-using-actors.html

Functional Scala: Expressions, Extensions and Extractors « brain driven development
http://gleichmann.wordpress.com/2011/03/13/functional-scala-expressions-extensions-and-extractors/

iWork.com – JVM Languages
http://public.iwork.com/document/?d=JVM_Languages.key&a=p1045023190

Scala Team Wins ERC Grant | The Scala Programming Language
http://www.scala-lang.org/node/8579

Ruminations of a Programmer: Monads – Another way to abstract computations in Scala
http://debasishg.blogspot.com/2008/03/monads-another-way-to-abstract.html

Monads Are Not Metaphors – Code Commit
http://www.codecommit.com/blog/ruby/monads-are-not-metaphors

Algorithmically challenged: Sieve of Eratosthenes (the real one) Scala One-Liner
http://dcsobral.blogspot.com/2010/12/sieve-of-eratosthenes-real-one-scala.html

Code Monkeyism: Singletons without Singletons: Scala Type Classes
http://codemonkeyism.com/singletons-singletons-scala-type-classes/?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+stephansblog+%28Code+Monkeyism+%7C+Stephans+Blog%29

Erik Engbrecht’s Blog: Higher-Level versus Higher-Order Abstraction
http://erikengbrecht.blogspot.com/2010/07/higher-level-versus-higher-order.html

Ruminations of a Programmer: Scala – To DI or not to DI
http://debasishg.blogspot.com/2008/02/scala-to-di-or-not-to-di.html

Real-World Scala: Introduction
http://jonasboner.com/2008/10/01/real-world-scala-introduction.html

Tom Morris’ wiki » Scala for Hackers
http://tommorris.org/wiki/Scala_for_Hackers

Scala Style Guide
http://davetron5000.github.com/scala-style/

Monads in Scala
http://lamp.epfl.ch/~emir/bqbase/2005/01/20/monad.html

Building Distributed Systems in Scala
http://www.slideshare.net/al3x/building-distributed-systems-in-scala

James Carr » Blog Archive » Learning Scala: Factorials and foldRight
http://blog.james-carr.org/2010/05/31/learning-scala-factorials-and-foldright/

Scala Beauty – Fun with Logic « Thinkmeta
http://thinkmeta.wordpress.com/2010/03/25/scala-beauty-fun-with-logic/

Beyond Mere Actors
http://docs.google.com/present/view?id=ddmk3f43_63zpg3jcgz&ncl=true

My Links
http://www.delicious.com/ajlopez/scala
http://www.delicious.com/ajlopez/scala+tutorial
http://www.delicious.com/ajlopez/scala+presentation
http://www.delicious.com/ajlopez/scala+video

More Scala links are coming.

Keep tuned!

Angel “Java” Lopez
http://www.ajlopez.com
http://twitter.com/ajlopez

February 13, 2012

Azure: Links, News and Resources (3)

Filed under: .NET, Azure, Cloud Computing, Links — ajlopez @ 1:54 pm

Previous Post

More links I collected during my work and research.

Cyan – Simpler than Azure
http://cyannet.codeplex.com/
Cyan is a .NET dynamic client for the Azure Table Storage REST API.

Azure Table Storage & Dynamic TableServiceEntity
http://stackoverflow.com/questions/7522235/azure-table-storage-dynamic-tableserviceentity

richorama / AzureSugar
https://github.com/richorama/AzureSugar
Syntactic sugar to make Azure development a little sweeter
Support is also available for using dynamic types (or dictionaries) to insert and query table storage.

Azure Table Storage with dynamic entities objects
http://ruiromanoblog.wordpress.com/2009/05/15/azure-table-storage-with-dynamic-entities-objects/

WindowsAzure / azure-sdk-for-node
https://github.com/WindowsAzure/azure-sdk-for-node/tree/dev/examples/myevents

Accessing Azure Role Environment information from NodeJS
http://nodeblog.cloudapp.net/accessing-azure-role-environment-information-from-node

Windows Azure Startup task to run npm install to avoid deploying node modules
http://nodeblog.cloudapp.net/startup-task-to-run-npm-in-azure

Leveraging Node.js’ libuv in Windows Azure
http://msdn.microsoft.com/en-us/library/hh527737(v=VS.103).aspx

Getting the samples to work on the Azure Node.js SDK
http://coderead.wordpress.com/2012/01/03/getting-the-samples-to-work-on-the-azure-node-js-sdk/

Microsoft will add Linux virtual machines to Windows Azure
http://arstechnica.com/business/news/2012/01/microsoft-will-add-linux-virtual-machines-to-windows-azure.ars

Create Hosted Service using Windows Azure Management API
http://debugmode.net/2012/01/02/create-hosted-service-using-windows-azure-management-api/

Microsoft Windows Azure PaaS Gets Node.js Update
http://www.talkincloud.com/microsoft-windows-azure-paas-gets-node-js-update/

How to deploy WordPress using the Windows Azure SDK for PHP WordPress scaffold
http://azurephp.interoperabilitybridges.com/articles/how-to-deploy-wordpress-using-the-windows-azure-sdk-for-php-wordpress-scaffold

Advertising Company Adopts Cloud Computing, Gets 400 Percent Improvement
http://www.microsoft.com/casestudies/Case_Study_Detail.aspx?CaseStudyID=4000008145

Kobojo
Game Developer Meets Demand and Prepares for Success with Scalable Cloud Solution
http://www.microsoft.com/casestudies/Case_Study_Detail.aspx?CaseStudyID=4000008216

What is Windows Azure?
http://www.youtube.com/watch?feature=player_embedded&v=poDRw_Xi3Aw

Azure On GitHub
https://github.com/blog/1010-azure-on-github

Azure: Running Multiple Web Sites in a Single WebRole
http://blog.elastacloud.com/2011/01/11/azure-running-multiple-web-sites-in-a-single-webrole/

Deploying independent web applications to Windows Azure using single web role
http://weblogs.asp.net/gunnarpeipman/archive/2011/12/29/deploying-independent-web-applications-to-windows-azure-using-single-web-role.aspx

Modificar el tiempo de vida del token proporcionado por Windows Azure AppFabric Access Control
http://www.returngis.net/2011/12/modificar-el-tiempo-de-vida-del-token-proporcionado-por-windows-azure-appfabric-access-control/

Windows Azure Multi Application
http://azuremultiapp.codeplex.com/
Windows Azure Multi Application is a complete sample solution that allow deploy dinamically aplications to existing role instance.
After deploy admin tool new application can be deployed, without modify initial azure deployment. Each application can be deployed independently and can be of different types; ASP.NET WebForms, ASP.NET MVC, Windows Service, Console Application…

How to combine a Worker Role and an MVC4 Web Role into a single Azure instance
http://blog.liamcavanagh.com/2011/12/how-to-combine-a-worker-role-with-a-mvc4-web-role-into-a-single-instance/

Hadoop Streaming and F# MapReduce
http://blogs.msdn.com/b/carlnol/archive/2011/12/16/hadoop-streaming-and-f-mapreduce.aspx

Windows Azure Architecture Guide – Part 2 – Code Samples
http://www.microsoft.com/download/en/details.aspx?id=27878

Windows Azure + a pinch of UK
http://paper.li/ericnel/1314797915

Using Amazon and Azure Cloud Services in your Delphi XE2 and C++Builder XE2 Applications
http://www.youtube.com/watch?v=BRFbiRcLtkc&feature=player_embedded

What’s new in Windows Azure
http://www.infoworld.com/d/microsoft-windows/whats-new-in-windows-azure-181578

Microsoft Azure gets an open source rival
http://www.infoworld.com/d/open-source-software/microsoft-azure-gets-open-source-rival-181845

Introduction to the Hadoop on Azure Interactive JavaScript Console
http://www.youtube.com/watch?v=alPMYcomUEs

Node.JS in Windows Azure
http://channel9.msdn.com/Events/windowsazure/learn/Node-JS-in-Windows-Azure

Azure price cuts, bigger databases, now with node.js and MongoDB support, Hadoop on its way
http://arstechnica.com/microsoft/news/2011/12/azure-price-cuts-bigger-databases-now-with-nodejs-and-mongodb-support-hadoop-on-its-way.ars?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed:+arstechnica/index+(Ars+Technica+-+Featured+Content)

Improved Developer Experience, Interoperability, and Scalability on Windows Azure
http://blogs.msdn.com/b/windowsazure/archive/2011/12/12/improved-developer-experience-interoperability-and-scalability-on-windows-azure.aspx

Azure Node.js Developer Center
https://www.windowsazure.com/en-us/develop/nodejs/

Deploying Node.js Applications to Windows Azure via Blobs or Git Sync
http://blog.smarx.com/posts/deploying-node-js-applications-to-windows-azure-via-blobs-or-git-sync

Ten Basic Troubleshooting Tips for Windows Azure
http://www.davidaiken.com/2011/11/15/ten-basic-troubleshooting-tips-for-windows-azure/

Now Available! Updated Windows Azure SDK & Windows Azure HPC Scheduler SDK
http://blogs.msdn.com/b/windowsazure/archive/2011/11/14/updated-windows-azure-sdk-amp-windows-azure-hpc-scheduler-sdk.aspx

My Links
http://delicious.com/ajlopez/azure

January 7, 2012

Social Games Programming (Part 7) Game Moves Processing

Filed under: .NET, Azure, Game Development, JavaScript — ajlopez @ 5:24 pm

Previous Post
Next Post

In this post, I want to discuss the game play processing in Tic Tac Toe. It involves many pieces, from Razor view using Javascript to Web Role, to Azure Blob Storage.

These are the javascript files referenced in Tic Tac Toe view (at SocialGame.Web/Areas/Samples/Views/TicTacToe/Index.cshtml):

<script src="@Url.AreaContent("Scripts/jQuery.tmpl.js")" type="text/javascript"></script>
<script src="@Url.AreaContent("Scripts/knockout-1.2.1.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/game/ServerInterface.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/game/GameService.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/game/UserService.js")" type="text/javascript"></script>
<script src="@Url.AreaContent("Scripts/game/TicTacToeBoard.js")" type="text/javascript"></script>
<script src="@Url.AreaContent("Scripts/game/TicTacToeGame.js")" type="text/javascript"></script>
<script src="@Url.AreaContent("Scripts/game/TicTacToeViewModel.js")" type="text/javascript"></script>
<script src="@Url.AreaContent("Scripts/game/TicTacToeController.js")" type="text/javascript"></script>

As I wrote in the previous post, ServerInterface, GameService and UserService are game-agnostic components. They could be used in any game. For each new kind of game X, you must implement XBoard, XGame logic, XViewModel and an appropiate XController.

At the end of that view, there is the creation of the game-agnostic services:

var apiURL = "@this.ViewBag.ApiUrl";
var blobURL = "@this.ViewBag.BlobUrl";
var si = new ServerInterface();
var gs = new GameService(apiURL, blobURL, si);
var user = new UserService(apiURL, blobURL, si);

The @this.ViewBag properties are filled in the ASP.NET MVC controller (see BaseController.cs)

The creation of the game controller:

// check for canvas, show an "Upgrade your browser" screen if they don't have it.
var canvas = document.getElementById('board');
if (canvas.getContext == null || canvas.getContext('2d') == null) {
    $("#game").toggle();
    $("#notSupported").toggle();
    return;
}
var board = new TicTacToeBoard(canvas);
var game = new TicTacToeGame();
var controller = new TicTacToeController(viewModel, gs, board, game);
controller.setGameQueueId(gameQueueId);
controller.start();

But the interesting part is in the controller constructor:

function TicTacToeController(viewModel, gameService, board, game) {
    this.viewModel = viewModel;
    this.gameService = gameService;
    this.board = board;
    this.game = game;
    this.started = false;
    var controller = this;
    this.board.onMove = function (x, y) { controller.onMove(x, y); };
};

Notice the this.board.onMove: the controller register itself to process new moves detected by the board component. At its start method, the controller register itself to process game service updates:

controller.gameService.process(
        gameQueueId,
        function (queue) { controller.processGameQueue(queue); },
        function (action) { controller.processAction(action); }
        );

Let’s examine the processing of game moves.

1 – The board component detects a click, then it sends a new move to controller (using the onMove callbalk)

2 – The controller sends the new move to game logic, to update state (I omitted the view model in this sequence/graph)

3 – The controller sends the new move to game service.

4 – The game services sends a new command to web role, using the server interface

5 – The Web Role API receives the new command

6 – The command info is appended to the game status blob, at Azure storage

Now, the other client processing:

1 – The game service, using a timer, polls the game status, calling the service interface

2 – The service interface, using JSONP, retrieves the current game status from Azure Blob storage

3 – If a new move is detected, the game service calls a callback function provided by the controller (game service has no reference to controller).

4 – The controller sends the new move to game logic, updating state (I omitted the view state here)

5 – The controller sends the new move to board component, to update the canvas

A key point: the controller knows NOTHING about the service interface, WCF Web API, blob storage. So, you can change the game service to route and detect new moves in other ways. Next post: modify game service to use a Node.js server for game move processing.

Keep tuned!

Angel “Java” Lopez

http://www.ajlopez.com

http://twitter.com/ajlopez

December 19, 2011

Social Games Programming (Part 6) Testing Game and Service with TDD and QUnit

Filed under: .NET, Azure, Game Development, QUnit, Test-Driven Development — ajlopez @ 8:44 am

Previous Post
Next Post

In my previous post, I presented the new version of Windows Azure Toolkit for Social Games. It has simple games to demonstrate the use of Javascript, HTML 5 canvas, game moves processing, Azure worker roles and web roles. Let’s explore in this post the making of client game logic, in Javascript, using TDD and QUnit.

There are online tests at:

http://watgames4.cloudapp.net/Test

Let’s run the Tic Tac Toe Game Logic tests:

http://watgames4.cloudapp.net/Samples/ClientTest/TicTacToeGameTest

This page is using QUnit for client Javascript unit testing. I wrote about that library at:

TDD with Javascript and QUnit

The above page is testing the Tic Tac Toe logic. Remember, each game is implemented in parts, the logic is one of them:

The client code resides in TicTacToeGame.js inside the SocialGames.Web project. Their first lines:

TTTColor = { Empty: 0, Cross: 1, Circle: 2 };
function TicTacToeGame() {
    this.board = [
     [TTTColor.Empty, TTTColor.Empty, TTTColor.Empty],
     [TTTColor.Empty, TTTColor.Empty, TTTColor.Empty],
     [TTTColor.Empty, TTTColor.Empty, TTTColor.Empty]
     ];
}
TicTacToeGame.prototype.move = function (x, y, color) {
    this.board[x][y] = color;
};
TicTacToeGame.prototype.isEmpty = function (x, y) {
    return this.board[x][y] == TTTColor.Empty;
};
....

The client test page (TicTacToeGameTest.cshtml) was built at the same time, using a TDD (Test-Driven Development) approach. Look at first tests:

test("Create Empty Board", function () {
    var game = new TicTacToeGame();
    for (var x = 0; x < 3; x++)
        for (var y = 0; y < 3; y++)
            ok(game.isEmpty(x, y));
    equal(game.isTie(), false);
    equal(game.hasWinner(), false);
});
test("Valid Moves on Empty Board", function () {
    var game = new TicTacToeGame();
    for (var x = 0; x < 3; x++)
        for (var y = 0; y < 3; y++) {
            ok(game.isValid(x, y, TTTColor.Cross));
            ok(game.isValid(x, y, TTTColor.Circle));
        }
});
test("No Winner in Empty Board", function () {
    var game = new TicTacToeGame();
    equal(game.getWinner(), TTTColor.Empty);
});
test("Get Winner in First Row", function () {
    var game = new TicTacToeGame();
    game.move(0, 0, TTTColor.Cross);
    game.move(1, 0, TTTColor.Cross);
    game.move(2, 0, TTTColor.Cross);
    equal(game.getWinner(), TTTColor.Cross);
    equal(game.isTie(), false);
    equal(game.hasWinner(), true);
});

The idea is to take baby steps, one test at a time, designing the game logic “API”, its expected behavior. In this way, you expend less time debugging in a dynamic language like Javascript, and you gain a test suite that can save your day in case of major refactoring. Look at the Four In A Row logic and client tests: you will find a similar approach.

Ok, not all can be easily tested, or build using TDD. Some of the game-agnostic services are using Ajax and Blob Storage, and to test them you must consider asynchronous Ajax calls. You can check:

http://watgames4.cloudapp.net/Test/ServerInterfaceTest

(You must be logged in using your Facebook or Windows Live ID, an example of use of Federated Security and Access Control Service (ACS))

This time, the system under test is the game-agnostic Server Interface:

There are some tricks in the test code (ServerInterfaceTest.cshmlt), an excerpt:

test("Call User/Verify", function () {
    var success = function (result) { ok(true); start(); };
    var error = ajaxGetError;
    stop(10000);
    expect(1);
    si.sendAjaxGet(apiURL + "user/verify", success);
});

expect is a QUnit function that prepare the framework to receive 1 ok(true) sometime during the test run. That confirmation is included in callback function success that it will be called after the successful processing of the asynchronous call .sendAjaxGet. Async life is not easy ;-)

More code analysis is coming. And some adapt to use Node.js as game server.

Keep tuned!

Angel “Java” Lopez

http://www.ajlopez.com

http://twitter.com/ajlopez

December 14, 2011

AjCoRe, A Simple Content Repository (2) Stores

Filed under: .NET, AjCoRe, Content Repository, Open Source Projects — ajlopez @ 10:04 am

Previous Post

I did some advances in my open source project AjCoRe, simple implementation of a content repository written in C#:

https://github.com/ajlopez/AjCoRe

If Content Repository is a new concept to you, check my links http://delicious.com/ajlopez/contentrepository and Roy Fielding’s JSR-170 overview .

Key concepts: there are Workspaces. Each workspace has a Root Node. Each Node can have Child Nodes, and Properties. A Property has a Name and a Value:

In the above diagram, nodes and workspaces are represented by interfaces. The idea is to have different implementations of that abstractions. In my previous post, I presented two such implementations: one representing a file system, allowing only read only operations. And another implementation, a more extensible one, using arbitrary nodes in memory. Since then, I added the support of saving and retrieving those arbitrary nodes using a store.

Now, the project looks:

where:

A: It is the concrete base implementation of workspace and nodes, based in memory, with the new support of having an optional store

B: The read-only implementation of workspace and nodes, representing an existing filesystem/directory

C: The new IStore (abstract) and the first concrete implementation, using a directory hierarchy and XML files to persists nodes in a workspace

D: The transaction support, during the lifetime of a session

Let’s see the new store capabilities. The Stores.IStore interface:

public interface IStore
{
    IEnumerable<string> GetChildNames(string path);
    PropertyList LoadProperties(string path);
    void SaveProperties(string path, PropertyList properties);
    void RemoveNode(string path);
}

Stores.Xml.Store is the first concrete implementation. Anyone could write another ones, using JSON, a relational database or a NoSQL backend. You can create, remove nodes, updated their properties, using a session, in the same way as in the previous post. BUT NOW, the workspace can be created injecting an IStore implementation in its constructor. Example (more details in the tests):

// Reference store in a directory
Store store = new Store("c:\\myworkspace");
// Workspace using that store to retrieve root node and their descendant
// (lazy loading)
Workspace workspace = new Workspace(store, "myws");
// Session accesing that workspace
Session session = new Session(workspace);
// You can use session to get the root node
// in case you have no direct workspace reference
INode root = session.Workspace.RootNode;
// Updates are made into a transaction
using (var tr = session.OpenTransaction())
{
    // Accessing a node
    INode node = root.ChildNodes["father"];
    // Changing a property
    session.SetPropertyValue(node, "Name", "Adam");
    
    // Creating a nodes    
    INode newnode = session.CreateNode(node, "newson", new Property[] {
                        new Property("Name", "Abel")
                    });
    
    // Removing a node
    session.RemoveNode(newson);
    tr.Complete();
}

The tr.Complete()  is in charge of updating the XML files where the properties of nodes are saved. An example file:

<?xml version="1.0" encoding="utf-8"?>
<Properties>
  <Name>John</Name>
  <Age type="int">35</Age>
  <Male type="bool">true</Male>
  <Hired type="datetime">2000-01-01T00:00:00</Hired>
  <Height type="double">167.2</Height>
  <Salary type="decimal">120000.5</Salary>
</Properties>

The key code in Transaction.Complete:

var nodestoupdate = 
    this.operations.Where(op => !(op is RemoveNodeOperation)).Select(op => op.Node).Distinct();
var nodestodelete = 
    this.operations.Where(op => op is RemoveNodeOperation).Select(op => op.Node).Distinct();
nodestoupdate = nodestoupdate.Except(nodestodelete);
foreach (var node in nodestoupdate)
    this.store.SaveProperties(node.Path, node.Properties);
foreach (var node in nodestodelete)
    this.store.RemoveNode(node.Path);

I could improve it, taken in account that some IStore implementation could prefer update each property, instead of a full node (I think in a database store).

I want to write another IStore implementation supporting JSON (I should design how to save the original type of each property). Other pending work: retrieve a node from a workspace using its full path, or query nodes (using XPath? Hmmm… I'm still in doubt).

Keep tuned!

Angel “Java” Lopez

http://www.ajlopez.com

http://twitter.com/ajlopez

December 6, 2011

AjCoRe, a simple Content Repository (1) First Steps

Next Post

Some years ago, I discovered Apache Jackrabbit, open source project that implements JSR170 (see first my links (2008) at http://delicious.com/ajlopez/jsr170), but I didn’t pay attention to them. Past week, in an private email list, the content repository topic raised again, so I read some links:

http://en.wikipedia.org/wiki/Content_repository
http://en.wikipedia.org/wiki/Content_repository_API_for_Java
http://www.jcp.org/en/jsr/detail?id=170
http://jcp.org/en/jsr/detail?id=283

More links at

http://delicious.com/ajlopez/contentrepository

The first paper I read was Roy Fielding’s overview:

http://www.day.com/content/dam/day/whitepapers/JSR_170_White_Paper.pdf

The second one (more detailed, it is an specification) was the JSR283 spec:

http://download.oracle.com/otndocs/jcp/content_repository-2.0-pfd-oth-JSpec/

After quick reading both papers, I started to think how to implement it (using .NET; there is an open source implementation, SenseNet). I didn’t see the code or the API described in the JSRs. I want to have a clear, simple idea of what is essential, the core concepts to implements. Then, last weekend, I did a code kata: my first steps in AjCoRe, simple Content Repository:

https://github.com/ajlopez/AjCoRe

using TDD to pratice, as usual (you can see the Git log to view the evolution of my ideas and tests).

The key points are:

- There are Workspaces identified by name
- Any Workspace has a Root Node
- Any Node has properties
- A Property has a name and a value (a simple one, like String, DateTime, int, not a complex object)
- A Node can have a Child Nodes (an enumeration that can be empty)

Initially, in my first code and tests, I could create a Node directly using a public constructor. But in the current state, I prefer to use a controlled entry point for main operations, a Session. The client code/user should create a Session that manage a Workspace.

Now, I have TWO implementations of Workspace and Nodes (after a refactor step, I have INode and IWorkspace interface, and concrete implementations of them). As a proof of concept (mentioned in Fielding’s paper), I want to have a directory in a FileSystem, represented by read-only nodes, with FileNode, and DirectoryNode. Some tests:

[TestMethod]
[DeploymentItem("Files/FileSystem", "fs")]
public void RootNodeProperties()
{
    Workspace workspace = new Workspace("fs", "fs");
    INode root = workspace.RootNode;
    DirectoryInfo info = new DirectoryInfo("fs");
    Assert.AreEqual(info.Extension, root.Properties["Extension"].Value);
    Assert.AreEqual(info.FullName, root.Properties["FullName"].Value);
    Assert.AreEqual(info.Name, root.Properties["Name"].Value);
    Assert.AreEqual(info.CreationTime, root.Properties["CreationTime"].Value);
    Assert.AreEqual(info.CreationTimeUtc, root.Properties["CreationTimeUtc"].Value);
    Assert.AreEqual(info.LastAccessTime, root.Properties["LastAccessTime"].Value);
    Assert.AreEqual(info.LastAccessTimeUtc, root.Properties["LastAccessTimeUtc"].Value);
    Assert.AreEqual(info.LastWriteTime, root.Properties["LastWriteTime"].Value);
    Assert.AreEqual(info.LastWriteTimeUtc, root.Properties["LastWriteTimeUtc"].Value);
    Assert.AreEqual("fs", workspace.Name);
    Assert.IsNotNull(workspace.RootNode);
    Assert.AreEqual(string.Empty, workspace.RootNode.Name);
    Assert.IsNull(workspace.RootNode.Parent);
}
[TestMethod]
[DeploymentItem("Files/FileSystem", "fs")]
public void GetFilesFromRoot()
{
    Workspace workspace = new Workspace("fs", "fs");
    INode root = workspace.RootNode;
    Assert.IsNotNull(root.ChildNodes["TextFile1.txt"]);
    Assert.IsNotNull(root.ChildNodes["TextFile1.txt"]);
}
[TestMethod]
[DeploymentItem("Files/FileSystem", "fs")]
public void GetFileProperties()
{
    Workspace workspace = new Workspace("fs", "fs");
    INode root = workspace.RootNode;
    INode file = root.ChildNodes["TextFile1.txt"];
    FileInfo info = new FileInfo("fs/TextFile1.txt");
    Assert.AreEqual(info.Extension, file.Properties["Extension"].Value);
    Assert.AreEqual(info.FullName, file.Properties["FullName"].Value);
    Assert.AreEqual(info.Name, file.Properties["Name"].Value);
    Assert.AreEqual(info.CreationTime, file.Properties["CreationTime"].Value);
    Assert.AreEqual(info.CreationTimeUtc, file.Properties["CreationTimeUtc"].Value);
    Assert.AreEqual(info.LastAccessTime, file.Properties["LastAccessTime"].Value);
    Assert.AreEqual(info.LastAccessTimeUtc, file.Properties["LastAccessTimeUtc"].Value);
    Assert.AreEqual(info.LastWriteTime, file.Properties["LastWriteTime"].Value);
    Assert.AreEqual(info.LastWriteTimeUtc, file.Properties["LastWriteTimeUtc"].Value);
}
[TestMethod]
[DeploymentItem("Files/FileSystem", "fs")]
public void GetDirectoriesFromRoot()
{
    Workspace workspace = new Workspace("fs", "fs");
    INode root = workspace.RootNode;
    Assert.IsNotNull(root.ChildNodes["Subfolder1"]);
    Assert.IsNotNull(root.ChildNodes["Subfolder2"]);
}

Some notes:

- Workspace is AjCoRe.FileSystem.Workspace class in the above code.

- It’s constructor takes two arguments: the name of the workspace in the content repository, and the directory name (maybe relative) that it represents.

- The INode objects are instance of concrete class FileNode or DirectoryNode.

- The properties of file and directory nodes reflect the simple values you find in FileInfo and DirectoryInfo System.IO .NET objects)

- DirectoryNode ChildNodes property is a dynamic one: it is built in EACH invocation (I could have adopted a lazy approach, but in this way, the node collection reflects the CURRENT state of the file system):

public NodeList ChildNodes
{
    get
    {
	NodeList nodes = new NodeList();
	foreach (var di in this.info.GetDirectories())
	    nodes.AddNode(new DirectoryNode(this, di.Name, di));
	foreach (var fi in this.info.GetFiles())
 	    nodes.AddNode(new FileNode(this, fi.Name, fi));
	return nodes;
    }
}

It’s time to present the two main abstractioncs, INode:

public interface INode
{
    string Name { get; }
    INode Parent { get; }
    PropertyList Properties { get; }
    NodeList ChildNodes { get; }
    string Path { get; }
}

and IWorkspace:

public interface IWorkspace
{
    string Name { get; }
    INode RootNode { get; }
}

Notice that I didn’t need have a unique Identifier for a node in workspace. Every Node has a path (the concatenated names of their parents, using / as separator). I should implement the retrieve of a particular node using its path. I didn’t need a NodeType, yet. I’m following the YAGNI principle ;-)

The other IWorkspace/INode concrete implementation manage node and properties in memory. The nodes can be created and removed by code, and the property values can be changed. It’s my main implementation that I want to extend. The key piece to add: an IStore that can retrieve and save modified nodes to persistence store (many implementations: database, NoSql, Azure blob storage, Json files (representing node properties) in file system (representing the node hierarchy), cloud file system, Azure tables, etc…).

The creation of AjCoRe.Base.Workspace:

Workspace workspace = new Workspace("ws1", null);

The second parameter is the list of properties to put in the new Root Node of the new in memory workspace.

Then, you can get a session to it:

Session session = new Session(workspace);

You can navigate the node hierarchy as in the previous example, using workspace.RootNode and the ChildNodes enumeration. BUT, to modify then, you SHOULD use a transaction:

INode node = session.Workspace.RootNode;
using (var tr = session.OpenTransaction())
{
    session.SetPropertyValue(node, "Name", "Adam");
    session.SetPropertyValue(node, "Age", 800);

    tr.Complete();
}

You MUST commit the transaction explicity with tr.Complete(). If you missed it, the changed properties are restored to their previous values. Creation, removing of nodes and properties are also tracked during a transaction. You can create a new node with their initial properties:

INode root = session.Workspace.RootNode;
using (var tr = session.OpenTransaction())
{
    INode node = session.CreateNode(root, "person1", new List<Property>()
    {
        new Property("Name", "Adam"),
        new Property("Age", 800)
    });

    tr.Complete();
}

Or you can add, change, remove (setting its value to null) properties in a transaction:

INode root = session.Workspace.RootNode;
using (var tr = session.OpenTransaction())
{
    session.SetPropertyValue(root, "Name", "Adam");
    session.SetPropertyValue(root, "Age", 800);
    tr.Complete();
}

Then, using the session as entry point for modifications, I could track the changes in a Unit of Work, without using observers over properties in nodes (if I adopted that approach, probably I should manage to have observers for every node that the client code could traverse in the workspace). I have plans to implements something like Software Transactional Memory to support concurrency (I already have code for that feature in AjTalk and AjSharp).

Next posts: implementation details (transactions, session factories, workspace registries, etc..)

Next steps: implement persistence in a store, concurrent transactions.

Keep tuned!

Angel “Java” Lopez

http://www.ajlopez.com

http://twitter.com/ajlopez

November 30, 2011

Social Online Games Programming (Part 5) New Azure Toolkit

Previous Post
Next Post

Two weeks ago, a new version of Windows Azure Toolkit for Social Games was released. See @ntotten posts:

Windows Azure Toolkit for Social Games Version 1.1.1
Windows Azure Toolkit for Social Games Version 1.1

The new version implements two simple HTML5 games: tic-tac-toe and four-in-a-row, backed up by ASP.NET MVC views, WCF Web API services, ACS federated security, and Azure Storage. You can play them online at:

http://watgames4.cloudapp.net/

I think this is a more clear example than the previous one (Tankster) that was great but a bit overwhelming ;-) . Let’s dive into some implementation details of this new example.

Totten wrote:

The biggest change we have made in this release is to separate the core toolkit from the Tankster game. After we released the Tankster sample game we received a lot of feedback asking for a simpler game that developers could use to learn. To meet this need we developed two simple games, Tic-Tac-Toe and Four in a Row, and included in the toolkit. The Tankster game is now available separately as a sample built on top of the toolkit.

While the new games included in the toolkit are much simpler than Tankster, they still show the same core concepts. You can easily use these samples as a starting point to build out any number of types of games. Additionally, you will find that many of the core components of the game such as the leaderboard services, game command services can be used without any modification to the server side or client side code.

In my previous post, I mentioned a minor but important change in game action processing: any game logic was removed from server code. Adopting this approach, you can write new games without changing the ASP.NET MVC code. You still can add server side code if you want (to have more control over the actions, to avoid player cheating, etc..) but it is interesting to have a base code with game-agnostic code.

Opening the solution in Visual Studio, you will find Javascript files used by the two games. You can write a new game, reusing these files:

The games are implemented as areas:

You could add new games and publish them as NuGet packages.

Visually, the client Javascript code is organized as:

Each game X (TicTacToe, FourInARow, yours) has:

- XGame: the game logic

- XBoard: to draw board on canvas and to detect click events on it

- XViewModel: containing the player and other data to be used at view rendering (the example uses knockout.js, an MVC in Javascript)

- XController: to process new events and to coordinate the above elements

The generic part:

- UserService: methods related to users: login, get friends, etc.

- GameService:  play moves, receives new moves, other actions.

- ServerInterface: Ajax calls (using GET, POST, JSONP, Azure storage…) that are used by the implemention of User and Game Service.

Topics for next posts: analyze the Javascript code, the use of Canvas, Javascript tests using QUnit, communication with server using Ajax, change the Game Service (Javascript) to use a Node.js server.

Keep tuned!

Angel “Java” Lopez
http://www.ajlopez.com
http://twitter.com/ajlopez

November 3, 2011

Clojure: Links, News and Resources (1)

Filed under: .NET, Clojure, Java, Links, Lisp — ajlopez @ 9:03 am

Next Post

Clojure is a bit topic, for me. I didn’t send any geek early links email dedicated to it. To start engines, this is a list of Clojure presentations, videos, discussions at Infoq

http://en.wikipedia.org/wiki/Clojure

Clojure (pronounced like “closure[2]) is a recent dialect of the Lisp programming languagecreated by Rich Hickey. It is a general-purpose language supporting interactive development that encourages a functional programming style, and simplifies multithreadedprogramming.

Clojure runs on the Java Virtual Machine and the Common Language Runtime. Like other Lisps, Clojure treats code as data and has a sophisticated macro system.

Simple Made Easy
http://www.infoq.com/presentations/Simple-Made-Easy
Rich Hickey emphasizes simplicity’s virtues over easiness’, showing that while many choose easiness they may end up with complexity, and the better way is to choose easiness along the simplicity path.

Clojure Web Frameworks Round-Up: Enlive & Compojure
http://www.infoq.com/news/2011/10/clojure-web-frameworks
Clojure is rather new member of the LISP family of languages which runs on the Java platform. Introduced in 2007 it has generated a lot of interest.

Clojure: The Art of Abstraction
http://www.infoq.com/presentations/Clojure-The-Art-of-Abstraction
Alex Miller presents some of the abstractions that make Clojure a great language: Collections, Sequence and Higher Order Functions, Multimethods, Protocols, Atoms, Macros, and others.

Perception and Action: An Introduction to Clojure’s Time Model
http://www.infoq.com/presentations/An-Introduction-to-Clojure-Time-Model
Stuart Halloway discusses how we use a total control time model, proposing a different one that represents the world more accurately helping to solve some of the concurrency and parallelism problems.

Clojure-Java Interop: A Better Java than Java
http://www.infoq.com/presentations/Clojure-Java-Interop
Stuart Dabbs Halloway, after reviewing Clojure’s syntax comparing it with Java, explains how Clojure-Java interoperability works. He then talks about the need for simplicity in languages, attempting to prove that Clojure is a simpler language, and consequently better, than Java.

Writing HTML5 Applications with Google App Engine, Google Closure Library and Clojure
http://www.infoq.com/news/2010/11/html5-gae
Clojure works internally with Key/Value pairs. We can retrieve them to and from the Google Datastore, and we can send them to the client as JSON.

Rich Hickey on Protocols and Clojure 1.3
http://www.infoq.com/interviews/hickey-clojure-protocols
Rich Hickey explains the ideas behind Clojure 1.2′s new polymorphism constructs deftype and protocols. Also: Clojure 1.3 features such as faster arithmetic and future features like Pods.

Book Excerpt and Interview: The Joy of Clojure
http://www.infoq.com/articles/the-joy-of-clojure
The Joy of Clojure by Michael Fogus and Chris Houser is a book that tries to take the reader beyond the language syntax, and show how to write fluent, idiomatic Clojure code. It teaches how to approach programming challenges from a Functional perspective and master the Lisp techniques that make Clojure so elegant and efficient.

Clojure’s Solutions to the Expression Problem
http://www.infoq.com/presentations/Clojure-Expression-Problem
Chris Houser presents the expression problem showing two ways to solve it in some languages, followed by a demonstration of solving it using multimethods and protocols in Clojure, mentioning pros and cons of each solving method.

Functional Languages 101: What’s All the Fuss About?
http://www.infoq.com/presentations/Functional-Languages-101
Rebecca Parsons makes an basic introduction to functional languages, explaining how to think in a functional language, why is there renewed interested in them, and some nifty things about these languages.

Exploring LISP on the JVM
http://www.infoq.com/articles/lisp-for-jvm
One of the most exciting things in the Java world right now is the work being done to get other programming languages to run on the virtual machine. There is a lot of buzz around JRuby, Groovy, Scala, and the JavaScript engine Rhino. But why stop there? If you really want to take a step outside the mainstream and dive into something completely different from Java, Lisp is a great option. And there are several open-source implementations of the Lisp programming language for the JVM out there, ready to be explored.

Clojure in the Field
http://www.infoq.com/presentations/Clojure-in-the-Field
Stuart Halloway presents what makes Clojure different and, in his opinion, better than Java, plus some real-life lessons on Clojure development including BDD for functional code, wrapping Java APIs, third part libraries worth knowing, writing code without an objectual context, and the learning curve for a team new to the language.

An In-Depth Look at Clojure Collections
http://www.infoq.com/articles/in-depth-look-clojure-collections
If you’re familiar with the Clojure programming language, then you might know that at its heart lays a powerful set of immutable, persistent, collection types.In this article we will talk a bit about the underpinnings of these collection types including a deep dive into a couple of them; namely its vectors and maps. Finally, we’ll wrap up by presenting an example of how viewing a problem through the lens of the Clojure way we can vastly simply our design.

Stuart Halloway on Clojure and Functional Programming
http://www.infoq.com/interviews/stuart_holloway_clojure
Relevance, Inc. co-founder Stuart Halloway discusses Clojure and functional programing on the JVM in depth, and touches on the uses of a number of other modern JVM languages including JRuby, Groovy, Scala and Haskell. He also makes a case for structural edit modes in IDEs, and shares some of his favorite IT books.

Dean Wampler on Programming Languages
http://www.infoq.com/interviews/wampler-programming-language
This interview begins with a discussion of functional programming, the use of Scala by programmers trained in Java and the differences between purely functional languages like Haskell and hybrids like Scala. Later in the interview other programming languages are discussed along with the notion of programming paradigms and the need for combining both paradigms and languages to best solve problems.

Are We There Yet?
http://www.infoq.com/presentations/Are-We-There-Yet-Rich-Hickey
In his keynote at JVM Languages Summit 2009, Rich Hickey advocated for the reexamination of basic principles like state, identity, value, time, types, genericity, complexity, as they are used by OOP today, to be able to create the new constructs and languages to deal with the massive parallelism and concurrency of the future.

Persistent Data Structures and Managed References
http://www.infoq.com/presentations/Value-Identity-State-Rich-Hickey
Rich Hickey’ presentation is organized around a number of programming concepts: identity, state and values. He explains how to represent composite objects as values and how to deal with change and state, as it is implemented in Clojure.

Clojure and Rails – the Secret Sauce Behind FlightCaster
http://www.infoq.com/articles/flightcaster-clojure-rails
Clojure is a LISP for the JVM created by Rich Hickey. Over the past year it has gained a lot of attention, mostly due to its concurrency features such as support for Software Transactional Memory (STM) and other powerful data structures. The recent rise of interest in functional languages also didn’t hurt. A few months after the release of Clojure 1.0, real world projects implemented in Clojure are now appearing.

Clojure
http://www.infoq.com/presentations/hickey-clojure
In this presentation from the JVM Languages Summit 2008, Rich Hickey discusses Clojure, which is an implementation of Lisp. Topics covered include Clojure features and syntax, example code, interoperation with Java, Clojure and functional programming, persistent data structures, concurrency semantics, references, transactions, software transactional memory, agents, implementation and pain points.

My Links
http://delicious.com/ajlopez/clojure+infoq

Angel “Java” Lopez
http://www.ajlopez.com
http://twitter.com/ajlopez

October 19, 2011

Asynchronous Programming: Links, News and Resources (2)

Filed under: .NET, Asynchronous, JavaScript, Links, NodeJs — ajlopez @ 10:00 am

Previous Post

More links about Asynchronous Programming:

Node.js is Cancer
http://teddziuba.com/2011/10/node-js-is-cancer.html

[nodejs] Re: Reaction to article: Node is Cancer
http://groups.google.com/group/nodejs/browse_thread/thread/fadc4efc3e4babe8?hl=en%3Fhl%3Den

"async" support in node.js
https://github.com/koush/node/wiki/%22async%22-support-in-node.js

Asynchronous Programming with Async and Await
http://msdn.microsoft.com/en-us/library/hh191443%28v=VS.110%29.aspx

InfoQ; Building Scalable Systems: an Asyncrhonous Approach
http://www.infoq.com/presentations/Building-Scalable-Systems-Asynchronous-Approach

Progress Reporting in C# 5 Async
http://www.codeproject.com/KB/Parallel_Programming/AncillaryAsyncProgress.aspx

IanG on Tap: C# 5 Async Exception Handling
http://www.interact-sw.co.uk/iangblog/2010/11/01/csharp5-async-exceptions

zlib implementation
https://github.com/razorg/node-zlib

BlueEyes
https://github.com/jdegoes/blueeyes
A lightweight Web 3.0 framework for Scala, featuring a purely asynchronous architecture, extremely high-performance, massive scalability, high usability, and a functional, composable design.

Evented Ajax
https://github.com/mojolly/jquery.evented_ajax.js
An event driven replacement for $.ajax designed for use with non-blocking, evented backends (you know, stuff like NodeJS, EM, Twisted)

Asynchronous Programming in JavaScript with "Promises"
http://blogs.msdn.com/b/ie/archive/2011/09/11/asynchronous-programming-in-javascript-with-promises.aspx

Step, control-flow the node.js way
http://thechangelog.com/post/516202796/step-control-flow-the-node-js-way

SignalR Demo
https://github.com/bradygaster/SignalR.Demo

Using an Asynchronous Server Socket
http://msdn.microsoft.com/en-us/library/5w7b7x5f.aspx

Asynchronous server application framework for Clojure
https://github.com/texodus/saturnine

Picard
https://github.com/strobecorp/picard
Async clojure HTTP framework

The Netty project
http://www.jboss.org/netty
The Netty project is an effort to provide an asynchronous event-driven network application framework and tools for rapid development of maintainable high performance & high scalability protocol servers & clients.

Node.x
https://github.com/purplefox/node.x
http://purplefox.github.com/node.x/
A general purpose framework that uses an asynchronous event based style for building highly scalable network or file system aware applications
Runs on the JVM.
Everything is asynchronous.
Embraces the style of node.js and extends it to the JVM. Think node.js *on steroids*. Plus some.

Asynchronous scalable web applications with real-time persistent long-running connections with SignalR
http://www.hanselman.com/blog/AsynchronousScalableWebApplicationsWithRealtimePersistentLongrunningConnectionsWithSignalR.aspx

libev
http://software.schmorp.de/pkg/libev.html
A full-featured and high-performance event loop that is loosely modelled after libevent, but without its limitations and bugs. It is used, among others, in the GNU Virtual Private Ethernet and rxvt-unicode packages, and in the Deliantra MORPG Server and Client.

libio
http://software.schmorp.de/pkg/libeio.html
Event-based fully asynchronous I/O library for C (used by IO::AIO). Currently in BETA!

Groovy++ in action: Gretty/GridGain/REST/Websockets
http://groovy.dzone.com/articles/groovy-action

Reactor Pattern
http://en.wikipedia.org/wiki/Reactor_pattern
The reactor design pattern is an event handling pattern for handling service requests delivered concurrently to a service handler by one or more inputs.

Proactor Pattern
http://en.wikipedia.org/wiki/Proactor_pattern
Proactor is a software design pattern for Event handling in which long running activities are running in an asynchronous part. A Completion Handler is called after the asynchronous part has terminated. The proactor pattern can be considered to be an asynchronous variant of the synchronous reactor pattern.

The state of Axum: Isolation, Agents, and Message-passing in .NET
http://blogs.msdn.com/b/maestroteam/archive/2011/02/28/the-state-of-axum.aspx

How GitHub Works: Be Asynchronous
http://zachholman.com/posts/how-github-works-asynchronous/

Using node.js async library reminds me of continuations and monads
http://iamwil.posterous.com/64271154

Tweaking WCF to build highly scalable async REST API
http://www.codeproject.com/KB/webservices/fixwcf_for_restapi.aspx

My Links
http://www.delicious.com/ajlopez/asynchronous

More links are coming. Keep tuned!

Angel “Java” Lopez
http://www.ajlopez.com
http://twitter.com/ajlopez

« Newer PostsOlder Posts »

Theme: Shocking Blue Green. Blog at WordPress.com.

Follow

Get every new post delivered to your Inbox.

Join 28 other followers