Making applications at speed of light

By Leonardo Filippelli How many times we used a spreadsheet to administrate something or to solve a

By Leonardo Filippelli

How many times we used a spreadsheet to administrate something or to solve a problem thinking in how useful it would be to have a software that allowed us to make it in a much more automatic and efficient way?

And how many of those times we didn’t do it just for not having the sufficient time for the development or because the cost-benefit relationship was not attractive? Visual Studio Light Switch is a tool that allows us to create applications quickly and writing little or nothing of code, depending on the complexity of the application.
Based on that, very roughly, an enterprise-class application consists of the following:

•    Data: In most of the cases we have a relational data base.
•    User Interface: the screens that show data and allow to modify them.
•    Business rules: The rules and validations that depend of the problem the application solves.
•    Security: Authentication and authorization.

LightSwitch takes care of these 4 aspects automatically, so that from being a simple ABM we can build an application in just a few hours without writing code. How it works? Basically these steps are followed:

1) The data source is defined: we can use a data base, web services or a SharePoint as a data source for our application. There is also the possibility to create the entities “on the fly” without depending on external sources.
2) Based on the data source the involved entities are identified which can be edited in the application changing the type of typical data of a table of a data base for others more oriented to the business. For example, if I have the entity “employee” and the attribute salary, I can transform the type of that attribute from “double” to “Money”. You can also add calculated attributes that do not persist.

3) Once we have our entities defined, we create the screens that our application will have. Each screen can show one or more of the entities of our business. We have templates of typical screens such as “Search screens”, “Details screen”, etc”. Each one can be configured to display data, allow editing, add new, remove, etc. It also configures the navigation between the screens.

4) Having defined the screens we can add the security restrictions in terms of authentication and authorization. Besides the typical login, each screen can be configured to be accessible to certain type of user, or even define the field at a particular screen.

5) Done, we have our application working for what it is a typical ABM, What if I have to add business logic? How and where do I put this into something so automatic? It is simple, given that Light Switch is very extensible. The way to extend it is creating methods, that can be written in C# o VB, based on treating the business entities as objects and define the logic in the way in which we do it in any application.

6) We have the complete application, how we deploy it? Note that so far we haven´t talked at any time of web applications or desktop applications, we just mentioned applications in general. This is because the creation of the application is independent of the environment in which it is going to be deployed later.  Until the previous step we weren´t interested in if it was web or desktop, in fact we can have both “flavors” without having to receive a single code line. Once the application is ready, we can deploy it as desktop, web or even in the cloud using Windows Azure.

How is it that all this things work without involving architecture subjects, frameworks and other things? Behind, what it ends up generating is code C# o VB.NET using many of the most current technologies of Microsoft, such as ASP.NET, Silverlight, Entity Framework, WCF, among others. The good thing is that we don´t have to modify that code automatically generated, it is completely transparent. When we extend the model we simply add one method to one entity and that’s all.
This methods don´t modify at all the data source, they are one object methods. For example, if the data source is a data base, the object to which we add the method is mapped to one table and the new method is like another property of the object calculated “on the fly” instead of being a data coming directly from the database.
Within the code´s method besides using attributes from the object itself (or any that was related), also other methods can be used such as framework .NET, utilizar linq, etc, everything we normally have available when constructing an application .NET. Then when a screen is created, this “calculated attributes” can be manipulated in the same way than the ones that are mapped to the data source.
The underlying architecture can be graphed in the following way:

Summarizing, the main benefits of Light Switch are:
•    It is a simple and fast way to construct Enterprise applications.
•    Uses the latest Microsoft technologies, the same we use in the applications we construct every day.
•    It allows us to create applications that can run in the desktop of a client, in the web or in the cloud.
•    It is simple enough so that a “power user” can create an application without having programming skills.
•    It is extensible enough so that a developer can take advantage of it.

As for the cons we can mention the following:
•    A developer is not much attracted to the idea of developing “oriented to data”. They prefer to think in the objects that are part of the business domain regardless of how that will persist afterwards.
•    It is not the best option to build a complex application.

As a conclusion LightSwitch is not the solution for most of the enterprise applications that we tend to develop in Hexacta. Nevertheless, I think that it can be a useful tool to construct small applications that don´t broadly escape from what is a typical ABM, given that they can be done really quickly and extend the model to add business logic in a simple and fancy way.

For more information:

Share this articleShare on LinkedInTweet about this on TwitterShare on FacebookShare on Google+Email this to someone
Go Back