So – these days everyone is in the cloud so how come I’m not? I guess that this is a question we all ask ourselves from time to time or not…
Well I felt a strong need for “dogfooding” on ECO and AppComplete to see if the products really worked in real life cases. I had a solution I just needed a problem – awkward but not uncommon for a guy like me.
I set out to create the cloud service AppCompleteCloud. I have been working on and off on this for quite some time(6 months). When doing things with very low intensity you need to make sure that they are dead simple to understand. Since you will have forgotten any intricate details the next time you have a few minutes to attack the code.
Luckily model driven development the way we do it is perfect for this – everything stays clean and easy to grasp even if you are having your brains electrocuted between the coding sessions. (I have heard that they still do that to cure depression – fantastic – Are you depressed? Yes –> ZAPPP! Are you still depressed? HELL NO! So it must have worked then?).
I needed to define my problem. This is what I ended up with:
- Upload models to the cloud so that others may look at them without any special tools
- Let those people comment on the things they see
- Let the developers with the standard tools (AppComplete and ECO) discover and answer those comments
But then I had to make a lot of decisions:
- Can just anyone look at any model?
- What cloud platform should I use?
- What database should I use if any to keep the data in?
- Should everything be done as syncron actions, or do I need some background worker?
- How can I avoid spending a lot of time on user administration code?
- Can I use a ViewModel driven UI?
And during the cause of this project I answered all those questions, and
- I found and corrected loads of bugs in ViewModels for ASP.NET
- I added a http-handler to ECO.WEB so that I easily can show images from blob types
- I ensured that the SqlServer PersistenceMapper works with SQLAzure
- I learned a lot about federated login with Azure
- I extended Modlr to signal and show Cloud comments
- And a lot of other lessons learned
The solution
I ended up doing this on the Azure platform. It’s a neat and cool way to consume data power just in time.
This is the Azure admin UI
In VisualStudio I have my Azure project that is really an ECO project:
From within VS I just have to say “Publish” – then sit back for 20 minutes (YES I KNOW, INSANELY LONG TIME), while some container in some industrial park somewhere in the northern Europe, filled with cpu’s, that runs virtual machines, creates a new deploy machine, installs WindowsServer 2008R2 on it, then applies my application package, then makes a swift and almost invisible handover from the old deploy machine to the new deploy machine. And the new version is out… Pretty cool – but would not “boring industrial park” be a more descriptive term than “cloud”?
The AppCompleteCloud model
The AppCompleteCloud model is as above. The Green classes; Screen,ThingOnScreen, ThingInModel is what actually constitutes the stuff we track. But the whole modlr file is kept as a blob attribute called ModelZip in the Yellow class Model. This attribute has “DelayedFetch==true” , this is important since we do not want to load that all the time we present a model. The Gray classes track the user info; we use federated login but create a user object as reference so that we can allow for our application specific access policies – like who uploaded the model, who can access it, who can replace it. The pink class Comment points out a user and a Thing on the Screen – easy as pie. There is a state machine controlling the rendering state of the model.
I also created some ViewModels with UI-hints:
Like searching for users:
And for administration for one model:
And then some for the different needs of the application.
This way I can hold the code to absolute minimum. The typical code behind in this application looks like this:
protected void Page_Load(object sender, EventArgs e) { ViewModelASPNET1.GridsHasEditButton = false; ViewModelASPNET1.GridsHasDeleteButton = false; ViewModelASPNET1.OnGridViewSelection += new EventHandler<ViewModelForAspNet.OnGridViewSelectionArgs>(ViewModelASPNET1_OnGridViewSelection); ViewModelASPNET1.SetObject((Master as SiteMaster).User); ViewModelASPNET1.DataBind(); } void ViewModelASPNET1_OnGridViewSelection(object sender, ViewModelForAspNet.OnGridViewSelectionArgs e) { if (e.ViewModelClass != null && (e.Selected as string) != null) { if (e.ViewModelClass.Name == "UploadedModels") Response.Redirect("ModelAdmin.aspx?show=" + (e.Selected as String)); else if (e.ViewModelClass.Name == "Models") Response.Redirect("ModelView.aspx?show=" + (e.Selected as String)); } }
The result
From within AppComplete or ECO you can upload any model to AppCompleteCloud.
You need a service password that you set in AppCompleteCloud:
Once you have uploaded the model you can find it amongst your models:
Select to look at it:
Click something to read more or be able to comment:
Now switch back to AppComplete or ECO, and CloudForm:
And we see a symbol in the diagram:
If I click it a new form shows up:
If I answer the comment and close the form, the symbol switches to green to signal that there are comments but all are currently answered:
Now back to the CloudForm in AppComplete or ECO:
I upload the model again – I likely have done changes – so just uploading the answers to the comments seems like an odd case that will not be used very often – upload the whole model and let AppCompleteCloud re-render it:
And the comment is answered and the user might be very happy with the answer…
Controlling access
Looking at your models:
And you get to the admin UI:
Here you can reset the rendering state machine and start it over – afaik you will not have to do this manually unless something has gone very wrong.
You can add users – a new window that helps you search on the name is shown – pick one and you have added that user. Then edit what specific rights you give that user.
Oh, you can also have your users access the XPS report I talked about here just by clicking this:
Summing it up
So what do you think? Useable or absolute crap? It has been very educational for me anyway and I am certainly doing more cloud based services in the future – and yes – they will definitely be model driven!
2 Responses to Everyone is in the cloud