Tag Archives: lightswitch

Microsoft sets Visual Studio LightSwitch to off

Microsoft has officially announced the end of development of LightSwitch, a rapid application builder for desktop and mobile applications.

LightSwitch was introduced in July 2011 as a tool to build multi-tier applications using a data-first approach. You can design you database using an excellent visual designer, design screens for viewing and editing the data using a non-visual designer, and generate applications with the server-side code hosted either on your own server or on Microsoft Azure. The client application in the original LightSwitch was based on Silverlight, but this was later extended with an option for HTML. You can get a feel for the general approach from my early hands-on here.

As I noted at the time, LightSwitch abstracts a number of difficult tasks. This is a good thing, though as with any application generated you had to take time to learn its quirks. That said, it is more usable than most model-driven development tools, in my experience.

LightSwitch had some bad luck. It was conceived at a time when Silverlight looked like the future of Microsoft’s client development platform, but by the time it launched Silverlight was heading for obsolescence. It also fell victim to ideologies within Microsoft (which persist today) that chase the dream of code-free application development that anyone can do. The documentation for LightSwitch on launch was dreadful, a series of how-tos that neglected to explain how the tool worked. You had to get the software development kit, aimed at those building LightSwitch components, to have any hope of understanding the tool.

image

The abandonment of LightSwitch is not a surprise. Microsoft had stopped talking about it and adoption was poor. There will be no tooling for it in the next Visual Studio, though you can keep using it for a while if you want.

I think it is a shame since it is a promising tool and I cannot help thinking that with more intelligent positioning and a few tweaks to the product and its documentation it could have been a success. Those who did get to grips with it found it very good.

What is unfortunate is that Microsoft has lost the faith of many developers thanks to the many shifts in its development strategy. I know component vendors have also been caught out by the Silverlight and then LightSwitch debacle. Here is one of the comments on the announcement:

Microsoft keeps doing this over and over, we invest months even years to master a technology, just to find out it’s being phased out prematurely. Perfectly good, one-of-a-kind niche tools too. So much investment on both sides (both MS and customers) down the drain. What’s worse, it is done is a non-transparent, dishonest manner, letting things dry up over a couple years so that when the announcement comes, no-one really cares any more, no more noise – just look at this blog.

This makes it hard for the company to convince developers that its new strategies de jour have a longer life ahead of them. I am thinking of the UWP (Universal Windows Platform), which has already changed substantially since its first conception, and of PowerApps, the supposed replacement for LightSwitch, and yet another attempt to promote code-free development.

Developers do not want code-free development. They like tools that do stuff for them, if they are intuitive and transparent, but they also like an easy route to adding and modifying code in order to have the application work the way they want.

Visual Studio LightSwitch HTML: mainly for mobile

Microsoft’s Visual Studio LightSwitch is an innovative development tool that lets you build multi-tier database applications without ever designing the user interface directly. Instead, you work with defining the database and the the features you want on your screens. LightSwitch generates the user interface for you. You can also add code snippets, and advanced developers can create custom controls and extensions.

The thinking behind LightSwitch was to make it easy for non-developers to create database applications, though it is not the most intuitive of tools and in reality it is developers looking for rapid application development who are most likely to use it. There is a lot to like in the way it is designed, like the data-first approach and the easy to use database designer, but this is spoilt by some odd decisions. One is that the LightSwitch team are seemingly averse to reference documentation, preferring to deliver various how-to walkthroughs, which is frustrating if you want to find out in detail how it is meant to work.

The initial release of LightSwitch, as well as the new edition in Visual Studio 2012, generates only a Silverlight client, making it useless for mobile devices and somewhat annoying on desktop PCs since you have to install the Silverlight runtime. Microsoft has addressed this by creating an HTML client update, which lets you generate an HTML user interface. This is now at Preview two, and I downloaded it to have a look.

Since LightSwitch generates the user interface from metadata, you might hope that the HTML version would let you take a project created for Silverlight, and simply generate a functionally equivalent HTML application instead. Even if some touching up was needed, such as rewriting C# snippets in JavaScript, this would be a nice option. However that is not the approach Microsoft has taken. It has added an option to create an HTML client for a LightSwitch project, but you have to redo all the screens. In addition, the HTML client is intended mainly for mobile, and is designed for touch control, as explained by Microsoft’s Joe Binder here:

We are not expanding the HTML client’s scenario target to include desktop in our first formal release.  The first release will be based exclusively on JQueryMobile and be optimized for building touch-oriented apps.  We’ll stay tuned to your feedback to sort out where/when we go after that, but we still have some issues to sort out for our mobile story and we’ll remained focused until we feel confident that we have a viable mobile offering.

Of course it is still HTML, and will run on modern desktop browsers, though the generated user interface uses JQuery Mobile extensively. Another of the issues here is that HTML 5 may be better supported on smartphones running WebKit-based browsers than on desktops such as Windows XP running Internet Explorer 8, creating problems for LightSwitch. It is also hard to create a user interface that is equally well suited to touch control as to keyboard/mouse interaction; this issue is a common complaint about Windows Store apps on Windows 8.

The HTML client is still interesting, more so than the original LightSwitch with its Silverlight web or desktop clients. Rapid database app development for mobile devices is an key area, as businesses work to enable their mobile users to access company data.

After installing the preview, I built a quick HTML client app, based on a contact database.

image

It did not take long to build a working application, though there are some puzzles. My first effort at creating a contact list only displayed the firstname of each record. Apparently that is the “summary” layout, and I cannot see any quick way to change the summary definition to something more useful. Instead, I changed it to a Rows Layout which shows all the fields, but lets you delete those which are not required. Then I added an Edit contact button, though it appears as plain text without even an underline to show that it is a hyperlink, and I cannot see quickly how to change this:

image

The button’s “Appearance” properties are not helpful:

image

I also found an annoyance that may be a bug. I created several new contacts via a Contact details form (the first illustration above). I saved each contact with the tick button, whereupon they appear in the contact list. However they are not yet really saved. To save the contact to the database, you have to execute the save action, which is a built-in button on the BrowseContacts form. When I tried to save, the phone number fields (defined as Phone Number fields) failed validation, even though they would be valid phone numbers in the UK, and the records were not saved. Fair enough I suppose, but why did they pass validation in the Contact Detail form?

I am sure there are easy fixes for all these niggles, but I mention them to illustrate the point about this not being the most intuitive of tools.

The general approach also takes some mental adjustment. Here is a tool that makes web apps, but you cannot use a web design tool to customise the user interface.

As a tool for building mobile web apps, LightSwitch does show promise and I look forward to the final release. That said, it would be good if Microsoft could adapt the HTML output so you can make it suitable for desktop browsers as well.

Access Web App: at last a simple web database app builder from Microsoft

One thing hardly mentioned in the press materials for Office 2013, and therefore mostly ignored in the immediate publicity, is Microsoft Access 2013. It is included though, and its most interesting new feature is a thing called an Access Web app.

image

To make one of these, you click the big “Custom web app” button on the opening screen. The first thing you are asked is where to put it. It is looking for a SkyDrive or Office 365 team site – essentially, online SharePoint 2013 I imagine. If you are not signed in, this screen appears blank.

Advertisement

I selected Skydrive at my Office 365 preview site.

image

Hit Create and you can select an app from a template. I chose a Music Collection app. Access generated several tables and forms for me and opened the design environment.

image

The template app is a bit daft – Artists and Labels are based on a People template, so you get Labels with a Job Title field – but that does not bother me. What interests me is that Access generates a relational database that you can edit as you like. The template UI offers either a list/detail view called a List, or a Datasheet which shows rows in a grid format. There is also a Blank view which you can design from scratch.

I had a quick poke around. Access Web Apps do too good a job of hiding their innards for my taste, but what you get is a SharePoint app with data stored in SQL Server Azure. You can also use on-premise SharePoint and SQL Server 2012.

Programmability in Access Web Apps is limited, but you do get macros which let you combine multiple actions. There are two kinds of macros, UI macros and Data macros. UI macros support a range of actions including SetVariableif and else statements. The only loop functions I can see are in Data macros, which include a ForEachRecord action. You can call Data macros from other macros and a Data macro includes a SetReturnVar statement, so I guess with a bit of ingenuity you can do many kinds of automated operations. Macros are described here.

image

In my quick test, I put a button on a view and had it show a message. Apologies.

The application files are all stored on SharePoint, rather than locally, so I presume you could easily edit the app on any machine with Access 2013 installed.

Click Launch App and the web app opens in the browser. Everything worked, including my MessageBox.

image

I also tried it on the Google Nexus 7 Android device. Again it seems to work fine, though I did get some odd behaviour returning to the app. There are possibly some authentication issues.

image

An Access Web App is just another SharePoint app, as explained here, so you can publish it to selected groups via the built-in store.

There is no way that I can see to craft your own SQL, which to me is a disadvantage, but maybe we will discover how to bypass the UI and open a database in SQL Management Studio, or access it programmatically from other environments.

It seems to me that what Microsoft is offering here is what it tried, but failed, to offer in Visual Studio Lightswitch: database programming for the non-specialist. Access has always done this, though unfortunately it is easy to make rather a mess if you do not know what you are doing. An Access Web App gives the developer/user fewer ways to go wrong, and builds cross-browser web apps. It is not yet possible to judge whether Microsoft has got the feature set right, but fundamentally this looks useful for simple custom business database applications of the kind that many small organisations and departments find they need. It is a big advance on MDB files stuck on a file share, fits with the BYOD (Bring Your Own Device) concept by working on iPads and the like, and makes it easy to get started and experiment. Good work.

Visual Studio LightSwitch to get HTML5 support

Microsoft’s Visual Studio LightSwitch is a rapid application development tool designed to create database-oriented, browser hosted applications with little code.

LightSwitch is intriguing because it does model-driven development. You design the model, LightSwitch generates the application. Microsoft’s idea was that non-specialist developer would like the tool, though there is little evidence of that. However, it does enable professional developers to put together functional applications quickly.

Unfortunately LightSwitch was conceived when Silverlight was all the rage at Microsoft. It generates Silverlight apps, which means they can run either on the desktop or in the browser, but also cuts out every device out there that does not run Silverlight. Including of course hot new mobile devices from Apple iOS to Android and even, on the Metro side, Windows 8.

But this is model-driven development, right? Just add code generation for HTML 5 and the same tool will generate standard browser-based apps.

Microsoft has announced just that at TechEd, under way this week in Florida. Visual Studio VP Jason Zander demonstrated LightSwitch for HTML5:

image

which means you can run the apps on iOS:

image

This feature is not in the current RC of Visual Studio 2012 but will be added later.

HTML 5 support puts LightSwitch back on the map as a RAD (Rapid Application Development) tool. But is there any appetite for model-driven development, which has all-but failed in so many other implementations?

That is as yet unproven, but at least the fate of LightSwitch no longer depends on that of Silverlight.

Microsoft’s Visual Studio LightSwitch: does it have a future?

A recent and thorough piece on Visual Studio LightSwitch prompted a Twitter discussion on what kind of future the product has. Background:

  • LightSwitch is an application generator which builds data-driven applications.
  • A LightSwitch application uses ASP.NET on the server and Silverlight on the client.
  • LightSwitch applications can be deployed to Windows Azure
  • LightSwitch apps can either be browser-hosted or use Silverlight out of browser for the desktop
  • LightSwitch is model-driven so in principle it could generate other kinds of client, such as HTML5 or Windows 8 Metro.
  • LightSwitch first appeared last year, and has been updated for Visual Studio 11, now in beta.

I have looked at LightSwitch in some detail, including a hands-on where I built an application. I have mixed feelings about the product. It was wrongly marketed, as the kind of thing a non-professional could easily pick up to generate an application for their business. In my opinion it is too complex for most such people. The real market is professional developers looking for greater productivity. As a way of building a multi-tier application which does its best to enforce good design principles, LightSwitch is truly impressive; though I also found annoyances like skimpy documentation, and that some things which should have been easy turned out to be difficult. The visual database designer is excellent.

The question now: what kind of future does LightSwitch have? Conceptually, it is a great product and could evolve into something useful, but I question whether Microsoft will stick with it long enough. Here is what counts against it:

  • The decision to generate Silverlight applications now looks wrong. Microsoft is not going to do much more with Silverlight, and is more focused on HTML5 and JavaScript, or Windows Runtime for Metro-style apps in Windows 8 and some future Windows Phone. There is some family resemblance between Windows Runtime and Silverlight, but not necessarily enough to make porting easy.
  • There is no mobile support, not even for Windows Phone 7 which runs Silverlight.
  • I imagine sales have been dismal. The launch product was badly marketed and perplexing to many.

What about the case in favour? Silverlight enthusiast Michael Washington observes that the new Visual Studio 11 version of LightSwitch generates OData feeds on the server, rather than WCF RIA Services. OData is a REST-based service that is suitable for consumption by many different kinds of client. To prove his point, Washington has created demo mobile apps using HTML5 and JQuery – no Silverlight in sight.

image

Pic from here.

Washington also managed to extract this comment from Microsoft’s Steve Hoag on the future of LightSwitch, in an MSDN forum discussion:

LightSwitch is far from dead. Without revealing anything specific I can confirm that the following statements are true:

– There is a commitment for a long term life of this product, with other versions planned

– There is a commitment to explore creation of apps other than Silverlight, although nothing will be announced at this time

Hoag is the documentation lead for LightSwitch.

That said, Microsoft has been known to make such commitments before but later abandon them. Microsoft told me it was committed to cross-platform Silverlight, for example. And it was, for a bit, at least on Windows and Mac; but it is not now. Microsoft was committed to IronRuby and IronPython, once.

For those with even longer memories, I recall a discussion on CompuServe about Visual Basic for DOS. This was the last version of Microsoft Basic for DOS, a fine language in its way, and with a rather good character-based interface builder. Unfortunately it was buggy, and users were desperate for a bug-fix release. Into this discussion appeared a guy from Microsoft, who announced that he was responsible for the forthcoming update to Visual Basic for DOS and asked for the top requests.

Good news – except that there never was an update.

The truth is that with LightSwitch still in beta for Visual Studio 11, it is unlikely that any decision has been made about its future. My guess, and it is only that, is that the Visual Studio 11 version will be little used and that there will be no major update. If I am wrong and it is a big hit, then there will be an update. If I am right about its lack of uptake, but its backing within Microsoft is strong enough, then maybe in Visual Studio 12 or even sooner we will get a version that does it right, with output options for cross-platform HTML5 clients and for Windows Phone and Windows Metro. But do not hold your breath.

ITWriting.com awards 2011: ten key happenings, from Nokia’s burning platform to HP’s nightmare year

2011 felt like a pivotal year in technology. What was pivoting? Well, users are pivoting away from networks and PCs and towards cloud and devices. The obvious loser is Microsoft, which owns PCs and networks but is a distant follower in devices and has mixed prospects in the cloud. Winners include Apple, Google, Amazon, and Android vendors. These trends have been obvious for some time, but in 2011 we saw dramatic evidence of their outcome. As 2011 draws to a close, here is my take on ten happenings, presented as the first ever ITWriting.com annual awards.

1. Most dramatic moment award: Nokia’s burning platform and alliance with Microsoft

In February Nokia’s Stephen Elop announced an alliance with Microsoft and commitment to Windows Phone 7. In October we saw the first results in terms of product: the launch of the Lumia smartphone. It is a lovely phone though with some launch imperfections like too short battery life. We also saw greatly improved marketing, following the dismal original Windows Phone 7 launch a year earlier. Enough? Early indications are not too good. Simply put, most users want iOS or Android, and the app ecosystem, which Elop stated as a primary reason for adoption Windows Phone, is not there yet. Both companies will need to make some smart moves in 2012 to fix these issues, if it is possible. But how much time does Nokia have?

2. Riskiest technology bet: Microsoft unveils Windows 8

In September 2011 Microsoft showed a preview of Windows 8 to developers at its BUILD conference in California. It represents a change of direction for the company, driven by competition from Apple and Android. On the plus side, the new runtime in Windows 8 is superb and this may prove to be the best mobile platform from a developer and technical perspective, though whether it can succeed in the market as a late entrant alongside iOS and Android is an open question. On the minus side, Windows 8 will not drive upgrades in the same way as Windows 7, since the company has chosen to invest mainly in creating a new platform. I expect much debate about the wisdom of this in 2012.

Incidentally, amidst all the debate about Windows 8 and Microsoft generally, it is worth noting that the other Windows 8, the server product, looks like being Microsoft’s best release for years.

3. Best cloud launch: Office 365

June 2011 saw the launch of Office 365, Microsoft’s hosted collaboration platform based on Exchange and SharePoint. It was not altogether new, since it is essentially an upgrade of the older BPOS suite. Microsoft is more obviously committed to this approach now though, and has built a product that has both the features and the price to appeal to a wide range of businesses, who want to move to the cloud but prefer the familiarity of Office and Exchange to the browser-based world of Google Apps. Bad news though for Microsoft partners who make lots of money nursing Small Business Server and the like.

4. Most interesting new cross-platform tool: Embarcadero Delphi for Windows, Mac and iOS

Developers, at least those who have still heard of Embarcadero’s rapid application development tool, were amazed by the new Delphi XE2 which lets you develop for Mac and Apple iOS as well as for Windows. This good news was tempered by the discovery that the tool was seemingly patched together in a bit of a hurry, and that most existing application would need extensive rewriting. Nevertheless, an interesting new entrant in the world of cross-platform mobile tools.

5. Biggest tech surprise: Adobe shifts away from its Flash Platform

image

This one caught me by surprise. In November Adobe announced a shift in its business model away from Flash and away from enterprise development, in favour of HTML5, digital media and digital marketing. It also stated that Flash for mobile would no longer be developed once existing commitments were completed. The shift is not driven by poor financial results, but rather reflects the company’s belief that this will prove a better direction in the new world of cloud and device. Too soon and too sudden? Maybe 2012 will show the impact.

6. Intriguing new battle award: NVIDIA versus Intel as GPU computing catches on

In 2011 NVIDIA announced a number of wins in the supercomputing world as many of these huge machines adopted GPU Computing, and I picked up something of a war of words with Intel over the merits of what NVIDIA calls heterogeneous computing. Intel is right to be worried, in that NVIDIA is seeing a future based on its GPUs combined with ARM CPUs. NVIDIA should worry too though, not only as Intel readies its “Knight’s Corner” MIC (Many Integrated Core) chips, but also as ARM advances its own Mali GPU; there is also strong competition in mobile GPUs from Imagination, used by Apple and others. The GPU wars will be interesting to watch in 2012.

7. Things that got worse award: Spotify. Runners up: Twitter, Google search

Sometimes internet services come along that are so good within their niche that they can only get worse. Spotify is an example, a music player that for a while let you play almost anything almost instantly with its simple, intuitive player. It is still pretty good, but Spotify got worse in 2011, with limited plays on free account, more intrusive ads, and sign-up now requires a Facebook login. Twitter is another example, with URLS now transformed to t.co shortcuts whether you like it not and annoying promoted posts and recommended follows. Both services are desperately trying to build a viable business model on their popularity, so I have some sympathy. I have less sympathy for Google. I am not sure when it started making all its search results into Google links that record your click before redirecting you, but it is both annoying and slow, and I am having another go with Bing as a result.

8. Biggest threat to innovation: Crazy litigation from Lodsys, Microsoft, Apple

There has always been plenty of litigation in the IT world. Apple vs Microsoft regarding graphical user interfaces 1994; Sun vs Microsoft regarding Java in 1997; SCO vs IBM regarding UNIX in 2003; and countless others. However many of us thought that the biggest companies exercised restraint on the grounds that all have significant patent banks and trench warfare over patent breaches helps nobody but lawyers. But what if patent litigation is your business model? The name Lodsys sends a chill though any developer’s spine, since if you have an app that supports in-app purchases you may receive a letter from them, and your best option may be to settle though others disagree. Along with Lodsys and the like, 2011 also brought Microsoft vs several OEMs over Android, Apple vs Samsung over Android, and much more.

9. Most horrible year award: HP

If any company had an Annus Horribilis it was HP. It invested big in WebOS, acquired with Palm; launched the TouchPad in July 2011; announced in August that it was ceasing WebOS development and considering selling off its Personal Systems Group; and fired its CEO Leo Apotheker in September 2011.

10. Product that deserves better award: Microsoft LightSwitch

On reflection maybe this award should go to Silverlight; but it is all part of the same story. Visual Studio LightSwitch, released in July 2011, is a model-driven development tool that generates Silverlight applications. It is nearly brilliant, and does a great job of making it relatively easy to construct business database applications, locally or on Windows Azure, complete with cross-platform Mac and Windows clients, and without having to write much code. Several things are unfortunate though. First, usual version 1.0 problems like poor documentation and odd limitations. Second, it is Silverlight, when Microsoft has made it clear that its future focus is HTML 5. Third, it is Windows and (with limitations) Mac, at a time when something which addresses the growing interest in mobile devices would be a great deal more interesting. Typical Microsoft own-goal: Windows Phone 7 runs Silverlight, LightSwitch generates Silverlight, but no, your app will not run on Windows Phone 7.  Last year I observed that Microsoft’s track-record on modelling in Visual Studio is to embrace in one release and extinguish in the next. History repeats?

Microsoft releases Visual Studio LightSwitch: a fascinating product with an uncertain future

Microsoft has released Visual Studio LightSwitch, a rapid application builder for data-centric applications.

image

LightSwitch builds Silverlight applications, which may seem strange bearing in mind that the future of Silverlight has been hotly debated since its lack of emphasis at the 2010 Professional Developers Conference. The explanation is either that Silverlight – or some close variant of Silverlight – has a more important future role than has yet been revealed; or that the developer division invented LightSwitch before Microsoft’s strategy shifted.

Either way, note that LightSwitch is a model-driven tool that is inherently well-suited to modification for different output types. If LightSwitch survives to version two, it would not surprise me to see other application targets appear. HTML 5 would make sense, as would Windows Phone.

So LightSwitch generates Silverlight applications, but they do not run on Windows Phone 7 which has Silverlight as its development platform? That is correct, and yes it does seem odd. I will give you the official line on this, which is that LightSwitch is not aimed primarily at developers, but is for business users who run Windows and who want a quick and easy way to build database applications. They will not care or even, supposedly, realise that they are building Silverlight apps.

I do not believe this is the whole story. It seems to me that either LightSwitch is a historical accident that will soon be quietly forgotten; or it is version one of a strategic product that will build multi-tier database applications, where the server is either Azure or on-premise, and the client any Windows device from phone to PC. Silverlight is ideal for this, with its modern presentation language (XAML), its sandboxed security, and its easy deployment. This last point is critical as we move into the app store era.

LightSwitch could be strategic then, or it could be a Microsoft muddle, since the official marketing line is unconvincing. I have spent considerable time with the beta and doubt that the supposed target market will get on with it well. Developers will also have a challenge, since the documentation is, apparently deliberately, incomplete when it comes to writing code. There is no complete reference, just lots of how-to examples that might or might not cover what you wish to achieve.

Nevertheless, there are flashes of brilliance in LightSwitch and I hope, perhaps vainly, that it does not get crushed under Microsoft’s HTML 5 steamroller. I set out some of its interesting features in a post nearly a year ago.

Put aside for a moment concerns about Silverlight and about Microsoft’s marketing strategy. The truth is that Microsoft is doing innovative work with database tools, not only in LightSwitch with its model-driven development but also in the SQL Server database projects and “Juneau” tools coming up for “Denali”, SQL Server 2011, which I covered briefly elsewhere. LightSwitch deserves a close look, even it is not clear yet why you would want actually to use it.

image

Trying out Remote Desktop to a Microsoft Azure virtual machine

I have been trying out Visual Studio LightSwitch, which has an option to deploy apps to Windows Azure.

Of course I wanted to try this,  and after a certain amount of hassle generating certificates and switching between Visual Studio LightSwitch and the Azure management portal I succeeded.

image

I doubt I would have made it without this step by step guide by Andy Kung. The article begins:

One of the many features introduced in Visual Studio LightSwitch Beta 2 is the ability to publish your app directly to Windows Azure with storage in SQL Azure. We have condensed many steps one would typically have to go through to deploy an application to the cloud manually.

Somewhere between 30 and 40 screens later he writes:

The last step shows you a summary of what you’re about to publish. FINALLY! Click Publish.

We just have to imagine how many screens there would have been if Microsoft had not condensed the “many steps”. The result is also not quite right, because it uses self-signed certificates that will present security warnings when you use the app. For a product supposedly aimed at non-developers it is all hopelessly difficult; but I guess techies are used to this kind of thing.

I was not content though. First, I wanted to use an Extra Small instance, and LightSwitch defaults to a Small instance with no obvious way to change it. I cracked that one. You switch the view in Solution Explorer to the File view, then find the file ServiceDefinition.csdef and edit the vmsize attribute:

image

It worked and I had an Extra Small instance.

I was still not satisfied though. I wanted to use Remote Desktop so I could check out the VM Azure had created for me. I could not see any easy way to do this in the LightSwitch project, so I created another Azure project and configured it for Remote Desktop access using the guide on MSDN. More certificate fun, more passwords. I then started to publish the project, but bailed out when it warned me that I was overwriting a previous deployment.

Then I copied the likely looking parts of ServiceDefinition.csdef and ServiceConfiguration.cscfg from the standard Azure project to the LightSwitch project. In ServiceDefinition.csdef that was the Imports section and the Certificates section. In ServiceConfiguration.cscfg it was all the settings starting Microsoft.WindowsAzure.Plugins.Remote…; and again the Certificates section. I think that was it.

It worked. I published the LightSwitch app, went to the Azure management portal, selected the instance, and clicked Connect.

image

What I found was a virtual Quad-Core Opteron with 767MB RAM and running Windows Server 2008 Enterprise SP2. It seems Azure does not use Server 2008 R2 yet – at least, not for Extra Small instances.

image

750MB RAM is less than I would normally consider for Server 2008 – this is Extra Small, remember – but I tried using my simple LightSwitch app and it seemed to cope OK, though memory is definitely tight.

image

This VM is actually not that small in relation to many Linux VMs out there, happily running Apache, PHP, MySQL and numerous web applications. Note that my Azure VM is not running SQL Server; SQL Azure runs on separate servers. I am not 100% sure why Azure does not use Server Core for VMs like this. It may be because server core is usually used in conjunction with GUI tools running remotely, and setting up all the permissions for this to work is a hassle.

I took a look at the Event Viewer. I have never seen a Windows event log without at least a few errors, and I was interested to see if a Microsoft-managed VM would be the first. It was not, though there are a mere 16 “Administrative events” which is pretty good, though the VM has only been running for an hour or so. There were a bunch of boot-start drivers which failed to load:

image

and this, which I would describe as a typical obscure and probably-unimportant-but-who-knows Windows error:

image

The Azure VM is not domain-joined, but is in a workgroup. It is also not activated; I presume it will become activated if I leave it running for more than 14 days.

Internet Explorer is installed but I was unable to browse the web, and attempting to ping out gave me “Request timed out”. Possibly strict firewall rules prevent this. It must be carefully balanced, since applications will need to connect out.

The DNS suffix is reddog.microsoft.com – a remnant of the Red Dog code name which was originally used for Azure.

As I understand it, the main purpose of remote desktop access is for troubleshooting, not so that you can install all sorts of extra stuff on your VM. But what if you did install all sorts of extra stuff? It would not be a good idea, since – again as I understand it – the VM could be zapped by Azure at any time, and replaced with a new one that had reverted to the original configuration. You are not meant to keep any data that matters on the VM itself; that is what the Azure storage services are for.

Hands On with Visual Studio LightSwitch – but what is it for?

Visual Studio LightSwitch, currently in public beta, is Microsoft’s most intriguing development tool for years. It is, I think, widely misunderstood, or not understood; but there is some brilliant work lurking underneath it. That does not mean it will succeed. The difficulty Microsoft is having in positioning it, together with inevitable version one limitations, may mean that it never receives the attention it deserves.

Let’s start with what Microsoft says LightSwitch is all about. Here is a slide from its Beta 2 presentation to the press:

image

Get the idea? This is development for the rest of us, "a simple tool to solve their problems” as another slide puts it.

OK, so it is an application builder, where the focus is on forms over data. That makes me think of Access and Excel, or going beyond Microsoft, FileMaker. This being 2011 though, the emphasis is not so much on single user or even networked Windows apps, but rather on rich internet clients backed by internet-hosted services. With this in mind, LightSwitch builds three-tier applications with database and server tiers hosted on Windows server and IIS, or optionally on Windows Azure, and a client built in Silverlight that runs either out of browser on Windows – in which case it gets features like export to Excel – or in-browser as a web application.

There is a significant issue with this approach. There is no mobile client. Although Windows Phone runs Silverlight, LightSwitch does not create Windows Phone applications; and the only mobile that runs Silverlight is Windows Phone.

LightSwitch apps should run on a Mac with Silverlight installed, though Microsoft never seems to mention this. It is presented as a tool for Windows. On the Mac, desktop applications will not be able to export to Excel since this is a Windows-only capability in Silverlight.

Silverlight MVP Michael Washington has figured out how to make a standard ASP.NET web application that accesses a LightSwitch back end. I think this should have been an option from the beginning.

I digress though. I decided to have a go with LightSwitch to see if I can work out how the supposed target market is likely to get on with it. The project I set myself was a an index of magazine articles; you may recognize some of the names. With LightSwitch you are insulated from the complexities of data connections and can just get on with defining data. Behind the scenes it is SQL Server. I created tables for Articles, Authors and Magazines, where magazines are composed of articles, and each article has an author.

The LightSwitch data designer is brilliant. It has common-sense data types and an easy relationship builder. I created my three tables and set the relationships.

image

Then I created a screen for entering articles. When you add a screen you have to say what kind of screen you want:

image

I chose an Editable Grid Screen for my three tables. LightSwitch is smart about including fields from related tables. So my Articles grid automatically included columns for Author and for Magazine. I did notice that the the author column only showed the firstname of the author – not good. I discovered how to fix it. Go into the Authors table definition, create a new calculated field called FullName, click Edit Method, and write some code:

partial void FullName_Compute(ref string result)
{
    // Set result to the desired field value
   result = this.Firstname + " " + this.Lastname;

}

Then you set FullName as the “Summary” field for the table.

Have we lost our non-developer developer? I don’t think so, this is easier than a formula in Excel once you work out the steps. I was interested to see the result variable in the generated code; echoes of Delphi and Object Pascal.

I did discover though that my app has a usability problem. In LightSwitch, the user interface is generated for you. Each screen becomes a Task in a menu on the left, and double-clicking opens it. The screen layout is also generated for you. My problem: when I tried entering a new article, I had to specify the Author from a drop-down list. If the author did not yet exist, I had to open an Authors editable grid, enter the new author, save it, then go back to the Articles grid to select the new author.

I set myself the task of creating a more user-friendly screen for new articles. It took me a while to figure out how, because the documentation does not seen to cover my requirement, but after some help from LightSwitch experts I arrived at a solution.

First, I created a New Data Screen based on the Article table. Then I clicked Add Data Item and selected a local property of type Author, which I called propAuthor.

image

Next, I added two groups to the screen designer. Screen designs in LightSwitch are not like any screen designs you have seen before. They are a hierarchical list of elements, with properties that affect their appearance. I added two new groups, Group Button and GroupAuthor, and set GroupAuthor to be invisible. Then I dragged fields from propAuthor into the Author group. Then I added two buttons, one called NewAuthor and one called SaveAuthor. Here is the dialog for adding a button:

image

and here is my screen design:

image

So the idea is that when I enter a new article, I can select the author from a drop down list; but if the author does not exist, I click New Author, enter the author details, and click Save. Nicer than having to navigate to a new screen.

In order to complete this I have to write some more code. Here is the code for NewAuthor:

partial void NewAuthor_Execute()
{
     // Write your code here.
     this.propAuthor = new Author();
     this.FindControl("GroupAuthor").IsVisible = true;
}

Note the use of FindControl. I am not sure if there is an easier way, but for some reason the group control does not show up as a property of the screen.

Here is the code for SaveAuthor:

partial void SaveAuthor_Execute()
{
    // Write your code here.
    this.ArticleProperty.Author = propAuthor;
    this.Save();
}

image

This works perfectly. When I click Save Author, the new author is added to the article, and both are saved. Admittedly the screen layout leaves something to be desired; when I have worked out what Weighted Row Height is all about I will try and improve it.

image

Before I finish, I must mention the LightSwitch Publish Wizard, which is clearly the result of a lot of work on Microsoft’s part. First, you choose between a desktop or web application. Next you choose an option for where the services are hosted, which can be local, or on an IIS server, or on Windows Azure.

image

Something I like very much: when you deploy, there is an option to create a new database, but to export the data you have already entered while creating the app. Thoughtful.

image

As you can see from the screens, LightSwitch handles security and access control as well as data management.

What do I think of LightSwitch after this brief exercise? Well, I am impressed by the way it abstracts difficult things. Considered as an easy to use tool for model-driven development, it is excellent.

At the same time, I found it frustrating and sometimes obscure. The local property concept is a critical one if you want to build an application that goes beyond what is generated automatically, but the documentation does not make this clear. I also have not yet found a guide or reference to writing code, which would tell me whether my use of FindControl was sensible or not.

The generated applications are functional rather than beautiful, and the screen layout designer is far from intuitive.

How is the target non-developer developer going to get on with this? I think they will retreat back to the safety of Access or FileMaker in no time. The product this reminds me of more is FoxPro, which was mainly used by professionals.

Making sense of LightSwitch

So what is LightSwitch all about? I think this is a bold effort to create a Visual Basic for Azure, an easy to use tool that would bring multi-tier, cloud-hosted development to a wide group of developers. It could even fit in with the yet-to-be-unveiled app store and Appx application model for Windows 8. But it is the Visual Basic or FoxPro type of developer which Microsoft should be targeting, not professionals in other domains who need to knock together a database app in their spare time.

There are lots of good things here, such as the visual database designer, the Publish Application wizard, and the whole model-driven approach. I suspect though that confused marketing, the Silverlight dependency, and the initial strangeness of the whole package, will combine to make it a hard sell for Microsoft. I would like to be wrong though, as a LightSwitch version 2 which generates HTML 5 instead of Silverlight could be really interesting.

Silverlight in Microsoft products – Silverlight the new Windows runtime, HTML 5 the new Silverlight?

Is Microsoft ditching Silverlight and embracing HTML 5? Or is Silverlight the future of desktop and browser-based development on Microsoft’s platform?

Good question; and I am not sure that Microsoft itself can answer. There is evidence for both cases.

One thing I have noticed though is that Silverlight is turning up in numerous Microsoft products. This is in contrast to the early years of the original .NET Framework, which Microsoft used rather little in its own stuff, though the context is different today because of the growth in web-based development.

I guess we cannot really count Visual Studio LightSwitch, which is a tool that builds Silverlight applications, though it is interesting insofar as the target market is not expert developers, but smart general users who want to build database applications.

Lync Server 2010 is a better example. Silverlight is used for the control panel.

image

Windows Azure, a strategic product for Microsoft, uses Silverlight for its control panel

image

Windows Intune, for maintaining networks online

image

System Center for managing Microsoft servers. I’m not actually sure how much Silverlight is used in System Center, but I understand the newly announced “Concero”, a new feature for managing public and private clouds, uses a Silverlight control panel and I suspect it is used elsewhere as well.

image

These are a few that I am aware of; I would be interested in other examples.

Now, you can make sense of this to some extent by distinguishing “Windows platform” from “broad reach” applications. It is curious, but Silverlight which started out as a broad reach plugin is gradually moving towards a Windows platform runtime, though it still runs on a Mac with some limitations, mainly lack of COM interop. There has been speculation that Silverlight could merge with the desktop Windows Presentation Foundation and become a commonly used application runtime for desktop Windows as well as web apps, and of course Windows Phone.

When Microsoft wants broad reach, it uses HTML, an example being Office Web Apps which make hardly any use of Silverlight.

Nevertheless, using Silverlight for products like Windows Intune could be annoying for administrators who might otherwise use an Apple iPad when out and about; but I guess Microsoft figures that if you are deep enough into Windows to use Intune, you probably will not be using an iPad.

Let me add that Silverlight seems to me to be working well in the examples above, to the extent that I have tried it. Could they be done equally well in HTML and JavaScript? Probably, if users have IE9, but probably not if it is IE8 or earlier.

Silverlight the new Windows, HTML 5 the new Silverlight?