Exam Reviews

70-306: Generation Gap

Visual Studio .NET promises to be more useful than any development platform yet. But be prepared to face some brainteasers along the way.

The developer world is abuzz! In February, after much anticipation and fanfare, Microsoft released the long-awaited Visual Studio .NET to manufacturing, ushering in a new era of development technologies. Since four years had passed since the last Visual Studio release, many of us were hankering for something new. Of course, Microsoft didn’t disappoint.

This suite of development tools is full of toys. It’s supposed to make our lives easier by creating a universal framework that will be preinstalled on all future operating systems released. The .NET framework allows us to write uniform code and have it run on pretty much any Windows-based system. There are even a lot of ways to access non-Microsoft platforms if we need to do so. As always, though, new toys exact a price.

True enough, Visual Studio .NET lowers the complexity of many things that just couldn’t easily be done before (especially for Web developers). With that advantage comes a large learning curve, especially if you only have Visual Basic experience and aren’t used to a true object-oriented programming language. Yes, you heard me correctly; Visual Basic is now a fully object-oriented language. And that just scratches the surface.

Visual Basic .NET

Reviewer’s Rating
“If you’re a whiz at all aspects of VB .NET Windows development from coding to deployment, this one’s an ace up the sleeve.”

Exam Title
70-306: Developing and Implementing Windows-based Applications with Microsoft Visual Basic .NET and Microsoft Visual Studio .NET

Current Status
Beta in April of 2002, Live version expected in June.

Who Should Take It
Core or elective credit for MCAD. Core credit for MCSD.

What Courses Prepare You
2145: Programming the Microsoft .NET Framework with Visual Basic .NET
2565: Developing Microsoft .NET Applications for Windows (Visual Basic .NET)

With the new development tools, Microsoft is definitely proclaiming a challenge for developer certification with this exam. Let’s look at what you’ll face.

Forms and Controls and Grids, Oh, My!
The logical place for Microsoft to put a great deal of focus with any kind of application is in the user interface. After all, what do you have if the users can’t understand what they’re supposed to do? I found in this section that if you’re a seasoned Visual Studio 6.0 developer, you could definitely be fooled into picking an answer that might correlate to VB 6 but doesn’t work with .NET. Avoid that pitfall! For example, make sure you can do the basics with the Windows Form Designer, like create forms and set properties, but also ensure that you know what properties have changed with the new release of VB. For instance, know which objects have the “Text” property and which have the “Value” property. (To make matters confusing, some objects have both!)

Tip: Expect to see code in this exam. You may be asked to do a particular task, then shown several possible complete segments of code. Your job is to choose which one will handle the task.

Knowing some of the old school tricks is a good idea, too. Go back in your memory banks to what you remember about ActiveX controls, then learn how they work in .NET applications. Do you recall how to add licensing to these controls if you need to do so? There are a lot of companies out there whose sole business is developing controls for other developers to use.

Globalization and localization is a focus you should consider as well. When developing an enterprise application that might be used anywhere in the world, you have to consider who will be using the app. For example, in Europe the date 04/15/2002 would be displayed as 15/04/2002. Currencies and cultures are also very different and you would want to ensure that everybody is on the same page with the application to ensure consistent use. There may also be a need in your application’s development to provide accessibility features for those people who may have poor vision. Understand how to implement text-to-speech properties of objects so Windows knows how to describe a user interface to this type of user.

So How Different Is the C# Exam?

With the release of Visual Studio .NET, Microsoft also released its new programming language, C# (pronounced see-sharp). C# is a bridge between C++ and Visual Basic. It offers a few things that Visual Basic .NET doesn’t, like running unmanaged code and XML documentation. C# also provides an easier route to .NET development for Java programmers, as the languages are quite similar in syntax. It also allows C++ developers to rapidly adopt the language. According to Microsoft, C# provides all the functionality of C++ in a language with the relative simplicity of Visual Basic.

This exam review covers the Visual Basic .NET version of the exam. But since I took both of them, I should mention that both exams are similar in content—only the language differed. Of course, the exams weren’t identical, but by and large they covered the same content.

Most of the concepts applied in the exam review can be said for both Visual Basic .NET and C#. They’re both .NET framework languages with some syntactical differences. Also, C# supports unmanaged code, code that runs outside of the .NET framework and accesses memory directly, much like C++. This can be a great advantage to somebody with programming expertise, but can be a large hindrance to others.

For example, memory leaks are caused by resources not being released by the application in a timely fashion, so they linger until the machine is taxed, applications hang, and the system needs rebooting. The .NET framework manages memory through a process called garbage collection. This means that it “cleans up” any unused resources after a period has elapsed. When unmanaged code is used, it bypasses the garbage collector, leaving the responsibility to the developer to release the resources properly. Unmanaged code will run more efficiently in many cases since it’s not governed by the garbage collection process, but it can also create those pesky memory leaks.

C# is a great language to learn, but it does open up some doors that you might not want to enter. In the end, if you’re happy with VB, that will probably do you just fine. But if you need the extra functionality that C# provides or you’re ready to add some kick to your programming efforts, take the time to learn it. If you know the .NET framework, C# shouldn’t be hard to pick up with some effort.

I’ll review this exam in next month’s issue.
—Chris Golubski

Tip: I’d advise you to focus on localization and globalization issues if you’re not working with them daily.

A new concept to consider in .NET development is a Web service. This is a component that runs on a remote machine and serves as a data provider. Your application may contact the Web service via an Internet connection to get that data and display it. For example, there may be a Web service on the Internet that provides real-time stock quotes. Make certain you understand how to make your Windows application talk to that Web service and then display the data provided. Know when you need an application proxy to communicate with a Web service and how to generate it when necessary.

Assembling Assemblies
Assemblies are the building blocks of .NET. An assembly is similar to what we would have called a component in VS 6.0, but it can also be more. One of the great advantages of component development is that versioning isn’t the problem it was before. In fact, the syndrome referred to as “DLL Hell” is caused by having different versions of the same DLL residing on the same machine. This could easily break applications (and even a whole workstation) if you didn’t take cautionary measures.

When you compile a VB project, an assembly is created. This assembly consists of a single EXE or DLL file that contains all of the classes and code you’ve written in the project. This is similar to the way it works in VS 6.0. The difference, however, is that these components are registered with the .NET framework and not the Windows Registry, thus allowing coexistence of multiple versions of an assembly without conflict.

Make sure you understand how to create Windows Controls. These are the .NET equivalent of ActiveX controls. For instance, you may want to use a Windows Control to design multiple forms that have nearly the same interface. This should only be done, however, when there will be no variance in the size of controls. Otherwise, it’s a candidate for visual inheritance.

Tip: Make sure you don’t fall into the REGSVR32 trap. That utility is used to register DLLs created by previous versions of Visual Studio!

Delving Into Data
Data access, called ADO.NET in this release, is another crucial piece of the puzzle. Understanding SQL Server in this section is absolutely critical. If you don’t have some experience with stored procedures, you’re going to be lost quickly here. For example, make sure you understand how to use Visual Studio .NET to debug a stored procedure and step through it. Also make sure you understand how to execute a stored procedure from Visual Basic code.

Knowing the difference between the ADO object model and the ADO.NET object model is essential. For instance, learn the differences between the objects of the same name in both versions. Also, make sure you can distinguish between the System.Data.OleDbClient and System.Data.SqlClient namespaces and when to use each. The performance of your application will depend on whether or not you can answer that question.

Finally, make sure you get some practice with the DataGrid control that ships with Visual Studio .NET. Know how to perform different kinds of filtering and sorting on data if necessary without having to rewrite SQL statements. It’s important to understand which ADO.NET objects are necessary to use a DataGrid. Make sure you review this before you go to sit for the exam.

Tip: Know when you need a Data-View object. Also, be able to explain the performance differences between a SqlDataReader and a DataSet.

10 Things To Practice
  1. Use the Windows Forms Designer to practice creating forms and setting control properties.
  2. Use the intrinsic DataGrid control to connect to a database. Perform sorting and filtering on the data.
  3. Use the Visual Studio .NET debugger to step through different sections of code.
  4. Practice with the ADO.NET objects, especially SqlDataReader and DataSet.
  5. Use an ActiveX control on a Windows Form and practice setting the properties.
  6. Use a COM component developed in Visual Basic 6.0 in a VB .NET project.
  7. Write a .NET component, install it in the Global Assembly Cache, and then test it by using it in another project.
  8. Create the different kinds of deployment projects in Visual Studio .NET. Attempt to run the application’s installation on different machines to ensure it works.
  9. Write an application with security that uses your Windows account information (Windows Authentication) to authorize application use.
  10. Configure a Windows application to use a Web service.

Squash Those Bugs
Testing and debugging your application is obviously essential. In a perfect world, we wouldn’t have bugs, but alas, we’re only human! The first part of debugging is proper error handling. Error handling has totally changed in Visual Studio .NET. For example, we don’t use code labels and “On Error GoTo” statements anymore. Instead, we adopt the “try/catch” method used by C++ and Java programmers. For instance, we put any code that would possibly cause an error in a “try” block and then the resulting error handler in a “catch” block. Of course, there are many different kinds of errors and that’s beyond the scope of this article, but make sure you understand error handling thoroughly before taking the exam.

Once you’re actually debugging the application, Visual Studio .NET makes life easy. You can use trace objects to write log files to a text file on disk. Make sure you also know how to write to the event logs on Windows 2000 and Windows XP if necessary. It’s also important to understand how to incorporate debugging statements that won’t be released in the compiled production version of your code.

Tip: Make sure you understand the difference between the Debug and Trace objects and when to use each.

Lock It Down
Application security is an important part of the big picture as well. With VS 6.0, security usually had to be customized for each individual application. Microsoft has assisted us now by doing a lot of security integration with the .NET framework and the System.Security namespace.

Make sure you understand the differences between the authentication types available. For example, Windows Authentication uses security based on your local or domain Windows account. Also included with Visual Studio .NET is the ability to use the Passport SDK to enable your users to log on with their Microsoft Passport accounts. Although this may present a convenience to your users, you may or may not want to use this option due to trust issues. It’s up to your organization to make that determination.

Deployment Dangers
Once it’s all developed and tested, your application needs to be installed on the client to serve its purpose. Fortunately, application deployment and upgrading is a little bit smoother for the Visual Studio .NET developer than it was for the VS 6.0 developer. Now that the “DLL Hell” syndrome is gone, life becomes a whole lot sunnier.

By default, any components developed for an application must reside in the same folder as the application itself, or in one of a set of other application-specific locations that the .NET runtime checks automatically. If this doesn’t happen, you’ll get an error because the .NET framework won’t find the components. If you want the component to be used throughout the machine, you need to install it into the Global Assembly Cache (GAC for short). The GAC is a system-wide database of components that can be used anywhere on the machine. Make sure you know what to do to get custom-developed components into the GAC.

Additional Information

You’ll find the objectives for 70-306, the Visual Basic .NET exam, here: www.microsoft.com/traincert/exams/70-306.asp.

Try practice questions for this exam here: www.mcpmag.com/popquiz/.

At the time of this writing, Microsoft claims that more than 225 books have been published on various aspects of developing with Visual Studio .NET. Reviewer and editor Mike Gunderloy has commented on many of those in Developer Central, a monthly electronic newsletter published by MCP Magazine. Sign up here: http://lists.101com.com/NLS/pages/main.asp?

Deployment can be more of an art than a science. I believe it requires some of the knowledge of a network administrator to accomplish successfully. Make sure you understand the technologies associated with installation, like Windows Installer and how it plays into the .NET framework. Also be able to spot what types of installations will work for a given situation and which ones won’t. A lot of this is common sense, but make sure you read each question carefully!

To Boldly Go...
The next generation of Visual Basic is definitely an adventure, but not too difficult if you get a solid grounding in object-oriented programming and the .NET framework. Make sure you study well and practice with the new development environment before venturing out to take this one. Good luck!


comments powered by Disqus

Subscribe on YouTube