News Stay informed about the latest enterprise technology news and product updates.

Q&A: Visual Studio expert on using Silverlight, ASP.NET MVC and XAML

When learning Visual Studio 2010, how do you decide on WPF or Silverlight? When will you have to move from visual editors to actual code, and what challenges might you face with ASP.NET MVC? In this Q&A, author and Microsoft MVP Joe Mayo tackles these topics and discusses some of his favorite VS2010 productivity tools.

When building applications with Visual Designer in Visual Studio 2010 certain things are easier to program in XAML than in the graphical editor, said Joe Mayo, author of Microsoft Visual Studio 2010: A Beginners Guide.

Author of numerous books and a Microsoft MVP, Mayo got involved in .NET in July 2000, when .NET was still a pre-alpha product. He currently owns Mayo Software Consulting Inc., which offers custom software development and specializes in Microsoft .NET technology.

What are some common areas where new Visual Studio users might struggle?
One of the primary areas that new users will struggle with is resolving errors in their code. These errors can occur during compile time or runtime. The user will see errors during compile time because of syntax errors in their code. One of the great features of how Visual Studio integrates with .NET languages -- like C# and VB -- is that it shows you these compile time errors right away, lets you double-click on the error message, and takes you to the line where the error occurs.

Runtime errors are often more difficult to diagnose because they often represent bugs in your code where the program doesn't do what it's supposed to. That's why the entire Chapter 6 in my book is dedicated to debugging. It's important to learn what debugging tools are available to help find and fix problems as quickly as possible. Can you highlight any new and helpful features in the IDE that users might miss?
What is most useful often differs for each individual, but a couple features include improved Intellisense and easier code navigation. It used to be that Intellisense only showed you what identifiers match the first part of a word, but now Intellisense shows all identifiers that contain any part of what you've typed.

Another set of features revolve around the ability to navigate code more efficiently. Call Hierarchy is a feature that lets you traverse easily to methods that are being called or places in the code that are calling the method you're in. This provides an easy way to see what's going on in the code. Another navigation feature is Call To, where you type CTRL + (comma), which pops up a dialog box that lets you type in and navigate to another place in the code. When building user interfaces with Visual Designer, at what point will a user typically need to start diving into XAML code?
The type of applications that the Visual Studio XAML editor is most suitable for are typical line of business applications, where you build two-dimensional forms for normal input and output. The visual designer has improved in Visual Studio 2010, so you don't have to visit the XAML as much as in earlier versions. However, there are a few areas where working with XAML is either much easier or required, including working with resources, building templates, and performing animations.

It depends on the individual, but sometimes when you get done navigating windows, clicking, setting properties and verifying the results, it would have been easier to open the XAML window and just type in a couple tags, values, or attributes and be done. The goal is really to be as productive as possible and it's nice to have the XAML editor in the split-window configuration for these quick tasks. If you're only using Visual Studio and you need to perform an animation, you'll need to go to the XAML to do it. That said, you only want to work in XAML for the simplest animation tasks because it gets complicated quickly. A better tool for animations and sophisticated WPF or Silverlight UI is Microsoft Expression Blend, which is a separate tool and book of its own. How does a developer know whether WPF or Silverlight is the right framework for an application?
The simple answer would be to use WPF for desktop applications and Silverlight for Web applications. However, when you move beyond a beginners perspective of these technologies, you'll see the lines blur somewhat. For example, you can host a WPF application on a Web site and let people download and use it via a technology known as ClickOnce. There is also a way to create a WPF Navigation Application that runs in a browser. Both the ClickOnce and WPF Navigation Application dictate that the user must have .NET on their computers.

While Silverlight is more suited for the Web; all a user needs to do is download a plug-in to their browser (provided the browser and platform supports the plug-in) and the application runs across the Web. However, the lines blur again where Silverlight has an out-of-browser capability, allowing it to run on a user's desktop. Additionally, Silverlight is the primary development technology for Microsoft's newest mobile computing platform, Windows 7 series. What are the major challenges in working with ASP.NET MVC in VS2010?
There's a paradigm shift that comes with working in a pattern-and-conventions-based environment. In many programming environments, we learn to drag and drop components on a user interface and write code where all parts of an application are easily mixed together. Bridging the gap between these two ideas is a different concept for most people.

That said, the primary reason I chose to present MVC as a Web development technology, rather than its more mature Web Forms sibling, is because I believe it is easier to learn. ASP.NET has drag-and-drop, which is very simple. However, as quickly as you get started, you run into difficult problems to solve because the high level of abstraction makes it difficult to solve problems in more sophisticated scenarios. The beauty of MVC is in its cohesiveness in how the Web works, not hiding the fact that you're working with HTTP, URLs, and HTML. If you have a bug in MVC, it's much easier to track down and fix. Once you move past the initial adjustment to a structured pattern provided by MVC, you'll find a solid and powerful technology that enables you to accomplish any task in a very productive manner. Finally, can you highlight a few of your favorite new features in VS2010?
I like that the entire IDE performs better and is more responsive, ASP.NET MVC is included natively and IntelliTrace in conjunction with Microsoft Test Manager 2010 helps reproduce bugs. For more advanced scenarios, Visual Studio also includes a new set of architecture and modeling tools. The architecture tools help to visualize the relationship between parts of your code. The modeling tools support five types of UML diagrams and are quick and easy to use. Considering all of the new features combined with existing tools, I'm pretty happy with what Visual Studio 2010 offers.

Dig Deeper on Visual Studio Tools for Office (VSTO)

Start the conversation

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.