Home > Uncategorized > VS LightSwitch

VS LightSwitch


Starters

Ok, here we go…  New product from Microsoft.  Uncharted waters…  OK, downloaded the product fired the install up and NOTHING…  Ok maybe the install didn’t go right.  Re-ran the install.  Then while that was happening watched the introduction video on MS.  That turned out to be just a marketing video and a waste of time.  The Time Tracker starter kit was more what I was looking for.

Now I see what happened… somehow I missed a step or two on the install.  This time it is asking for a system restart.  That was a change from the first time around.  Plus this time it is taking more time. 

With a High Speed internet connection it took about 30 minutes to install.  It did fail on the compact SQL server install.  Probably because I already have the full blown development environment going.  I doubt that will be a show stopper but we’ll see…

It’s installed but at first glance…

image

Not under Visual Studio…

image

Not on the start menu at all…

So, I fires up VS and sees what I can see..

image

And there it is…which probably means I didn’t look hard enough the first time.  But I was expecting a more obvious path to LightSwitch not something buried under VS2010 and .Net Framework 4.  Seems to me, that if the only option is Framework 4 then the IDE should know that already so when you click on LightSwitch you are not presented with this view:

image

 

Why LightSwitch?

Why not something like Access?  A full blown .net app?  Sure, both will do the trick.  Typically, in this instance, Access probably would have been my first choice.  What instance?  Why the instance that I’m using to model this article on.  It’s a small application that will be used by a handful of users.  More on that later…  Decisions that go into “what development platform?” are important.  Here’s my approach to determines how big or robust of an application platform to use.

  • Primary need/use of the application
  • Anticipated term of service
  • Complexity of the application
  • Scope of user base and ability of user base
  • Data structure and data tool set

I’m sure you could come up with a fancy acronym but that’s not important. 

Primary need / use

This is the driving force isn’t it?  Why does the customer need the app?  What is the application going to be used for?  Usually some where in this mix is the unstated question, how soon is the application needed?  Maybe this is stated as a requirement but the time frame really addresses need.  The need determines the use.

Lets face it,  since time is a driver for need, the shorter the timeframe the greater the need.  Time is a great size limiter.  A formula I like:  resource/(size * application complexity) = completion ratio.  The fewer resources on board for the project, the less size and complexity the project can have in order to make the target date.  Here’s where need comes in.  The greater the need, the more critical the target date.  Before the complexity of the application can be determined, the term of service needs to be weighed in.

It’s a fast fast fast fast world…

Things change quickly and new tools come on line all the time.  Old tools get revamped.  So, what does this have to do with platform choice? Need/Use aside, if the application has an anticipated long term but performs simple functions, then going with a light touch development platform makes sense.  So now you’ve got a little bit more about this project.  It’s small, fairly static in purpose and will be used frequently but there is not a lot of expected new feature requests in the pipeline. 

This has always been the niche that code generators have filled.  Access has templates and (New and Improved) macros.  Other RAD tool providers have their own reduced instruction code short hand and drag and drop design.  Gartner, the prognosticators of all, even forecasted that model driven architecture was the wave of the future.  All of this argued against by the appdevs whose very livelihood is challenged by this trend.  Huh?  What?  Ok, this was just a quick side trip down why a developer may state firmly that any code generator is limited, clunky and hard to work with (hear that Microsoft, the cards are stacked).  While that statement may be true, there is a place for the code generators of the world and that place (IMHO) is becoming stronger with better technology.

Enter LightSwitch. A simple (so the marketing claims) tool for RAD (rapid application development). 

For this project;

  • term of service is long
  • complexity is low
  • primary need and use of the application fall into the “sooner the better” category (you’ll just have to go with this last assumption). 

Complexity

That’s the tough one isn’t?  Complexity in terms of the problem to solve or complexity in actually writing the code?  Part of this is art or crystal ball – depending on your point of view.  In general, code generators(CGs) do not do complex well.  My guess is that VS LightSwitch, no matter how advanced still falls into this restriction.  While CGs may not do complexity they do straight forward data apps exceedingly well.  As I evaluate LightSwitch the Complex-o-meter may change but I’ve yet to run across a MDA tool that does complex well but remains straight forward to use.  It is the complexity that gets built into the tool to handle complex problems that defeats the purpose of code generation.  At some point, you reach the tipping point that turns the CG from a super or advanced user tool to one that a developer needs to manage.  So, mentioned above, for this project the complexity is low.  What does that mean?

  • Single purpose tool
  • Data entry of a small set of data fields in a single database
  • Single user need – no sophisticated record locking required for edit mode

As I said, simple tool and perfect for testing out LightSwitch.  Top it off, this will be used against a production instance and managed by a non-dev type user.

Scope of user base / ability of user base

Hand off and knowledge transfer.  This is the key performance indicator any consultant is measured by (like the BI reference?).  Being able to not only hand off the application but do it in such a way that the non-developer can manage maintenance tasks is a good thing.  Sure, there are those who write code in such an obfuscated way that end user maintenance is not possible, IMHO, that is not a good way to do business.  As a developer, I want the complex projects that keep me going for months.  I’m happy to educate the user base on the small projects that allow small businesses to compete with out having to take out a loan for development work.  Again, complexity plays a critical role in determining how much to hand off.  If the user has basic computer skills and familiar with tools like Access and Excel, it’s hopeful that LightSwitch(LS) will also be within their comfort zone.  For the project I’ve have in mind, the target user fits the profile of tech savy and appreciates many of the advanced feature of Access and Excel so it is my hope that once the initial LS application is complete, it’s hands off.

Data structure and Tool Set

Hopefully the database your tool will have to utilize is already structured in a way that is suitable for the application you have in mind.  In the case of the project I’ll be using LS on, the database is normalized and is based in SQL 2005.  In many cases you’ll be going against an SQL Express database, Azure SQL,  or perhaps MySQL or Progress.  Hopefully, you understand enough about your target database platforms to get the right connectors.  I’m making the SWAG assumption that since LS is Microsoft that the plumbing is in place for SQL 2005.  A bit more on data.  The more “unique” the data structure the harder it is to write good data access code or Create Update Read and Delete (CRUD).  For the application on tap, all four members need to be supported.

Enough Back Ground!  On to the application and LightSwitch…

Step 1 – Create the project

image

Step 2 – Start with data – attach to an external is the method here…

image

Step 3 – choose database as the data source

image

Step 4- Set up the connection.  Using a specific account

SNAGHTML657198

Step 5 – test connection…

SNAGHTML692914

Step 6 – Choose the objects to work with

SNAGHTML6a4589

Step 7 – fix issues

SNAGHTML6c1008

Because there is a need to update/modify data, the warning and status being changed to read-only will not work.  In this case, the table will need to be changed and a primary key added.

Step 8 – add primary key

image

This was fortunate, the column that contained the IDX field was already set up to be the primary key.  It was a simple change.  Sometimes, you have to add a new column to support this.

“Back” was clicked after the change was made and LS was able to move forward.

LS – version of the “Office Table”

image

Visual Studio’s Solution Explorer

SNAGHTML721ea9

Ok, so far so good, in 8 simple steps the new application base has been completed.  Now Confucius say’s…”Now What?”

There are some interesting things up on the bar:

image

Screen – a wizard is my guess… here goes…

Step 1 – Screen Wizard opening screen

SNAGHTML7726c4

Step 2 – customizing for the application

image

On one of the requirement for this application is the ability to edit the office attributes.  So, going with the “Wizard” available types and sticking to a no-code mode, the Editable Grid Screen seems like the right choice.  The “Fancy Drop Down Box” allows you to specify the record source (table).

Clicking on OK gives me…

image

So, what happens when I click on Run?

image

I get a functioning edit screen…

image

While this would work, not exactly the look and feel I want…but when I showed it to the end users, they loved it just the way it was.

While demo’ing the application, I showed them LS and created the second form.

One meeting, ten minutes, and the app was done.

Advertisements
Categories: Uncategorized
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: