Feeds

Microsoft trips on Visual Studio Lightswitch

Latter-day Access needs less code

Securing Web Applications Made Simple and Scalable

Review Microsoft's Visual Studio LightSwitch, just released to beta, is a new edition of Visual Studio 2010 and will become the next step up from the free Express.

In other words, it will be paid-for but cost less than the existing Professional version. Do not be fooled though: although this is a low-end tool it is one with high ambitions.

Some two years in the making, it aims to simplify the building of business database applications, particularly at the departmental or small business level, but to do so in a way that respects Microsoft's current ideas about best-practice software architecture.

You can think of it as a modern-day Access or FoxPro, except that this is 2010 and LightSwitch builds Silverlight applications, both desktop and browser-hosted, that retrieve data over the internet or intranet and which might even run on a Mac.

LightSwitch is a departure from a model of visual programming that Microsoft has used since the first Visual Basic in 1991. This old model involves building a form with drag-and-drop visual components, then writing code to make it work. LightSwitch has no visual form designer, at least not in that sense.

Screen designer

Screen designer is where ease of use begins to break down

Screens are defined as a list of components bound to data, and you can only find out how a screen will look by actually running it. The size and position of components is set by LightSwitch. It is an implementation of Model/View/ViewModel (MVVM), which is a variant of the Model-View-Controller (MVC) pattern currently fashionable in Microsoft circles. While the merits of NVVM are arguable - some find it over-complex - Microsoft deserves credit for creating an easy to use tool that at least attempts to follow a sound architectural pattern.

Database connectivity and user authentication in LightSwitch uses WCF RIA Services, Microsoft's web service framework for Silverlight, though developers are shielded from the details. This means there is a middle tier running on Microsoft's IIS web server.

The middle tier connects to data via Microsoft's Entity Data Model, and out of the box LightSwitch supports SQL Server, SharePoint, or any generic WCF RIA Service. Azure support for both data and deployment is promised in the final release, as is Microsoft Access databases, but neither is present in the beta.

So how does this look to the developer? LightSwitch is firmly data-centric, and after choosing between Visual Basic or C#, the first thing you have to do is either to create a new table, or attach to an existing database. If you are starting from scratch, LightSwitch uses SQL Server 2008 Express. The table designer is a good effort, simplified but still powerful, with common-sense business data types like EmailAddress, Money and PhoneNumber as well as the usual Ints and Doubles.

Plumber required

LightSwitch aims to handle as much of the plumbing as possible, leaving you to concentrate on the business decisions. For example, ID fields are there by default, and when you create screens, client-side validation based on data type is automatic.

The table designer also handles queries, relationships and computed fields. When you create a relationship, a diagram and plain English description explains your choices, such as: "An invoice can have many InvoiceDetail instances." You can also specify delete behaviour, and LightSwitch will either implement cascading deletes, or prevent deletes that would leave orphaned rows.

Once you have defined the data, you can add screens using templates such as search forms, editable grids, or list and details. LightSwitch then builds a screen and displays it for modification. The screen designer is where LightSwitch's ease of use begins to disappear, though in simple cases you may not need to make many modifications. This is also where you can add custom code for events such as screens loading, controls changing their values, or data saving. It is not too bad; but one can imagine occasional developers used to Access or Visual Basic finding this designer perplexing.

Runtime customization mode

Runtime customization mode is the nearest thing to a visual form designer

An intriguing feature is that you can customize a form in the debugger. This helps to mitigate the lack of any visual designer. In customization mode, you get access to the component list and property editor along with a preview of your screen, all implemented in Silverlight.

LightSwitch is impressive, even in its beta state, which is by no means fully stable or complete. But does it succeed in its aims? As an effort to simplify database design, it is Microsoft's best effort yet, but as an application building tool I am not so sure.

LightSwitch creates large amounts of code: I followed through the tutorial for a simple application and the generated files included 4,500 lines in a file called DataRuntime.cs, for example, though you are not meant to care about this. This may be why performance seems disappointing; but this is an early beta so that may change.

Another issue is that moving from the pre-built screens to something more fully customized is a challenge: you have to create data-aware Silverlight custom controls and hook them into the screens. Finally, there is the question of whether the target developers are ready to abandon the comforts of Excel and Access for the mysteries of Silverlight, LINQ, MVVM, and no visual form designer.

This is a brave effort though, tackles a real need, and shows Microsoft's continuing commitment to the Silverlight platform. ®

Bridging the IT gap between rising business demands and ageing tools

More from The Register

next story
NO MORE ALL CAPS and other pleasures of Visual Studio 14
Unpicking a packed preview that breaks down ASP.NET
Secure microkernel that uses maths to be 'bug free' goes open source
Hacker-repelling, drone-protecting code will soon be yours to tweak as you see fit
KDE releases ice-cream coloured Plasma 5 just in time for summer
Melty but refreshing - popular rival to Mint's Cinnamon's still a work in progress
Cheer up, Nokia fans. It can start making mobes again in 18 months
The real winner of the Nokia sale is *drumroll* ... Nokia
Put down that Oracle database patch: It could cost $23,000 per CPU
On-by-default INMEMORY tech a boon for developers ... as long as they can afford it
Another day, another Firefox: Version 31 is upon us ALREADY
Web devs, Mozilla really wants you to like this one
Google shows off new Chrome OS look
Athena springs full-grown from Chromium project's head
prev story

Whitepapers

Designing a Defense for Mobile Applications
Learn about the various considerations for defending mobile applications - from the application architecture itself to the myriad testing technologies.
Implementing global e-invoicing with guaranteed legal certainty
Explaining the role local tax compliance plays in successful supply chain management and e-business and how leading global brands are addressing this.
Top 8 considerations to enable and simplify mobility
In this whitepaper learn how to successfully add mobile capabilities simply and cost effectively.
Seven Steps to Software Security
Seven practical steps you can begin to take today to secure your applications and prevent the damages a successful cyber-attack can cause.
Boost IT visibility and business value
How building a great service catalog relieves pressure points and demonstrates the value of IT service management.