This blog has, IMO, some great resources. Unfortunately, some of those resources are becoming less relevant. I'm still blogging, learning tech and helping others...please find me at my new home on http://www.jameschambers.com/.

Thursday, December 24, 2009

Visual Studio 2010 Wishlist

It’s Christmas and so here’s a short list of things that I am asking Santa to bring me for Christmas (or in the March CTP) for the next build of Visual Studio 2010.

More Collapsible Regions

I would think this one would be easy enough because there is an implementation built in at a higher level.  Let’s also have the ability to collapse whiles, ifs, foreaches, switches and the like.

Collapsible Selections

I would like to be able to highlight a block of code and have that highlight turn into a collapsible region.  We are given collapsibles on certain blocks of functionality (methods, classes, comment regions) and if my first wish is granted than on other constructs as well, but not on selections.

While this is good:

image

…allowing me to collapse this would be even better:

image

…and by putting a image in the margin the team should be able to use the existing functionality they’ve implemented.

Intelligent Collapsible Regions – With Style!

Okay, so what if we could get those selections and regions collapsed?  We’d also like a way to preview those hidden bits, right?

Thankfully the editor is written in WPF now, so this shouldn’t be much more work than creating adorners for the collapsed hints.

And while they’re already doing it to some level (hover over the ellipses on a collapsed region) it is grey, without syntax highlighting and in a non-fixed-width font.  Let’s jazz it up.  In fact, let’s have two views: the first would reveal comments in the /// style and then an expander would animate open to reveal a little code browser.

There has got to be an intern working on the IDE team that could use a project like this as a learning experience ;o)

Code Browsing

Since we’re talking browsing, let’s hit my last item on the list for today: an alternative way to browse code.

If you don’t write them yourself, you likely work with someone who does: long code files.  I have a big monitor, so I am able to fit about 55 lines of code onscreen at a time.  But many of the classes I work in are 200+ lines of code (especially any DAL work). 

Other scenarios where traditional code browsing techniques break down are in tool-generated code.  When you’re looking through a LINQ to SQL generated class there can be literally thousands of lines of code.

Getting your head around ‘where’ you are in the file is not easy to do.

But what if you had a thumbnail view of the code?  That thumbnail could have highlighting for keys that you select in the legend. As you hover over the miniature version of the class, you get tooltips that reveal method names or a preview of a comment.  Clicking on the ‘map’ would take you to that place in your code.

There are about 100 different things you could implement in that, some of which would even be useful.

Or a Lump of Coal

image Visual Studio 2010 (I’m on Beta 2 as I write this) is loaded with treats and it runs fast…and the IDE team has already promised better performance in the next build we see.  If all I got for Christmas (even if it was a late gift) was a release copy of VS2010 I’d be a happy kid.

The .NET Framework 4.0 is a game-changer, and you’ll need Visual Studio 2010 to get in the game.  As the various parts of IDE continue to evolve, things like browsing code or manipulating the view of your code will become more and more integrated with your flow of development.

And when you see the above features show up, you can send me a Christmas Card. ;o)

Merry Christmas to everyone.  May you be blessed with the Joy, Peace, Love and Hope that this season was intended to bring.

Wednesday, December 23, 2009

Getting Started with Workflow Foundation 4.0

I am working in Visual Studio 2010 Beta 2 with Windows Workflow Foundation 4.0.  Generally speaking, it is a little easier to get around, the designer is more straightforward, the samples are fairly complete but documentation is lacking in some areas.

There is also very little by way of best practices, and I haven’t fully explored the pros/cons of the samples that Microsoft has put forward, but I am working through them and trying to get my head around this space.

Here are some sites that can help you get started:

WCF and WF Samples for .NET Framework 4.0 Beta 2

MSDN Discussion Forums for Workflow Foundation Beta 2

The Problem Solver blog on persistence and other things WF

I highly recommend the samples if you’re interested in WF; if you’re running Visual Studio 2010 they all load/compile relatively easily and some of the examples are fairly comprehensive.

As a tip, make sure you compile the application prior to loading the WF designers in the samples.  I have crashed VS.NET’s designer and hung the IDE once so far by trying to drill in prior to compilation.

Monday, December 21, 2009

A Really Useful Search

Raven’s web-based administration and CRM module got a big upgrade in its search capabilities with last Friday’s build.  For reasons of simplicity and time-to-integrate, the first builds’ search capabilities were based off the legacy application’s model of defaulting to a customer name search and using a combo box to change what you’re searching “against”.

Searching for Business Return

The first implementation wasn’t without its smarts, however; I built in some metrics to determine what users were actually searching on and discovered that last name searches were only used about 10% of the time, and of all the fields used to search against (27), there are really only 8 things people use to find customers (and Account Number would have been a better default).

I took those results and went to speak with the users about their search experience.  It turns out that most of these search techniques were learned because of how they found customers in the legacy system.  Depending on what you were going to search for, you could be as many as 8 clicks away from a customer record in that app, so they have even mentally trained themselves to pattern searches in the easiest way the software works, not necessarily what they have for information at hand.

Also, for the most part, there was a common problem with how they searched for things and where they had to go to do so.  Rather than focusing on the task the user would try to execute on a daily basis, the software was organized into groups of data that were related on the database.  The search for customer was in a different spot than the search for a tower.  Could you imagine if Google had a different page for each search topic?  Beyond that, the summary information returned from the search was only useful to confirm the result was what the user was looking for; users had to drill into multiple results and then back out if they didn’t find what they were looking for.

Goals for Improving Enterprise Search

There were three major things I wanted to accomplish:

  1. Infer the search type based on the user’s input.
  2. Increase the relevancy of the information returned.
  3. Provide search access from anywhere in the application.

I’ll start with three.  It was the last thing on the stack.  ;o)

I took a bit of a shortcut on number three and have spent the least amount of time on it, but it is still an improvement over the legacy system.  All I’ve done here to-date is incorporate a dashboard system and an easy way to get back to the dashboard from anywhere in the system.  At the top of the dashboard is the search bar, which has focus on page load.  Users are now two clicks away from seeing their search results from anywhere in the application.

Popping off the stack, we’ll discuss number two next: search result summary.  I have to admit on this one I’ve taken a bit of a cue from the major search engines.  You know how if Bing thinks you’re looking for videos, it will show you a few videos?  Or if you search for something that seems like an image on the main Google search, it will show you a few image results?  Well, I took a bit of that approach.  If a user is searching for a tower, they don’t need to see a phone number or street address, they want to see number of customers on that tower, and the status of that tower.  Likewise, if they are searching for a customer, there are certain pieces of information that are more relevant to the user. 

I even took that one step further, because the role of the user influences the styling and information contained in the search result.  For example, an account manager is likely looking for contact information and contract details, whereas a help desk technician is looking for recent tickets and the current status of a customer’s connection.

That accomplished, I needed to tackle number one on the list: inferred search type.

This turned out to be a lot easier than I was expecting.  I have written a series of regex expressions to identify the kind of search a user is performing and compiled them to a DLL.  I pass the search string into a method which returns the appropriate search provider and takes care of building queries, LINQ to SQL or calls to stored procs (depending on the system I am accessing).

To tie one and two together, I use the search provider to return a function mapped back to a controller, which then executes the appropriate build and bind sequence for the result list.  This is done through AJAX/jQuery and the MVC framework.

Acceptance?

It’s different.  It isn’t what people have been using for the last eight years, so I expect some friction. But a big positive is that everyone agrees it’s faster and I’m getting all kinds of suggestions for things to add, which means they’re using it (and are interested enough to see it move forward)!

For the time being, the legacy application is still the workhorse in the enterprise, but I’ve now created a bridge from Raven into that system.  What users have now is the ability to search much more quickly and then use the bridge to link into the old system, hopefully that doesn’t prove to be a pain and over the long term it helps the users transition into Raven.

Friday, December 18, 2009

Easy Fix for Visual Studio 2010 Beta 1 Uninstall Problems

I had downloaded and installed Visual Studio 2010 and I’m pretty sure I do so via the web installer from MSDN Subscriber downloads.

As you can expect with beta software, it’s likely that there will be crumbs left all over the place while a vendor works out the kinks in the deployment/installation experience.

I had one laptop left that I hadn’t updated at home, and so moving to Visual Studio Beta 2 was tonight’s project.

Insert Disk to Continue

The uninstaller was looking for the EXE used to install “Microsoft Team Foundation Server 2010 Beta 1 Object Model”. Of course, if I used the web installer – which I think I did – I never would have had a disk.

On a different, unrelated issue, I found uninstall instructions for Visual Studio 2010 Beta 1 here.

I actually started the first step, fired up my screen cap to show that it was indeed working, and before the snipping tool kicked in the uninstall was actually complete.

So, here’s a gratuitous shot of the snipping tool in Windows 7:

image

If you didn’t uninstall the TFS Components first, you would have seen them in this list:

image

There are quite a few posts and random tidbits about machines becoming unstable with botched VS 2010 uninstalls.  I’m glad I ran into a snag before I got myself into trouble.

UPDATE: If you’re interested, the order of instructions worked flawlessly and Beta 2 is now getting installed.

Visual Studio 2010 Release Date Delayed

I think this is a really good call by the folks at Microsoft.  There was a huge jump in performance from Beta 1 to Beta 2, which I think allowed people to believe their feedback was being heard, thus making them comfortable giving more feedback.

The releases are here:

http://weblogs.asp.net/scottgu/archive/2009/12/17/visual-studio-2010-and-net-4-0-update.aspx

http://blogs.msdn.com/somasegar/archive/2009/12/17/visual-studio-2010-and-net-framework-4-beta-period-extended.aspx

Feedback Loop

As someone who has been actively participating in the Visual Studio 2010 Beta cycle, I can certainly vouch for their comments about listening to the users.

When I pushed a performance issue to a Microsoft-er, he wrangled in two other folks to help figure out where the problem would be.  We went back and forth for two weeks to identify and rule out some issues, then they got me to do a couple of performance profiles and send them in via secure upload site.

By the end of the process there were seven or eight Microsoft employees participating in the email chain and recommending different configuration settings, suggesting workarounds and requesting information about usage on the product.

A Different Microsoft

I entered my career in the development world as a snot-nosed teen, lovin’ Torvalds and putting the big hate on for “Micro$oft”.  I started to tinker with the first bits released for .Net and quickly got hooked. 

I understood and believed many of the criticisms of Microsoft in the 90’s, but the company has changed.  The way that they responded to my performance concerns in Visual Studio 2010 shows a level of commitment that I have not seen with anyone I pay money too; not my vehicle manufacturer, not the builder of my house, not any of my household appliances.  Call Apple and ask them to fix something on your iPod and see how far you get.

If you complain about the things you don’t like about Microsoft and you haven’t given them a chance to fix them, you have to drop the chip on your shoulder and get involved in the beta cycles.  I’m using VS2010 daily, sending emails, participating in forums, submitting feedback and blogging about things I’d like to see. 

Heck, I’m a programmer and Visual Studio 2010 was my idea.

;o)

Wednesday, December 16, 2009

VS 2010 – Validation Warnings in ASP.NET

I was getting a whole host of errors on even the simplest of web pages or components (aspx or ascx) in Visual Studio 2010 Beta 2.

Validation (): Element 'content' is not supported.

…or…

Validation ($SCHEMA$): Element 'div' is not supported.

…and others.  Basically, all ASP.NET controls and all HTML tags were not validating.  Here’s a shot from a simple page with about 30 controls on it:

image

The Perils of First Place

It turns out that there was a bug with the user settings from earlier betas of Visual Studio 2010.  When you are an early adopter you sometimes have to eat the weird situations of non-workingness.  Removing the older IDE would leave behind some zombies that attacked the recognition abilities of Beta 2, thus generating loads of validation warnings.

The webdevtools folks published an article on this which helps.  They don’t mention the zombies, but I’m pretty sure they are there.

To get around the problem, simply run Tools –> Import and Export Settings and reset everything.  Unless you are particularly attached to something in your user settings don’t bother saving what you currently have.  It takes a few moments to reset the IDE…image

…and then you’re done.

image

Project Pinning in Visual Studio 2010

Visual Studio has in the past allowed us to set how many projects are displayed when we have a view of recent work.  In Visual Studio 2010, that feature is extended further with the ability to “pin” frequently used projects to our list.

The recent projects list is displayed in the Visual Studio start page, if you have that option turned on (it is by default.  If you have turned it off, you can restore the start page by navigating to Tools –> Options and then to the Environment –> Startup property page.

image

You get the thumbtack icon when you hover over a project item.  Click it to have it stick around. Below is hover state of an unpinned item.

image

Also, in the flavour of ‘handy’ is the ability to control how many items appear in the Recent Projects list.  I mentioned this earlier so here’s how to do that.  Above I have 6 showing, which is set under Tools –> Options in the Environment –> General property page.

image

I am fortunate enough to have a good sized monitor, so I like the ability to fill the white space on the Start Page with about a dozen or so recent projects. 

This Ain’t Your Daddy’s IDE

But then, chances are, there are few of us with Daddies who had IDEs.  But, I digress…

I’m using Visual Studio 2010 about 80% of the time right now, but still hanging on to 2008 for a couple of projects that aren’t playing nicely.  With simple, trivial but yet productive time-saving features like this and others, it’s been the easiest switch of IDEs for this 12 year vet to the industry.

Here are some other suggestions I had, including my first mention of Project Pinning.

Tuesday, December 15, 2009

Google Gets Naked

Google has made a refreshing change to their start page: they took everything away except for search.

image

That’s all you see when you hit http://www.google.com, there are no links to news, images, email or your account.  Nothing, that is, until you move your mouse.

Is Less More?

I was immediately taken by the simplicity of the page, which is a stark contrast to the factoid-a-day implementation of Bing:

image

Bing’s front page is often an inspiring, if not productivity killing, start to your search experience and gives you something new and worldly to learn each day.

Change (Un?)Apparent

The new Google start page sure feels clean.  I don’t know if that’s better, but it is different and eye-catching in its simplicity. 

It is also short-lived, as moving your mouse fades in the same-old burdened UI that continues to grow as Google crams more features in.  On one hand it looks like they’ve nailed something and made it fresh, on the other they missed a chance to push a new UI. 

Either way it’s showing that two leading companies have a very different take on what user experience should be.

Now I’ve Heard of Vendors Not Playing Nicely Together…

…but this is ridiculous!

This is what happens to a can of Pepsi if you put it in a portable Coke refrigerator:

image

The Pepsi can exploded behind me in my office.  It blew the door open on the fridge and sprayed all over the contents of the cooler, the latch mechanism and the into the seals.  The carpet had nearly a full can of Pespi soaked into it in about 2 seconds.  The fridge door is now quite hard to open, even after repeated washings.  I even used soap.

Embarrassingly enough, I nearly ended up flat on my back on the floor.  I was startled (it was a lot louder than you would think) and I nearly rolled off the exercise ball I use as a chair.

What made the Coca-Cola refrigerator detonate a can of Pepsi? Was it malicious anti-competitive measures?

Well, that would certainly be a more interesting story. Sadly there is no blue versus red to report here.  But do heed my experience-born advice: when using a portable refrigerator and storing carbonated beverages, ensure the operating switch on the back is set to “Cool” and not “Heat”.

Unless, of course, you are trying to blow the door off with an exploding can of boiling Pepsi.

Thursday, December 10, 2009

Troubleshooting AJAX Pages in ASP.NET MVC

Drubbing through some work this morning I came across an error while trying to implement some AJAX on an ASP.NET MVC web page.

Microsoft JScript runtime error: 'Sys' is undefined

I had added my script references with absolute paths to the Site.Master page, so I thought I had my basis covered.  To confuse things further, I would get the error message hit ‘Ignore’ and then the expected result would be rendered on a new page.

Defining ‘Sys’

Unfortunately I was barking up the wrong tree when I was trying to Bing an answer up.  The error message, while absolutely true, didn’t actually reveal the root of the problem.

Searching for this error message ends up with pages of early AJAX builds, people talking about pre-release software and links to ScottGu’s blog on how to remove preview versions of Microsoft’s AJAX libraries.

I’m working in Visual Studio 2010 Beta 2, and have other pages running AJAX just fine, so I was pretty sure I had no compatibility issues with earlier versions of AJAX libraries.

What I Missed

I like shortcuts and speed-ups as much as possible.  It turns out that I dragged the JavaScript files into my header, giving me this:

image

Note that the above code actually isn’t a problem.  But I have a nasty habit of switching everything to absolute paths, so I did this (notice the ~):

image

…which of course would be fine if there was something that was actually processing the path.  Unfortunately I got this far (and a lot further) without running the page or making AJAX calls, so I put this little tweak out of mind.

The problem, of course, is that the path can’t be resolved for the browser to locate and download the JavaScript file.

Using Absolute Paths for JavaScript src Attributes

The fix is actually quite simple.  If you want to use absolute paths, just take advantage of the fact that the master page is run through the compiler and the path can be resolved quite easily:

image

Other Things That Indicate Path Problems

There is another symptom of not being able to resolve the src file.  If you’re not debugging you won’t get the error messages, but your browser will render the output of the AJAX call as a new page.  You might want to check your script paths if that is the case.

One other give-away is by checking the Solution Explorer while debugging.  The debugger inserts a Script Documents folder at the top of the solution and shows all the loaded documents.

image

If the JavaScript files you anticipate to be there aren’t, this would be a good answer to why you are getting the “'Sys' is undefined” error.

Wednesday, December 9, 2009

Bug, or Implementation Problem?

A problem with implementation might not always be a bug.  I’m not sure which this one falls into, because it’s two competing features that are designed to help, but almost make each other less useful in certain situations.

Box Selection and Multi-Line Editing in Visual Studio 2010

By now, you’ve likely seen Brittany Behrens and teams’ implementation of Box Selection in the VS2010 IDE.  It allows you to modify your selection based on screen real estate (rather than characters and lines) and then edit the selection in intuitive ways.  You can see Brittany’s walkthrough here and my lovin’ it here.

Where it Falls Short

Unfortunately, as rosy as it is, I don’t think it’s yet been fully implemented…or at least it doesn’t go as far as it could.

When working in the HTML editor in Visual Studio 2010, the box selection feature works brilliantly until you try to close tags.  What you end up with is a poorly-formatted HTML document as a result of the multi-line editing feature.

That’s because it butts heads with the auto-complete feature on HTML tags.  If you were trying to get a bunch of anchored list items into an unordered list, for example, the output becomes:

image

As you close the last HTML tag, only the last line item is properly completed, leaving all other lines non-compliant.

Is it a Bug?

I don’t think you can classify this as a bug, however, as it’s just supplemental functionality that is, perhaps, not being used as originally intended.  If, however, multi-line editing is to server more than just code files and classes, and the HTML editor was in-scope for the feature, this could be classified as a defect.

I’ll leave that up to the smarter-folks-than-I on the IDE team.

Thankfully, the workaround is built into the feature ;o)

image All you need to do is reselect the boundary space (between the characters) with box selection, and then complete the tag manually.  Multi-line editing takes over and lets us complete (in the example above) all four lines at once.

Monday, December 7, 2009

Visual Studio 2010 Debugging Tips

I continue to find gems scattered across Microsoft Visual Studio 2010; these ones are from the debugging story in the code editor window and are largely made possible as a result of Microsoft deciding to use WPF as their display engine for the IDE.

Here are a couple of very cool tips to help yourself out while debugging in Visual Studio 2010.

Pinning Watched Variables

You can now hover over a variable or object and pin it to the debug window.  This expands on the idea of watches and puts the data right in the source code editor.  You’ll see the power of this the first time you’re trying to see what’s happening to a set of data or variables through a loop. 

Hit the thumb tack on the right to “pin” the variable.

image

Combine pinning with conditional breakpoints and you have some very powerful scrubbing capabilities.  This is essential in my work as I am eternally sifting through 3500+ rows of data, looking for non-conforming values and objects.

Debug Comments

Once pinned, you can also add comments to your watched variables.  Note that in the left-hand column of the editor there is a corresponding thumb tack (you’ll need that for later use).  There is an expander in the mini tool window for your pinned variable that reveals a comment text box for you. 

image

The comments are persistent from session to session, so the next time you run your code you’ll see what you’ve previously typed.  This is great stuff.

Out-of-Debug Experience

Even better is that those debug comments stick around into your post-debug experience.  When you finish debugging and return to your code editor the thumb tacks hang around.  Hovering over a thumb tack reveals the pinned variable or object and shows the last value displayed in the debug session as well as your comments.

image

This works across source code files and is a real improvement over the tried-and-testing watch window: rather than a slew of watches from across a solution, variable values stay in context to the code you’re reviewing.

Get Good at Debugging

I swear that the single most beneficial thing you can do as a programmer is learn to use your debugger.  This is even more important than test-driven development and writing unit tests.  I have worked with too many “senior” programmers who don’t know how to attach to a running process or how to use breakpoints and watches to help solve logic or transformation problems.

These tips are hopefully an extension to your debugging tool bag.

Thursday, December 3, 2009

Yowsers…Bing Maps is the new Black

The new version of Bing Maps (still in Beta) has been built from the ground up on Silverlight.  They’ve integrated not only the features from the original maps software, but also way better image streaming, smoother scrolling, Photosynths, and…wait, did I just say Photosynths?

Oh yes, I sure did.

image

That’s pretty cool stuff, right there. 

Deep Integration for Developers

Along with the built-in things that are pushing the envelope of what we will expect from mapping software comes this integrated platform that developers can leverage to enhance (or pervert) the mapping experience.

image

There appears to be 16 current applications that are tuned-in to the user’s current view, coming from a variety of application providers.  Some of the applications, such as Twitter Maps by Bing, are actually doing some pretty cool things to leverage streams of data.  I zoomed into Union Square in New York City and began to see tweet indicators, some adorned with plus signs.  When you hover over those tweets, they cleverly expand to reveal via animation that multiple tweets have come from the same location.

image

Also interesting is that you can refine your search to only include tweets about certain keywords, topics or Twitter users.  Hrm…not too far from a dating service and nearly crosses the line to stalking service.

Now, on a tangent, it sort of makes me wonder if we aren’t heading into the age of reverse-Orwellianism. Rather than Big Brother watching where you are, where you go, people are actually broadcasting this information freely and readily to the world?  Weird.  I wonder if they even know they’re doing it…have we become that narcissistic?

Oh wait.  I guess I’m blogging, aren’t I?  Perhaps we are.

</tangent>

Some application developers are “getting it”, too, by providing baked-in examples of how their software works and in which contexts.  So, the travel-oriented web cam application has a list of popular (or selected) web cams and will take you right to the place on the globe where the camera is hosted from.  From there, you see all the other served web cams in the area and can view live images from those.

General Shiny-ness

The features flow together well and when you get into the apps side of Bing (are they called Map-apps?) you can start to see some really interesting convergence.

The animations can be quite smooth, though the experiences are always the same.  For example, when you use the Hotel Finder application when focused on an area, it will zoom out, pan over and zoom back into the next hotel you click on.  This is nice, as it give you a sense of spatial relationship to the two locations.  However, when you do a search in the Bing bar, the locations returned are located by a simple pan animation (and it’s really fast on my PC) so you lose a little of the context to the distance.

I must say, however, that overall this is a very slick products as far as betas go.

Image troubles…

…just switching over to a new web server and having a little difficulty posting images.  Apologies if you’re not seeing images on the blog for the next little while…

Wednesday, December 2, 2009

Coding for Christmas Cheer

Our office has decided this year to take part in the local Christmas Cheer Registry.  Families sign up, requesting a food and goods hamper, and then people or organizations attempt to fill all the needs of the community.  It really is a great cause.

Merry ASP.NET MVC to You

The MVC framework that is now available for ASP.NET is quite powerful.  Last night I was able to create a web-based application for our company where we can input the items, allow our staff to “claim” the items (indicating that they will donate them) and keep track of when the donations have been brought in.

While it’s not by any means fancy, I was able to implement all features in about an hour.  After sending out the email to invite others to participate, we nearly filled the list (and it looks like we’re going to adopt another family!).

image

LINQ to Christmas Chicken

What would otherwise be a chore to imagedevelop was made quite simple with LINQ functionality.   This is an extremely simple data model, with only two tables.  I used an mdf in the App_Data directory rather than a full-blown SQL Server Deployment.

LINQ to SQL starts things off for us nice and easy to give us a simple data access layer.  Because the dbml tools end up generating partial classes, I was able to easily extend the model to add properties to the Donations data.

image

For the purposes of this site, a hamper item is considered ‘claimed’ when a name is assigned to the item.  While there is no Boolean value saved in the database, the model (and subsequently the auto-generated Views) is easily adapted to provide this information at the class level.  Now, I have an easy way to test for claimed or unclaimed hamper items without having to check for nulls.

MVC – Making it Viable for Christmas

…but also known as Model-View-Controller.  It’s one of the oldest recognized patterns but it is also an entirely different direction from the Page-Controller experience we’ve had since the inception of ASP.NET.

Without taking into account the recent addition of Areas in MVC, you can think of the organization in this way: there are three folders, one each for your Models, your Controllers and your Views.  The Models are the objects you are working with.  The Views are what the user looks at.  The Controllers respond to user input, build up the models (or load them) and send them back with the appropriate View.

There will obviously be larger projects in your future, but for ours I knew we’d hit a limit of 8-10 views and therefore just elected to use the default Home controller.  I stripped out account management and opted to use the domain name of the user to simplify even further.  There is no about page and very few management pages.

image Creating the views was almost as simple as creating the LINQ to SQL diagram.  Visual Studio 2010 has integrated some editor tooling that picks up on code cues and prompts you for the magic.

To access the Add View wizard you simply right-click in the code editor for your controller.  The view name is pulled from the controller method where you clicked – in my case, AddDonation was the name of my method – but you can also customize as you feel is appropriate.  For my view I have also asked the wizard to use a template and create a draft of my data class Donation.  The template is driven from my View content selection “Create”, which stubs out a form for new records using the fields from my model.

Christmas Cheer in an Hour

There you have it.  A total of 1 controller, two classes in my model (one of them the DBML, so it was created with the designer), and a combined 10 views – all of which were largely auto-generated – and we’re well on our way to helping out a family for Christmas.  In fact, as I finish this note there are only two items left on the list and almost half of the items have already been brought in.

Though it may be early, this geek wishes you the Merriest of Christmases this year.