Home > Articles > Programming > Windows Programming

Introducing .NET

This chapter is from the book

This chapter is from the book

Visual Studio 2005

Visual Studio is by far the most popular tool for creating .NET applications today. The current version, Visual Studio 2005, is the successor to Visual Studio .NET, which was itself the first version of this tool to support creating managed code. Both tools provide a very large set of services for developers, including all of the bells and whistles of a modern IDE.

Figure 1-8 shows how Visual Studio looks to the creator of a simple .NET Framework application. Different windows show different aspects of the project, including the code itself and, in the lower right corner, any properties that may have been set. If you’ve never used a modern software development tool, don’t be fooled by this very basic picture: Visual Studio is actually a complex and powerful IDE, one that’s used by millions of developers today.

Figure 1-8

Figure 1-8 Visual Studio provides a range of support for creators of .NET applications.

Visual Studio 2005 is actually a family of products, each aimed at a particular kind of developer. This family includes Visual Studio 2005 Express Edition, aimed at beginning developers and hobbyists, Visual Studio Standard Edition, aimed at more serious developers, and Visual Studio 2005 Professional Edition, intended for hard-core software professionals building scalable distributed applications. The product family also includes Visual Studio Tools for Office, which provides the ability to create applications in VB or C# that build on Excel, Word, Outlook, and InfoPath. Another important member of this family, one that’s described in a bit more detail later in this chapter, is Visual Studio Team System, which provides a set of interrelated tools specialized for various roles in a development group.

As already described, several different programming languages can be used to create .NET Framework applications. Visual Studio 2005 ships with support for C#, VB, C++, and other languages, giving developers a range of choices. The 2005 version of the tool also adds support for using domain-specific languages (DSLs), an idea that’s described later in this chapter. The main focus of Visual Studio, however, is helping developers create applications using general purpose CLR-based programming languages, and so the next section takes a brief look at this area.

General Purpose Languages

Although Visual Studio supports many different programming languages, the CLR defines the core semantics for most of them. Yet while the way those languages behave often has a good deal in common, a developer can still choose the language that feels most natural to her. All of these languages use at least some of the services provided by the CLR, and some expose virtually everything the CLR has to offer. Also, with the exception of C++, it’s not possible to create traditional standalone binary executables in these languages. Instead, every application is compiled into MSIL and so requires the .NET Framework to execute. This section provides a short introduction to each of the most commonly used general purpose languages built on the CLR.

C#

The two dominant languages for Windows development in the pre-.NET world were C++ and Visual Basic 6 (VB6). Both had sizable user populations (although VB6’s user base was much larger), and so Microsoft needed to find a way to make both groups as happy as possible with their new environment. How, for example, could the large number of Windows developers who know (and love) C++ be brought forward to use the .NET Framework? One answer is to extend C++, an option described later. Another approach, one that has proven more appealing for most C++ developers, is to create a new language based on the CLR but with a syntax derived from C++. This is exactly what Microsoft did in creating C#.

C# looks familiar to anyone accustomed to programming in C++ or Java. Like those languages (and like the .NET version of VB), C# is object-oriented. Among the more interesting aspects of C# are the following:

  • Support for implementation inheritance, allowing a new child class to inherit code from one parent class, sometimes referred to as single inheritance
  • The ability for a child class to override one or more methods in its parent
  • Support for exception handling
  • Full multithreading (using the .NET Framework class library)
  • The ability to define interfaces directly in C#
  • Support for properties and events
  • Support for attributes, allowing features such as transaction support and Web services to be implemented by inserting keywords in source code
  • Garbage collection, freeing developers from the need to destroy explicitly objects they have created
  • Support for generic types, a concept similar to templates in C++
  • The ability to write code that directly accesses specific memory addresses, sometimes referred to as unsafe code

C++ or Java developers, who are accustomed to a C-like syntax, usually prefer C# for writing .NET Framework applications. VB6 developers, however, fond of their own style of syntax, often prefer the .NET version of VB, described next.

Visual Basic

From its humble beginnings at Dartmouth College in the 1960s, Basic has grown into one of the most widely used programming languages in the world today. This success was due largely to the popularity of Microsoft’s Visual Basic. Yet it’s likely that the original creators of Basic wouldn’t recognize their child in its current form. The price of success has been adaptation—sometimes radical—to new requirements.

VB.NET, the first CLR-based version of this language, was a huge step in Microsoft’s evolution of VB. In addition to being enormously different from the original Basic language, it was a big leap from its immediate predecessor, VB6. The primary reason for this substantial change was that VB.NET was built entirely on the CLR. The version in Visual Studio 2005, officially known as Visual Basic 2005, brings a few changes to the original VB.NET. On the whole, however, this version of the language is very much like the VB.NET incarnation that preceded it.

VB 2005 is much like C#, which shouldn’t be surprising. Both are built on the CLR, and both expose the same core functionality. The biggest difference between C# and VB today is in syntax; functionally, the two languages are very similar. In fact, the list of interesting features in VB mirrors C#’s list:

  • Support for single implementation inheritance
  • Method overriding
  • Support for exception handling
  • Full multithreading (using the .NET Framework class library)
  • The ability to define interfaces directly in VB
  • Support for properties and events
  • Support for attributes
  • Garbage collection
  • Support for generic types

Unlike its sibling C#, VB doesn’t allow creating unsafe code. The 2005 version of VB does, however, provide an addition called the My namespace, making it easier to perform some common operations. Despite these differences, it’s important to realize how similar VB and C# really are. The old division between C++ and VB6, two radically different languages targeting quite different developer populations, is gone. In its place is the sleek consistency of two closely related CLR-based languages: VB and C#.

C++

C++ presented a challenge to the creators of .NET. To be able to build .NET Framework applications, this popular language had to be modified to use the CLR. Yet some of the core semantics of C++, which allows things such as a child class inheriting directly from multiple parents (known as multiple inheritance), conflict with those of the CLR. And since C++ plays an important role as the dominant language for creating non-Framework-based Windows applications, modifying it to be purely Framework specific wasn’t the right approach. What’s the solution?

Microsoft’s answer is to support standard C++ as always, leaving this powerful language able to create efficient processor-specific binaries as before. To allow the use of C++ to create .NET Framework applications, Microsoft added a set of extensions to the language. The C++ dialect provided with Visual Studio 2005 that includes these extensions is called C++/CLI, and it provides access to all features of the CLR. Using C++/CLI, a developer can write C++ code that takes advantage of garbage collection, defines interfaces, uses attributes, and more.

Because not all applications will use the .NET Framework, Visual Studio still allows building traditional Windows applications in C++. Rather than using C++/CLI, a developer can write standard C++ code and then compile it into processor-specific binaries. Unlike VB and C#, C++ is not required to compile into MSIL.

Other CLR-Based Languages

It’s fair to say that the great majority of .NET development is done in C#, VB .NET, and C++. Still, Visual Studio 2005 also supports two other CLR-based languages that are worth mentioning:

  • JScript: JScript is based on ECMAScript, the current standard version of the language originally christened as JavaScript. As such, JScript provides developers with a loosely typed development environment, support for regular expressions, and other aspects typical of the JavaScript language family. Yet because it’s based on the CLR, the .NET version of JScript also implements CLR-style classes, which can contain methods, implement interfaces, and more. While JScript can be used for creating essentially any .NET application, the language is most commonly applied in building ASP.NET pages.
  • J#: Microsoft’s implementation of the Java programming language, J# provides Java’s syntax on top of the CLR. Don’t be confused—J# isn’t intended for creating applications that run on a standard Java virtual machine. Microsoft also doesn’t support many of the major Java libraries, such as Enterprise JavaBeans (EJB). Instead, J# provides a way to more easily transition Java developers and existing Java code to the world of .NET.

Microsoft also makes available a CLR-based version of the increasingly popular Python language. While it’s not an integral part of Visual Studio, this implementation does allow access to the .NET Framework class library. It also demonstrates the ability of the CLR to support a broader range of programming languages, since Python is a dynamic language. Dynamic languages allow more change at runtime than more conventional approaches such as C# and VB, including things such as introducing new data types. To provide this kind of flexibility, the CLR-based version of Python relies on an interpreter rather than just a compiler.

Other vendors also provide tools and languages for creating .NET Framework applications. The most popular of these is probably Borland’s Delphi. Widely admired as a language, Delphi has a hard-core user base around the world. The current version of this language is based on the CLR, and so it allows Delphi developers access to the services provided by the .NET Framework.

Support for multiple programming languages is one of the most interesting things about the .NET Framework. Chapter 3 takes a closer look at C#, VB, and C++/CLI, the three most popular languages for building .NET Framework applications.

Domain Specific Languages

General purpose programming languages such as C# and VB are the mainstays of modern development. Yet the idea of model-driven development (MDD), where software creation depends at least in part on some kind of underlying abstract model, is a hot idea in the industry today. Visual Studio 2005 reflects this in its support for what are known as domain specific languages (DSLs). In general, a DSL might be expressed in text, graphically, or in some other way. For example, SQL can be thought of as a DSL designed for working with relational databases, while the graphical Orchestration Designer in Microsoft’s BizTalk Server can be viewed as a DSL for defining some kinds of business logic. However it’s defined, each DSL implements a set of higher-level abstractions for solving problems in a particular area.

Visual Studio 2005 supports several graphical DSLs. Each is implemented in a specific graphical tool that focuses on a particular problem domain. For example, every version of Visual Studio 2005, except the Express Editions, includes a tool called the Class Designer. As Figure 1-9 illustrates, this tool provides a graphical DSL for creating and modifying classes and class hierarchies.

The Class Designer allows a developer to create a new class by dragging and dropping an icon from the toolbox (shown on the left in Figure 1-9) onto the design surface. Properties, methods, and other aspects of the class can also be added graphically. This is more than just a tool for drawing pictures, however. The Class Designer actually generates code that reflects the defined classes. Changes to the diagram are reflected in the code, and changes made directly to the code are also reflected in the diagram. Especially for more complex scenarios, the ability to visualize classes and their relationships can be a big help in writing good code.

Figure 1-9

Figure 1-9 The Visual Studio 2005 Class Designer provides a DSL for defining classes and class hierarchies.

Working in Groups: Visual Studio Team System

Like any development tool, the goal of Visual Studio is to help developers be more effective. Yet the majority of software today, and virtually all enterprise software, isn’t created by a single individual. Software development has become a team sport, complete with specialized positions for various players.

Visual Studio 2005 Team System recognizes this fact. As Figure 1-10 shows, this product suite includes components that target each member of a modern development group. Those components include:

Figure 1-10

Figure 1-10 Visual Studio Team System provides different tools for different roles in a development team.

  • Visual Studio 2005 Team Edition for Software Architects: provides a group of tools known collectively as the Distributed System Designers. Each provides a DSL aimed at architects designing various aspects of service-oriented applications. These tools include Application Designer for defining applications and how they communicate, System Designer for defining how those applications fit together for deployment, Logical Datacenter Designer for defining the structure of machines in a data center, and Deployment Designer for defining how the set of applications that comprise a particular system is deployed in a specific data center. This product also includes a version of Visio that allows creating Unified Modeling Language (UML) diagrams, entity/relationship (ER) diagrams, and other architecture-oriented pictures.
  • Visual Studio 2005 Team Edition for Software Developers: includes tools that are useful for people who actually write code. These tools support static code analysis, exposing problems such as using an uninitialized variable, dynamic code analysis, allowing code to be profiled for performance improvements, and more.
  • Visual Studio 2005 Team Edition for Software Testers: offers tools focused on the tasks performed by people who test code, such as tools for creating and running unit tests and for load testing.
  • Visual Studio 2005 Team Foundation Server: provides the common platform for the other Team System components. Implemented as a standalone server application, Team Foundation Server keeps track of team projects, maintains a work items database, supports version control of a project’s source code, and provides other common services that a software development team needs. The projects maintained by a particular Team Foundation server can also be examined using a client called the Team Explorer. Status reports and other information are available through a Team System portal built on Windows SharePoint Services.

Except for Team Foundation Server, all of the components of Visual Studio 2005 Team System are built on Visual Studio 2005 Professional Edition, which means that each one includes a complete development environment. While many .NET developers are happy with just a standalone version of Visual Studio, larger teams or those working on more complex projects can sometimes make good use of the extra tools provided by Visual Studio 2005 Team Edition.

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.

Overview


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information


To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information


Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children


This site is not directed to children under the age of 13.

Marketing


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information


If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

Choice/Opt-out


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information


Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents


California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure


Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact


Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice


We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020