.NET DEVELOPMENT ON THE FRONT LINE

 

Riley Tipton Perry

University of Technology, Sydney

39/1C Kooringa Road Chatswood, NSW, 2067

Australia

 

ABSTRACT

 

     Property Company Colliers International has been using Visual Studio .NET and the .NET framework for the last eighteen months. They have developed a number of systems that run on Windows under the .NET Environment. This work presents an unbiased review of Visual Studio .NET and the framework together with comments and a case study by experienced .NET developers. The results indicate that .NET is clearly a good framework for Web application development, but due to its speed limitations it is not as useful when developing multimedia or desktop applications.

 

 

KEY WORDS

 

Visual Studio .NET, .NET Framework, Internet Tools, ASP.NET

 

 

1. Introduction

 

     The job of the developer has changed over the last few years. Companies now conduct a large chunk of their business over the Internet. Applications are leaning towards a client server model with large servers doing the grunt work and desktop machines just accessing those servers via a browser. Also, real world architectures have disparate and sometimes incompatible components. The .NET framework is Microsoft’s answer to these problems.

 

 

     At a high starting price it seems that Microsoft is now aiming its .NET products at high-end projects with large teams of developers. With VS.NET these teams have new tools to develop faster applications in “internet” time. Also a higher priority has been given to keeping these solutions open and flexible. Such systems can no longer assume they are communicating with desktop machines when the client device could be a mobile phone, a handheld device, or one of the myriad of other “Web enabled” devices.

 

 

     Property Company Colliers International (CI) has been using VS.NET (Visual Studio .NET) and the .NET framework for the last eighteen months. They have developed a number of systems that run on Windows under the .NET Environment. This work presents an unbiased review of VS.NET and the framework together with comments and a case study by experienced .NET developers.

 

 

2. FRAMEWORK

 

     The CLR (Common Language Runtime) activates and destroys objects, performs security checks at various levels, verifies types, manages memory (allocation and garbage collection), performs JIT (Just In Time) compilation, and execution in native code. The IL (Intermediate Language) code is contained in portable form (assembly) as a DLL or EXE. The assembly comes with XML metadata that replaces type libraries. So the .NET framework is basically a CLR and associated tools. Some .NET languages have the option of accessing memory outside the safe bounds of the CLR; the code that does this is called “Unmanaged”. Microsoft has plans to port the CLR and .NET class library to platforms other than Windows. This will eventually allow managed code to be portable.

 

 

     The trouble with the framework now is that it must be ported with an exe (for a desktop app). As versatile as they are, Web applications can’t do everything that a business requires and there is still a need for desktop applications. CI ran into this problem with a Web based tree-view control. The tree-view was part of an administration tool that had a large number of nodes. This was far too slow over the Web. CI then built a Windows application to do the same job; the relative cost of “shipping” the framework with the exe was too high so it now runs on a Citrix box over Meta-frame.

 

 

3. VISUAL STUDIO IDE & TOOLS

 

     The IDE is something of a “Grand Unified Development Environment” – One IDE for all languages. This IDE sports an advanced debugging environment, a visual interface for Web and Windows forms, XML editors for XML files and schemas, lots of useful little “novelty tools” (like a GUID creator), an icon editor, find and search tools, full IDE customization, IDE extensibility, and more. At first this may seem to be a dream come true but it comes at a price. With upwards of 15 windows displaying various pieces of information the screen can get very cluttered and it’s sometimes hard to find the window that you need. Another major concern is overall complexity – it just takes too long to learn about all of the features and nuances of the IDE (which is vastly different from any other IDE on the market).  This complexity also leads to speed problems with the IDE being rather clunky. A few more of the features are described below:

 

·         The find and search tools are extensive. As well as the usual search options there is pattern matching, object matching, and a new incremental search.

·         The help system is the best on the market, with context sensitive help tied in with the massive MSDN library and an Intellisense system (which is greatly improved from VS6).

·         There is a section in the tools drop down to load external tools – the tools can be given DOS arguments and can even have their own output windows.  One CI developer uses a more advanced process viewer here.

·         The IDE even ties in with your favorites folder and external web pages can appear as part of your projects.

 

 

     A CI developer has suggested that the fastest way to examine the different tools is to check and uncheck the various toolbars in the customize window and examine the tool tip for each new item. 

 

 

4. PROJECT DEVELOPMENT

 

     In VS.NET a solution is one or more projects. When you start a new project you are in fact starting a new solution. Projects can then be added to a solution. This becomes important when you want to store many different assemblies in one spot, or when you have different kinds of applications making up a solution. Projects all have a number of global files. There is the XML file web.config (customizable), global.asax (application level events), machine.config, css, assemblieinfo.vb, and many more. The web.config file is particularly useful allowing you to change application settings, store your own global constants, and passwords that tie in with the object model. Release version applications can have also dynamic properties stored in an XML file. The users can edit these properties after the application is released.

 

 

     With the Enterprise Architect Edition the developer is provided with enterprise templates and software, data and project modeling tools, SQL server 2000 and other products. There is Visio, which allows you to model UML; Biztalk is for data conversion, Commerce server for an e-commerce base, ISA is for caching and firewall functionality, and Exchange server for email and workflows. When used with IIS you have all the products you need to create a scalable enterprise Web application. The VS.NET environment also provides many different types of project in many different languages. Just about any type of file you’ll need for a Web or Windows application is provided. There are resource files and editors, script files, components, HTML file types, XML files and schemas, add-ins, setup solutions and enterprise templates to name but a few. The templates provide a “skeleton solution” for a standardized project base. These templates can contain an arbitrary amount of code.

 

 

     The IDE also has a number of windows and tools to make project management easier. The class view, resource view and the solution explorer are nicely color coordinated and well laid out. There is also the server explorer, which can be used to access services, logs, SQL servers, and more. As for code versioning and synchronization, source safe has not changed, but there is a VS.NET option called Folder synchronization. This is a great tool that allows the immediate update of remote project items (warning – the synchronization works both ways).

    

 

     When it comes to project modules the IDE provides top-notch modular code and component support. Component and assembly authoring is easily done with auto generated component code and an easy “xcopy” style component deployment scheme (just copy the component to a directory – no registration). Different versions of components can run side-by-side seemingly ending “DLL hell”. But is DLL hell really over? Not if you use COM interop, which you’ll have to if you use any legacy components. This actually makes DLL hell worse – with two different deployment methods in the same project (not to mention access, security, and compatibility problems). Macros and Add-ins also provide “modular code” support. A Macro is a series of commands and instructions accessible via one command. An Add-in on the other hand is a pre-compiled project that can extend the IDE. Expect to see lots of Add-ins being released in the near future, as there is an Add-in project type that comes with VS.NET.

 

 

     Finally, if there is any doubt that Microsoft intends to port the CLR to different platforms just take a look at the file types you can use in the advanced save options. There is an option to convert the file’s “line endings” to a UNIX style LF.

 

 

5. COMMENTING & DOCUMENTATION

 

     The quality of commenting and documentation is probably second only in importance to the code itself. With so much of the software life cycle dedicated to maintenance it is essential that a project be fully documented down to a fine level of granularity. Conversely documentation cannot take up a large percentage of overall development time, as developers (and clients) get disillusioned – seeing documentation as a bottleneck to getting the “real” job done.

 

 

     VS.NET Enterprise Architect has some of the best commenting and documentation tools every seen in an IDE. The IDE has nifty time savers like block indenting and language dependent smart indenting, virtual spacing (click anywhere on the screen) and color code retention (when copied to the clipboard). VS.NET also has the task list, outlining, XML comments, script block insertion, comment pages, and a handy function to show white space. The task list is a wonderful tool for internally documenting a project and maintaining its current status. The task list shows named bookmarks (source code comments that begin with reserved names) and directly added tasks. Errors are added to the task list when found by the debugger and the tasks are viewable by type. Also, the bookmarks mix with breakpoints and task list items in the page margin. For project documentation and design the Visio tool is available to create UML diagrams. These diagrams can then be used to auto generate code. The problem with the UML tool is that it only supports UML 1.2 at present, so you can’t update an existing diagram. Another option is Comment pages. They automatically show the project outline from a top down level to individual members and their descriptions.  Certain comments are stripped out of a project and stored in an XML file when the project is compiled (XSLT can then be used to transform the XML into HTML or other file types).

 

 

     When it comes to using these tools it’s probably more realistic that a development team would use a subset of them. CI make good use of outlining, developing their own regions within the code. One developer has said that the comment/uncomment function is a godsend but the task list takes a bit of an effort to use. Another developer, on the other hand, uses the task list quite often. CI also has a strict naming convention, which is the same across all tiers (from database columns to the names of Web controls). Something interesting that came out of several CI projects was that adhering to Microsoft’s commenting recommendations made the projects less readable and harder to maintain. One developer is even considering working on a literate programming add-in.

 

 

6. LANGUAGES

 

     The .NET CLR is “language independent” (languages are JIT compiled from IL to Native code) so most of the language differences between managed applications are semantic. IL code is JIT compiled in blocks at runtime, or directly compiled to native code. If an application calls a JIT compiled method again the CLR instructs the CPU to jump directly to the corresponding x86 instructions. This makes a CLR JIT application much faster than a regular JIT scheme or an interpreter.

 

 

     The class library is what every developer has to learn. With over 5000 classes and over 90 namespaces the differences between managed languages seem insignificant in comparison. Every type derives from a single base class – the System class, probably the fattest class in history. Some examples are System.Web (for Web forms), System.Threads, System.Drawing (GDI replacements for 2D and 3D graphics), and the list goes on… and on. If the class library is ported to another platform (an HUGE undertaking) then developers can conceivably port source code. The code would have to be managed and not tied in to windows (with COM calls and the like).

 

 

     VB.NET has changed significantly, with inheritance, constructors, polymorphism, a new exception model, new operators, overloading and stricter typing. It’s really just C# with different syntax, that can’t go into unmanaged mode. For this reason there is no need to use J#, VB.NET, or any of the other managed languages. The best choice for the job is C#. The preceding argument makes the common type system, multiple language inheritance, and the “any language, any time” sales pitch look rather gimmicky. The exception is C++ (which can’t be changed). Using managed extensions C++ can interact with all of the languages in the same way.

 

 

     For unmanaged desktop applications there is really only one choice of “real” languages, and that is C++. Consider the situation with COM interop (COM objects use C++ types). For example, when developing a multimedia application in VB.NET there appear to be a number of DIRECTX functions that just don’t work, D3DX functions just don’t exist, and it’s very slow. Even when using C++, COM interop is slow. Microsoft has promised that DIRECTX 9 is going to use a managed code library that may fix some of these problems.

 

 

     Finally, a big change from VS6 is the fact that the controls are just code generators. This is a major improvement, allowing the developer to look at the guts of the control.

 

 

7. ASP.NET

 

     The .NET framework is mainly directed at ASP.NET Web based enterprise applications. Microsoft has done a wonderful job of separating the business logic from the presentation tier. The business logic is coded in a traditional language and the presentation tier logic is contained in a pseudo HTML page that has an .aspx file extension. Communication between the two is done via Web controls, State is maintained by a VIEWSTATE field embedded in the client’s HTML page, and the server has easy access to postback events.

 

 

     Web controls and server side HTML controls use server side code to generate code specific to a particular browser or client. This is meant to render the page the same way on different browsers. The trouble is, that it doesn’t work. Just open a project and drag and drop some Web controls onto a page (using gridlayout) then view it with Netscape 4 and IE 6. The results are usually totally different. Another problem is that the Web controls are very limited; this makes each page look similar. Building reusable user web controls is a solution, but it is relatively time consuming. A CI story illustrates these UI problems.

 

Upper management wanted a particular look and feel to a system we were building. It took us a long time to find the correct mix of controls and DHTML to get it right. The IDE was of no help here as VS.NET likes inserting its own spaces and formatting in a seemingly random way – we had to keep two copies of the .aspx pages open at all times. The multi browser rendering did not work either, forcing us to make calls to request.browser.type”.

 

It’s not all bad news – controls are available on the Web and the set that comes with VS.NET will suffice for most applications. Some of these controls (validators for example) are great time savers. If you are willing to sacrifice good looks for development speed then a set of pages can be built very quickly. To top it off, the big unexpected bonus is rendering speed, ASP.NET pages render really quickly – far quicker than JSP or ASP pages.

 

 

8. DATA TIER ACCESS

 

     ADO.NET is the new method to access data sources but the .NET framework does support more traditional methods like ADO and ODBC. The entire framework makes heavy use of XML and ADO.NET is no exception, ADO.NET can use any XML stream as a data source (regardless of the provider). To use ADO.NET visually VS.NET has database connection builders and advanced query builders. These are useful in some situations but developers still like to get their hands dirty by building stored procedures and database access code.

 

 

9. DEBUGGING

 

     The VS.NET debugging environment is a leap forward from previous versions of Visual Studio with a number of tools for remote and local debugging. The IDE and framework have some of the following features:

 

·         Structured Exceptions are an integral part of all .NET languages now. Using the exception debugger one can drill down to a set of exceptions or even down to a single exception type and tell the CLR what to do when the exception is thrown.

·         The Command window allows the developer to execute runtime commands. The Auto, Locals and Watch windows show values of variables, registers, and allow evaluation of expressions on the fly. Then there is the process viewer, which is a little inadequate. It shows all active processes and allows some debugging options. VS.NET still needs a more comprehensive process viewer with memory maps and process metadata.

·         Intellisense is now more intelligent (and more sensible) with a “word” style red wavy line under the error and task list entry. The amount of times the project has compiled first time, and worked, is astounding.

·         The handiest tool for the ASP.NET developer is the Trace directive. Trace has a rich object model, which can write to an HTML page if it is turned on. This means that standard trace controls or classes can be built, added to pages and then just turned off when development of the page is finished.

 

 

10. SECURITY

 

     Microsoft has claimed that security was their number one priority when designing the .NET framework. The CLR is inherently secure, copying JAVA’s sandbox model, although the CLR hasn’t been rigorously tested in the same way as the JVM.

 

 

     The framework contains extensive cryptographic libraries. These libraries consist (amongst other things) of most of the popular encryption algorithms, authorization, and authentication methods. Authorization and access control can be done with role-based security. Access to object and methods are then done with these roles. There are two namespaces for use with role-based security, one is with System.Security.Permissions and the other is System.Enterprise-Services. The first method uses Windows user groups and the second requires the use of the component services explorer to add users or roles to a COM+ application. Authentication methods like SSL client certification, form based password protection and WINNT login all have various classes associated with them. It’s even possible to store and access password information in the web.config file – although this is not really a viable option for applications with a dynamic user base.

 

 

     Another major innovation is the Microsoft Passport, which can be used for authentication and authorization. The passport allows access to the “Hailstorm” services. Windows .NET Server will allow Active Directory access to the passport, so a WINNT login will also log into the passport. One potential problem with Hailstorm is the centralized storage of personal data. If this is a success with users the ramifications of a security breach could be severe for Microsoft (and passport holders).

 

 

      Administrators have a finer grained level of control over .NET servers and applications. For example, an administrator can allow access to a local disk for users coming from a certain URL, with a certain key, and so on. Also with Active Directory (LDAP) queries all user information can be stored in an active directory account then leveraged by applications and used for authorization and authentication. This gives an administrator more hands on control of user information and roles for a company’s systems. CI has Intranet systems, which automatically log in users depending on their WINNT logins. There is one externally exposed system that checks the requestor’s IP address and attempts authentication if the address is in the local range.

 

 

     The .NET framework security has already proved to be less than robust. For example, a mechanism to protect against C++ buffer overflow attacks itself was vulnerable to buffer overflow attacks. Also, Windows applications are now more vulnerable than ever. With ildasm.exe and easily readable metadata all applications can be de-compiled to MSIL and manipulated. Since the IL is standardized and relatively simple to read it becomes far easier to insert “cracks” and “Trojans”.

 

 

11. WEB SERVICES

 

    Web services are simply Web-enabled components whose methods are accessible via XML messages. In the .NET environment these messages are transported using SOAP (Simple Object Access Protocol), which sits on top of either HTTP or SMTP. SOAP is a standard developed by a number of different companies (Microsoft and IBM amongst them). Businesses connect to these services via an external registry. WSDL (Web Service Definition Language) describes what the services do and how to use them and these services are discovered via UDDI (Universal Description, Discovery and Integration). With current business architectures the loosely coupled approach is the most versatile. Businesses can freely use Web services that are platform independent and can jump across firewalls.

 

 

     VS.NET makes the use of Web services easy. With a few lines of code a Web reference can be added to a project. The code for a Web service is auto generated once the Web service project type has been selected (in fact you can add a Web service file to any project). This comprises of the system Import, namespace and a <WebMehtod()> attribute. That’s it – just write the code for the service and expose it using the tools provided. Microsoft and a number of other companies have a global “vision” of companies sharing data, but the reality is that most of these companies will probably sell these services directly to users or ASPs. Web services have the potential to be big, something of a second chance for these ASPs.

 

 

     There are currently thousands of businesses with services registered on the UDDI public registry. There are also a number of private registries and companies can use their own internal services. CI has internal Web services in their systems. One such Web service runs as a Windows service that connects to a currency converter service on a daily basis. Because of the in-availability of the specific Web services it needs, CI has created a number of Web service wrappers for internal consumption. These wrappers mask more conventional means of gathering data like XML parsing and DCOM calls.

 

 

     So will .NET Web services be the next big thing? There are some of problems with this scenario. The first is bandwidth and speed; the more an application relies on service calls the slower it gets. XML is a “fat” protocol and a company’s bandwidth is usually limited. The second is interoperability, Microsoft intends to tie in Web service authentication with Passport – this may affect the use of .NET Web services on non-MS platforms.

 

 

12. SPEED

 

     Visual Studio .NET is slow. The IDE is slow, the resulting Windows applications are slow and with XML as a base the interaction between distributed components is slow. Comparing compiled functions (desktop applications) under VB 6 and VC++ 6 to VB and C++ functions written under .NET shows that, on average these functions run at around ½ the speed in .NET [1]. Also, any managed code will run at the same speed regardless of the language it’s written in (as it all compiles to IL). For an example of a Windows application that runs slowly that’s written in C# just look at Visual Studio .NET. One person reported that it took three minutes to render a visual map of an XML schema with 4900 lines (on a 1ghz PIII) [2]. The speed of the IDE gives VS.NET a decidedly amateur feel that some people will find unacceptable.

 

     In contrast, Web applications run much faster than their ASP or JSP counterparts. The engine that generates these pages is much more complicated than the ASP engine that interprets an ASP page line by line. With advanced caching, precompiled pages and postback functionality the new engine renders pages at a blinding pace. The trouble with this is that Microsoft seems to have sacrificed desktop speed for Web application speed. There will not be a “desktop” version of VC++ 7 or VB 7 - VS.NET is it.

 

 

13. A CASE STUDY

 

     CIVS (Colliers International Valuations System) is a system for tracking and managing a property valuation over its lifetime.  Valuations adhere to a certain workflow and only certain users can access a certain valuation. The system was developed using a rapid prototyping method by one developer, the CTA, and department representatives over a few months. The valuers use Windows machines on an intranet, or access the system via a browser over the Internet. All of the Windows machines sit on an intranet with the same Windows domain. At the back end the system is served by IIS and two SQL Server 2000 boxes. 

 

 

     The data tier sits on four logically separated databases, HR data, property data, workflow data, and a database containing settings that are common to all of the systems. All data logic is done via stored procedures. Modular Data access components are written (in VB.NET) separately for each of these databases and are used in other systems. These components are simply referenced in the CIVS project.

 

 

     The business logic tier is comprised of code behind pages, a common class that is inherited by all forms and a modular concept they have called “sub-pages”. These sub-pages (an .aspx page and a code behind page) can be copied into any project. An example of a sub-page is the Person Search sub-page. This sub-page references the HR data access component that does a criteria based search and returns a list of people. The sub-page is activated by a JavaScript function that passes the ID of a hidden field to a new pop up window. Once the user clicks on a person record (in a Datagrid) the window closes and passes the value back to the value attribute of the hidden field. Sub-pages are simple to add in to new projects and they are used extensively for all database access.

Business and data access logic is thoroughly “over-commented”, even to the extent of using ASCII art to make it interesting. This is for two reasons, VS.NET does a great job of converting comments and source into documentation and turnover is high (someone else will be reading it one-day).

 

 

     The presentation tier is pretty stock standard, but they develop their .aspx pages using separate tools like Dreamweaver and even notepad. VS.NET tends to mess everything up so you have to keep two copies open.

One major bug they found with Beta 2 was accessing dynamically created controls like text boxes and drop-downs after a postback. The solution was to place the access code in the Page_Init subroutine (which VS.NET states you should not modify). They also made extensive use of css styles and render functions in a common class. Since the intranet is sitting on a single Windows domain the system does not require a login. The common class uses an HR call and WINNT login (via a servervariable) to authenticate users on the local network.

 

 

     The amazing thing about .NET is that once they had this project written it was simple to create a template for other projects with all of the references, data classes, sub-pages, render code, database connections and standard comments.

 

 

14. CONCLUSION

 

     It looks like .NET is here to stay and it is only going to get bigger and better. The .NET framework and Visual Studio .NET is the best product on the market for generating scalable enterprise Web applications. It does have quite a number of faults (speed, bugs, complexity, and security) but these are far outweighed by its usefulness as a Web development tool. Unfortunately for Multimedia and stand-alone desktop applications it doesn’t hold up yet against its predecessors, Visual Studio 6 and COM+. You can be sure that Microsoft is on this and these problems may well be rectified in the 2nd version of the framework and Visual Studio .NET v2.0.

 

 

15. Acknowledgement

 

Thanks go out to Sean Kaye, Linda Wienholt, Sonny Malley, and Hilary Dell.

 

 

References

 

Web based documents:

[1] DirectX4VB, Visual Studio .NET in the Real World:  http://64.23.12.52//Articles/Review_VS_Net_Page5.asp

 

[2]  DNJ Online, Visual Studio .NET:

http://www.djonline.com/articles/tools/iss28_reviews_vsnet.asp