Development application: Microsoft Visual Studio LightSwitch
By Jeremy Pollard
Microsoft has entered the world of application-specific development with its Visual Studio LightSwitch offering, presently available as a free software program (like the Express versions of its popular development tools).
This environment can be used for your own personal development and education – for programmers and non-programmers alike. Non-programmers can use it to create small applications, while experienced developers can add very cool features with a newly defined object model.
The install file is fairly big – almost 300 MB – and it can be downloaded for immediate access. There are various components that need to be installed with LightSwitch, such as SQL server, Silverlight and Visual Studio 2010.
I installed the software on an existing Windows XP virtual machine, and it installed and ran without any issues.
Microsoft contends that you can develop an application without writing a single line of code. While this may be true, learning a bit about object models and methods would still be a good thing to do. Should you need or want to write code, you can do so in either Visual Basic or C#.
I was intrigued by the fact that you can create a desktop or web-based application.
Imagine that you have a database of existing data, such as historical pump flows, flow volumes and temperatures. The database currently has to be on a Microsoft SQL server. If you have existing Access databases, there are export programs available to migrate your Access data to SQL. When migrating this data, there will be tables, records and data field formatting, commonly known as data types, to deal with.
A number such as 23.22 could be interpreted as a floating point number or as currency. This is an example of data typing.
After installing the product, it became very obvious that Microsoft knows that non-programmers will be playing around with LightSwitch, as there are many examples and training aids to guide you through the process of developing applications.
There is also the ability to add extensions (like plug-ins for a web browser), although none exist right now. The LightSwitch community will grow, I’m sure.
As with Microsoft Access, you can visually create forms, display data, create tables and queries, and create relationships between tables and records.
One of the really cool features is the ability to have the resulting application run on a desktop or within a browser. There are three different entry points.
If you compile the application as a browser client only, then the user(s) can only view data. This is perfect for floor-level data access – operators who just want to look at data. The security level inherently protects the data.
I do some work for a township’s water control, so when I created my database, I used a pump house data structure, which included data for chlorine, turbidity and the like.
What the operators want to see when they look up the data is a table with minimum, maximum and average daily values. If the data resides on a networked server, they can view the data with a browser or locally, but the web interface allows others in the township to also view this data.
The table was populated, and a query/screen created with ease. I like this!
The user interface is very clean and functional. When a table is created, you can connect tables together (relationships), add computed data fields to the record and embed an external database into the table (an entity).
Adding screens is educational. Part of the object model for databases is table, record and field. Collections are a big part of any database implementation since you would typically want to retrieve a collection of data for a specific purpose, such as all chlorine values for all sites that exceed a certain threshold. The collection returns the names of the sites whose chlorine values exceed that threshold. This would be a developed user query.
The creation of the application does require some upfront design and logistics, such as navigation of screens, but you would have to do that anyway.
As with all things that are made for ease of use, the software sometimes boxes you in because of the clicks that you just made. Sometimes it’s just as easy to write the code and be done with it. You can do that, but the object of this column is to introduce LightSwitch as a platform to learn from and play. It is easier to deal with this if you have an application in mind.
Make this part of your learning and education arsenal, and maybe your kids will enjoy it, too!
To download a copy, visit www.microsoft.com/visualstudio/en-us/lightswitch.
Jeremy Pollard has been in the industrial automation industry for more than 25 years. He has worked as a systems integrator, consultant and educator. You can reach him at firstname.lastname@example.org.