Friday, 4 April 2008

GigaSpaces VB API

GigaSpaces provides scaling solutions for Excel, a.k.a. "Excel That Scales"

A lot have been said and written about it, and there is plenty of collaterals, examples, and webcasts. That's all good and fine, but what I would like to suggest in this post is a simplified way to access the space from within an Excel spreadsheet and / or any other VB application.

I am targeting Excel or VB developers who require simple means to interact with the space, and prefer not to exhaust their C# skill-set.

As an example, say you want to write a Person object into the space. Using the C# as an access layer to the space, you will need to implement your Person C# class, and space accessibility methods. See the following example for more details (replace HelloMsg with Person…)


What if you could work with the space API from within your Excel code without having to develop an access function (WritePerson() in our case) in C#? I.e. What if you had a reference to VB Space proxy? Think of your code looking something like the following (using the Person example):



Sub WriteToSpace()
Dim aPerson As Person
Set aPerson = New Person

aPerson.FirstName = ActiveCell.Offset(1, 0).Value
aPerson.LastName = ActiveCell.Offset(2, 0).Value
aPerson.Age = ActiveCell.Offset(3, 0).Value

Call GigaSpace.Write(aPerson)
End Sub





And to read a Person object, you'd have to do something like the following (note that I filter the person according to the current user's selection as first name, and then just print the last name and age):

Sub ReadFromSpace()
Dim Template As Person
Set Template = New Person

Template.FirstName = ActiveCell.Value

Dim Response As Person

Set Response = GigaSpace.Read(Template)

ActiveCell.Offset(1, 0).Value = Response.LastName
ActiveCell.Offset(2, 0).Value = Response.Age
End Sub

In this example all you need to do is define your Person object (as a space class using C#), and include it in your COM libraries. The rest is your good old VB code working with the space API…

If you like this approach, stay tuned. I am working on the first version of the API, which will be released fairly soon.

-Guy

1 comment:

Georges said...

Excel is the key user interface and analytics tool for front office users. Having a native VBA connection will truly open up Gigaspaces to the trading /quants user community.