Showing posts with label saas. Show all posts
Showing posts with label saas. Show all posts

Tuesday, April 26, 2011

Simply SaaS (Part 3)

This is part three of a multi part series where I will talk about what it means to develop and deliver a Software-as-a-Service application. I'll be trying to strike a balance between the technical aspects of bringing an app into the cloud and the advantages of using the SaaS approach as an Independent Software Vendor (ISV). I am NOT an expert in SaaS by any means...I'm writing this to educate myself and hopefully any reader that has the same curiosity. Your mileage may vary.


In the last post we talked about a sample SaaS application to be developed, discussed getting started with our development framework (SaaSGrid Express), and covered setting up our deployment infrastructure (Amazon EC2). With this post we will take a look at the SaaSGrid SDK in action to give a better idea of how easy it is to SaaS-enable a .NET application. To get started we need the following:
  1. Visual Studio 2010 - Since I don't own a copy of Visual Studio, I decided to give the 30 day trial a spin for this exercise. Although I didn't try it you can use the Express version of VS with SaaSGrid if you follow the instructions here.
  2. SaaSGrid SDK - You may have already installed this when you installed SaaSGrid. If not you can download it here.
  3. Familiarity with Windows Communication Foundation (WCF). It's pretty much essential to all things SaaSGrid. I'd highly recommend the book "Programming WCF Services" if your knowledge is advanced enough to circumvent the Hello World tutorial and move directly into best practices.
  4. You should read the "Developer Topics" section of the SaaSGrid Developer Guide at a minimum - if you are really serious about using SaaSGrid you should take the time to work your way through the guide in its entirety before you sit down to develop.
In order for SaaSGrid to function properly, your Visual Studio project must adhere to a semi-rigid structure. The project must consist of a root project that houses the Web UI and one or more projects that contain the WCF services needed to make your Web UI function. Additionally a "Database Scripts" folder with a file called ApplicationProvisioning_Script.sql must contain the SQL necessary to build the table structure(s) for your WCF services to use. For my project I relied on the SaaSGrid template (that's included in the install of the SDK) to provide the basic structure. I ended up replacing the root web application project with an ASP.NET MVC 2 web application project since I was interested in checking out the .NET MVC framework. If you follow a similar path be sure to copy the SaaSGrid.cfg.xml file from the original root web application. 


In a SaaSGrid application WCF services will provide the majority of the application's functionality. This paradigm doesn't fit the traditional MVC development methodology but I was able to find some people that took the same plunge. Additionally, If you're like me and think most modern web applications will have a mobile counterpart, the push to a "pure" service oriented web application is a good thing. Not only will your application be ready to scale at the click of a button - you'll be able to pump out a mobile app without the added effort of exposing your application's business logic after the fact. Sweet. 

Recalling the description I gave for the sample application, a movie buff (Fred Film) will be able to manage a list of his/her favorite movies. Movie rental store owners (Ralph Rental) will be able to connect with users like Fred Film and tell Fred how many copies of his favorite movies they have in stock so that Fred can plan accordingly before heading out to the store. As an added bonus Ralph will be able to collect demographic information on users like Fred and perform some very simple analysis on his client base so that he can optimize his marketing strategies moving forward. Since we are building one application instead of two separate apps (one for the general public and another for store owners) we need to define the features of the application that will be for paying subscribers (i.e., store owners) only:
  • The ability to set the inventory level for a given movie
  • Associate a movie with the store
  • Provide 10 reports a month that show the number of users (based on zip code) connected to the subscribers store
At a general level, here are the features of the application that the general public can use:
  • Find and associate with a local rental store
  • Add favorite movies
  • View the inventory level of the user's favorite movie at his/her local rental store
Another great feature about SaaSGrid is that it controls the account (and role) creation for all users of your application. We can organize the functionality that we need to implement into the various roles and start coding. Let's take a look at our first SaaSGrid enabled method signature in a service interface we've defined for a rental store owner:

The FaultContract attribute will raise an exception if there is a failed authorization when trying to execute the implemented version of this method. This attribute indicates that the implemented function will contain SaaSGrid authorization. Now let's look at the implemented method for the signature above:


The Secured attribute in the implemented method defines a role based operation for associating a movie to a store. As you can see there is very little effort for this level of granularity. In fact all we are doing is decorating the method with an attribute - no code change required! Also note that I'm taking advantage of the TenantId instead of making the developer supply a Guid for a given store. The SaaSGrid SDK provides access to a series of heirarchal contexts (e.g., ProviderContext, TenantContext) allowing developers to access relevant details about the current tenant, user, provider, etc. This concept is another reason why it's important to go through the SaaSGrid Developer Guide. This post provides some additional details on accessing information that belongs to tenant's outside of the scope of the current context.


To help with testing your application locally you'll need to use the Mocker application (installed as part of the SDK) to add sample tenants, users, roles, as well as securables. You will need to define a securable for each Secured attribute that's in your application (essentially the attribute value is the securable definition). When you define each role you'll assign one or more securables to a role to define permissions. Moving on, roles are assigned to users and users belong to a tenant (or subscriber). Finally, before you launch the debugger for your WCF services and your web app, you will need to create the database and tables by executing the SQL contained in the ApplicationProvisioning_Script.sql script that was previously defined.


In the next post I'll show case some snippets that highlight finer grained monetization constructs, discuss how to package your application for deployment, discuss the product management features included with SaaSGrid, and talk about versioning your application. Enjoy!

Thursday, March 24, 2011

Simply SaaS (Part 1)

This is part one of a multi part series where I will talk about what it means to develop and deliver a Software-as-a-Service application. I'll be trying to strike a balance between the technical aspects of bringing an app into the cloud and the advantages of using the SaaS approach as an Independent Software Vendor (ISV). I am NOT an expert in SaaS by any means...I'm writing this to educate myself and hopefully any reader that has the same curiosity. Your mileage may vary.

I think it's an understatement to say that the cloud computing term is overused. What does it really mean to deliver an application in the cloud? In recent years developers put together a web application or solution by marrying a database with a development framework and an application server resulting in a technology stack (e.g., LAMP, etc). Once the application was developed using these components it was deployed to a hosted environment or installed on premise to be part of a private enterprise. Ongoing maintenance for the application involved generating patches to fix bugs and supply enhancements. Sounds familiar and perhaps a little boring right? Around 1999 this guy, named Marc Benoiff took a sabbatical from his day job at Oracle (and by sabbatical I mean he was in Hawaii for 3 months and then in India "finding himself" for another 2 months) and started Salesforce.com. This, for historical purposes and to the best of my knowledge, was the start of the cloud buzz.

Marc wanted to offer easy to use enterprise software that didn't cost organizations an arm and a leg to implement and support. He did this by creating a pioneering CRM application that was nothing more than a web application / site that provided access via the Internet instead of the Intranet. Brilliant! Needless to say the application was a huge hit and later spawned the Platform-as-a-Service (PaaS) offering known as force.com.

To me, delivering a SaaS application seems like a smart move for an ISV. You have a low barrier to entry to get started, you can pass on that cost savings to customers, and you don't necessarily need to worry about supporting the infrastructure that runs your app at the end of the day. At a high level this seems like nirvana but you'll quickly find that it's difficult to understand what technologies you should be concerned with (as a developer) and how you will handle the subscriptions (as an ISV). I hope to fill in some of the blanks to developing and delivering a SaaS application by documenting the process I follow as I take an (albeit trivial) app from inception to delivery.

I'm a developer, what tools or frameworks exist to help migrate my project into the cloud?
First off there is a general distinction we need to make. SaaS is a type of software not a technology in particular. There exist a few "on demand" concepts that enable SaaS application developers. These concepts would be Infrastructure-as-a-Service (IaaS) and Platform-as-a-service (PaaS). Think of IaaS as Amazon EC2 - you get access to a hosted virtual machine where you can deploy your application. As your application grows and requires more resources, you can add more iron in your equation to get you that extra horse power. The application developer is still responsible for worrying about things like load balancing and clustering. An example of a PaaS would be force.com. If you haven't looked at this already it's worth signing up for the free developer account and poking around the documentation. Basically force.com allows developers to build apps with a domain specific language (DSL) known as APEX. You build your app using APEX and as you scale your app to customers you are charged a metered rate. Force.com also recently bought Heroku...this is a ruby on rails based PaaS. You build your app in rails, deploy it to the cloud using Heroku gem, and you are billed for your usage as your application scales to meet demand. There are too many PaaS offerings to mention in one post but hopefully you get the idea.

I'm an ISV what does it mean to build a cloud application?
Low barrier to entry for your customers. SaaS supports the idea of Multi-tenancy that allows you to co-mingle customer data (as long as the law doesn't prevent it) and therefore provides your customer with access with a push of a button. Customers pay for the software with a subscription so that they only get what the need instead of paying for countless licenses that ended collecting dust somewhere.

This is great but what if I already built my application? Do I need to re-develop or re-architect it?
Possibly. Apprenda provides a technology called SaaSGrid that can mostly eliminate that concern provided that you have an existing .NET application. SaaSGrid is advertised as an application framework that allows you to migrate your .NET application from a more traditional application service provider (ASP) model to a SaaS offering. The technology provides things like multi-tenancy so all you need to concentrate on is building your application like you normally would. In my opinion if you have a .NET web application that's worthy of the cloud or know .NET and want to build a new application, you should definitely give Apprenda a glance. You can download an express version that will allow you to install it on a server and see how the whole thing works. While I tend to be more of a Java / Ruby guy I definitely see the value in using something that's .NET based. Many enterprise grade SDK's (I'm thinking of ESRI since I'm a GIS geek) play nicely with .NET and maybe aren't fully featured for integration with other technologies like rails or a PaaS DSL such as APEX. This argument won't hold for forever but seems to be logical for the present.

In the next post I will talk about the application that I'm using as an example for this series and how it will benefit from an "on demand" delivery instead of shipped bits. Stay tuned!