Subscribe to Windows IT Pro
September 14, 2011 01:00 PM

Visual Studio LightSwitch 2011: A Brand-New Way to Develop Data Applications

A walk through the Visual Studio 2011 LightSwitch IDE highlights its strengths as a tool for building data-centric apps
Dev Pro
InstantDoc ID #140128
Rating: (1)

Microsoft has long made development tools available to people who are not professional, full-time developers. They made a brilliant move many years ago when they added Visual Basic for Applications (VBA) and other scripting languages and tools to some of their consumer and business-oriented products, most notably various products in Office. As a result, there are probably millions of applications written using Microsoft Excel and Access that run businesses large and small, built by people with deep domain knowledge but little or no development training.

But there has long been a gap between these Excel and Access applications and more widely used commercial and enterprise-class applications. Often when a power user's application needs to scale up for wider use, the company discovers the limitations of Excel and Access and has to call in professional developers to rewrite it from scratch using "real" tools like Visual Basic (VB), C#, and Visual Studio. There just haven't been any good, scalable migration paths for these apps, despite lots of effort by both Microsoft and outside vendors.

Recognizing this gap, in late July 2011 Microsoft released version 1.0 of Visual Studio LightSwitch 2011, a constrained development environment for creating rich applications whose main purpose is to let users interact with data. The product is constrained in that it uses specific technologies and does things in a specific way, albeit with plenty of ways to customize the application through extensions and custom code.

A LightSwitch application is built on several key technologies, all of which are the current state of the art in the Microsoft stack, including:

  • Silverlight 4.0 for the user interface
  • Windows Communication Foundation (WCF) RIA Services for communication between application layers and as a powerful point of extensibility
  • Office automation to let users export customized views of data and interact with Office applications
  • Entity Framework for object-relational mapping (ORM) services to the underlying data stores
  • OData for querying and updating data using HTTP, ATOM, and JSON
  • Various data stores, including SQL Server, SQL Server Express, Windows Azure, and SharePoint

On the face of it, this list of technologies would be intimidating to power users, and even to many professional developers! But LightSwitch takes care of all the details for you, so that you don't need to know any of them in any depth to be effective writing LightSwitch applications. For example, LightSwitch generates Silverlight in the application automatically, and you don't have to know anything about Silverlight or XAML. Unless, perhaps, you want to develop a custom shell, which is one of the ways to extend and customize a LightSwitch application.

 

The Right Kind of Application

All this begs the question, what kind of application is right for LightSwitch? Why would any developer or power user want to use a constrained version of Visual Studio? LightSwitch is ideal for forms-over-data applications, where the purpose of the application is to provide a user interface to view, insert, and update data in a data store. Admittedly, this is a bit of an application niche, but it's arguably a huge niche. LightSwitch provides all the infrastructure for all the common requirements for such an application, so that you don't need to write code to access data storage and manage the UI, and it provides a framework for implementing business logic. Figure 1 shows the LightSwitch UI at runtime. Essential features like searching and sorting are part of the UI by default, and LightSwitch supports strong security using either Windows or forms authentication. The bottom line is that you can focus on the custom features of each application without spending any time on the infrastructure.

Figure 1: A typical UI screen in LightSwitch, with some customizations for the particular data
Figure 1: A typical UI screen in LightSwitch, with some customizations for the particular data

 

Microsoft touts how you can write LightSwitch applications with little or no code, but I suspect that most nontrivial applications will require at least some custom code. The good news is that the code you'll need to write is the interesting custom stuff, not the repetitive infrastructure code such as for data access.

The best advice I've seen about when LightSwitch is the right or wrong tool for an application was on Microsoft's LightSwitch forum: "The rule of thumb I use is that LightSwitch is not the right tool for the job when the UI is the point of the application." For applications such as inventory control, asset management, data consolidation from multiple sources, and so on, the UI isn't the focus of the application. Instead, the application exists to process data and render it in the UI to the user. It is those applications that are perfect for LightSwitch. When you think about it, most effective Access and Excel applications also fit the description of being ideal for LightSwitch. Anything that doesn't process data and display it to the user would be better developed using some other application type using Visual Studio.

 

Related Content:

ARTICLE TOOLS

Comments
    There are no comments to display. Be the first one!
You must log on before posting a comment.

Are you a new visitor? Register Here

advertisement

advertisement

Windows is a trademark of the Microsoft group of companies. Windows IT Pro is used by Penton Media Inc. under license from owner.