Tuesday, 07 September 2010
PicoSearch

Browsing The Next Generation

This column appeared in the May 2000 edition of EXE. It explains why Visual Basic developers will soon need to start calling themselves Visual Studio developers.


Once again the theme this month is concerned with keeping those skills up to date, while also keeping an eye on what lies ahead. To start with I’d like to cover the main points from a keynote speech given by Steve Ballmer, Microsoft president and CEO, in which he outlined the next generation of Visual Studio. Most people I speak to who are in our trade are always interested to know what’s in the next release of Visual Studio, Windows, SQL Server, or whatever, so this month I thought it would be fun to indulge ourselves a little bit. Finally, having completed this, there is a book that I’d like to recommend to those developers who are lucky enough to be working on the newest platform, namely Windows 2000.

Visual Studio 7

Strictly speaking the next version of Visual Studio 7 was due out in the first half of this year and was chiefly intended to accommodate some of the newer technologies such as SQL Server 7, COM+ and, of course, Windows 2000. However, at the Visual Basic Insiders Technical Summit (VBITS) in San Francisco on February 15th, Steve Ballmer announced that this next version was being postponed until the “end of the year” (which will probably be 2001). The primary reason for the delay was declared to be the amount of work being done to build in support for Windows DNA 2000. Dave Mendlen, Visual Studio Product Planner at Microsoft, described the new version as “revolutionary”, for reasons that will become obvious as I describe the new features. Before I start covering the new features of Visual Studio 7 please do remember that this is a very early preview that was demonstrated so there is every possibility that the specification will change again before the product finally hits the streets; just treat it as an intention of things to come.

The most significant visual change will be that Visual Basic is finally hosted within the Visual Studio environment. This has frankly been long overdue; long–standing VB developers will recall that the first three versions consisted of a strange mix of different control windows that all sat independently on the Windows desktop. The current IDE concept wasn’t actually introduced until Visual Basic 5, and even then you had the option to revert to the old style if you preferred. Having Visual Basic share the same IDE as the other development languages finally means that we get direct access to the same utility tools that have been available to the Visual C++ and Visual InterDev crowd for so long. For example, Visual Studio has always provided integrated editors for bitmap, icon, and resource files, whereas the Visual Basic resource editor add–in always left me feeling like the poor relation. They’ve even got a To Do task list for crying out loud! For this integration alone I’m extremely pleased.

There’s more, however. One of the biggest criticisms of Visual Basic so far has been that it’s not truly object–oriented, but instead is merely object–based. Up to and including the current release Microsoft provided a partial implementation of inheritance – a key requirement of OO – by providing the Implements keyword. This is all set to change as Ballmer has promised that VS7 will provide a “first class object oriented programming language”. This means a full–implementation of the concepts that were previously missing and thus disqualified it from being described as an OO language, namely Inheritance, Encapsulation, Overloading, and Polymorphism. It will also be possible to pass parameters to the class constructor, the absence of which has thus far limited the usefulness of the Class_Initialize method.

From the day that a 32–bit version of Visual Basic existed the development community have been asking why some of the most fundamental features of 32–bit Windows aren’t available, namely thread support and structured exception handling. Again, both of these will be provided for the first time. Actually, although I say for the first time there has actually been a partial implementation of thread support in that an apartment–threaded model is provided for ActiveX components. The term apartment threading is used to indicate that objects created under a current thread are aware of other objects that are created under the same thread, but cannot see objects created by other threads even thought they might be part of the same component; as if these other objects lived in another apartment within the same building. But while the apartment–threaded model has its place the feature that developers have really been waiting for is free threading. This other model allows the programmer to create a new execution thread on the fly for the purpose of performing some other task, such as a background calculation or print set–up job. In order to implement this the AddressOf operator is used, together with a couple of new thread–related functions. The code fragment that Microsoft have provided for this is:

Dim b As BackGroundWork
Dim t As Thread
Set b = New BackGroundWork()
Set t = New Thread(New ThreadStart(AddressOf b.DoIt))
t.Start

The structured error handling (SEH) is something that will be totally familiar to Visual C++ developers who have had it since version 2.0. The idea of an SEH block is to identify a section of code for which you have a specific course of action that you’d like to follow in the event of a failure; it also provides a guarantee that a subsequent piece of tidy–up code will always be executed. The section that contains the code that might fail is called the guarded body, whereas the guaranteed–to–run finish–up code is called the termination handler. If an error occurs then execution will be shunted an exception handler. It is coded within a new control–of–flow sequence called a Try..End Try block, such as:

Try
  Open "Testfile.txt" For Output As #1
  Write #1, CustomerInformation
Catch
  Kill "Testfile.txt"
Finally
  Close #1
End Try

But of course the most fundamental changes to the product are concerned with Internet development issues. In fact if anything the emphasis of the product will be more squarely aimed at building server–side logic for the servicing of web pages than for the construction of conventional Windows applications. By the sound of things the Visual Basic professional won’t need to leave the Visual Studio environment to perform any of the web development tasks. A new concept known as ASP+ Web Forms builds upon the drag and drop model employed in the construction of traditional Visual Basic forms, but this won’t be limited to a particular language. As a standard feature of Visual Studio a new Web Form can be created and defined; the layout of the page is stored as HTML while the event handling code is written in either Visual C++ or Visual Basic as you prefer. This source code is then compiled and stored at the server for execution. When the code is executed HTML 3.2 text is produced allowing the result to be viewed on any decent browser.

This approach speeds up execution because it is running a compiled executable, rather than text–based scripts. In order to be ready for this technology Microsoft recommends that a tiered approach be adopted to any development which is taking place now, with as much functionality as possible being placed in middle–tier business objects rather than in script. Then, when you are able to move up to Visual Studio 7, you will be able to import, extend, and then recompile the objects to take advantage of the new features. It’s likely that you will need to tweak your code a bit when you port it over; Visual Studio 7 is a major rewrite and it looks like there will be less emphasis on backward–compatibility this time around in order to get the most out of the new architecture. Some people will criticise this, but personally I think that the Windows landscape is changing so much that the product needs this kind of big leap in order to stay in the game.

When a middle–tier component, or set of components, is made available over HTTP it is known as a Web Service. As part of the process of designing a Web Service the developer will need to describe the flow of data in an XML document. This sounds a little scary on the face of it but there will be visual designers and wizards to “automate the task of creating complex XML data structures”. Phew! The upshot is that data can be passed between all three tiers as XML, effectively opening up the architecture to include other platforms if required.

As you may have gathered from some of the other topics in this month’s issue of EXE, XML is getting to be big and it’s here to stay. I’ve already skimmed the utmost basics of XML in a previous column (at least, as much as I could in two pages), but Ballmer has indicated that XML support will be deeply integrated within the full Visual Studio product set. XML is currently being integrated into just about everything that Microsoft produce for the business market right now; for example we will see the release of SQL Server 2000 a bit later this year, to which one of the primary additions is this very technology. Something else you’ll start hearing more about from Microsoft is the Simple Object Access Protocol (SOAP) which is an XML–based mechanism for remote object invocation and manipulation over HTTP. A forthcoming Visual Studio add–on called the Web Services Toolkit is a forerunner to this SOAP technology.

Book review

Having looked at a product that is yet to come, we’ll now come back to a product that is currently shipping, albeit for only a short while. Windows 2000 takes the concepts of the COM model, adds Microsoft Transaction Server (MTS) and a few other features and COM+ is the result. MTS under Windows NT 4 is currently used by a large number of Visual Basic developers to provide distributed transaction support within an enterprise infrastructure, although it is also good for providing straightforward object pooling. Despite Microsoft’s fondest wishes it is likely to be a while yet before large companies seriously start looking at upgrading their corporate platform to Windows 2000, but that doesn’t mean that you shouldn’t be familiarising yourself with the architecture. To this end I would recommend Understanding COM+, written by David S. Platt. In this book Platt made the decision upfront not to litter the book with code samples, and I think the decision was correct in this particular case. If you only program in Visual Basic then it can be quite off–putting to see loads of C++/MFC; in fact it would probably put you off buying the book. Having said that, sample code by the author is downloadable from the Internet.

Despite a rather irritating over–emphasis on categorising software developers as geeks he presents the subject matter clearly and makes the topic suitable for both developers who are new to the concepts of the technology formerly known as MTS, and to those who have programmed for it but need to understand how the architecture has altered. The only real problem with the book is that it was written against beta 3 of Windows 2000 and doesn’t take into account the fact that a whole subsystem, namely In–Memory Databases (IMDB), was removed from the product at the eleventh hour due to adverse feedback from some of the corporate testers; in the book Platt devotes a whole chapter to the topic. However I still believe that it will still make interesting reading because I understand that Microsoft still intend to re–implement it at a later time when they have addressed the criticisms that were levelled against the implementation. The book is published by Microsoft Press and is priced at £22.99 (ISBN 0–7356–0666–8).

Copyright ©2002 Jon Perkins I, Jon Michael Perkins, hereby assert and give notice of my right under section 77 of the Copyright, Designs, and Patents Act 1988 to be identified as the author of the foregoing article.