Team LiB
Previous Section Next Section

Why C#?

We could walk you through building the SRS using any OO programming language: Java, or C++, or Ada, or Smalltalk, or Eiffel, or C#, or any of the OO flavors of conventional programming languages such as COBOL, Fortran, or Visual Basic. Why might we want to use C#? Read on, and you'll quickly see why!

Practice Makes Perfect

The designers of C# were able to draw upon the lessons learned from other OO programming languages that preceded it. They borrowed the best features of C++, Java, Eiffel, and Smalltalk, and then added some capabilities and features not found in those languages. Conversely, the features that had proven to be most troublesome in earlier languages were eliminated. As a result, C# is a powerful programming language that at the same time is an easy language to learn.

This isn't to say that C# is a "perfect" language—no language is!—but simply that it has made some significant improvements over many of the languages that have preceded it.

C# Is Part of an Integrated Application Development Framework

The C# language is integrated into Microsoft's .NET Framework—Microsoft's revolutionary new platform for developing applications and managing their runtime environment. The .NET Framework supports over 20 programming languages, including C#, C++, and Visual Basic .NET. A core element of the .NET Framework is the common language runtime (CLR) that is responsible for the runtime management of a C# program. The CLR takes care of loading, running, and providing support services for your C# program.

The .NET Framework provides a high degree of interoperability between the languages it supports—C#, C++, Visual Basic, JScript—through a Common Language Specification (CLS) that defines a common set of types and behaviors that every .NET language is guaranteed to recognize. The CLS allows developers to seamlessly integrate C# code with code written in any of the other .NET languages. For organizations that have standardized on Microsoft technology, C# provides a way to easily integrate with other Microsoft components.

The .NET Framework also contains a vast collection of libraries called the .NET Framework Class Library (FCL) that provides almost all of the common functionality needed to develop applications on the Windows platform. You'll find that with the FCL, a lot of programming work has already been done for you on topics ranging from file access to mathematical functions to database connectivity. The C# language, in effect, provides "one-stop shopping" for all your programming needs.

You can find out more about the .NET Framework at the following URL: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/netstart/html/cpframeworkref_start.asp

C# Is Object-Oriented from the Ground Up

Before newer OO languages like C# and Java arrived on the scene, one of the most widely used OO languages was C++, which is actually an object-oriented extension of the non-OO language C. As such, C++ provides a lot of "back doors" that make it very easy to write decidedly "un-OO" code. In fact, many proficient C programmers transitioned to C++ as a "better" C without properly learning how to design an object-oriented application, and hence wound up using C++ for the most part as a procedural (non-OO) language.

In contrast, C# was built from the ground up to be a purely object-oriented programming language. As we'll discuss in more detail in the chapters that follow, everything in C# is an object:

  • All of your data, even simple numerical types, are objects.

  • All of the GUI building blocks—windows, buttons, text input fields, scroll bars, lists, menus, and so on—are objects.

  • All functions are attached to objects, and are known as methods—there can be no "free-floating" functions as there were in C/C++.

  • Even the main function (now called the Main method) no longer stands alone, but is instead bundled within a class, the reasons for which we'll explore in depth in chapters to come.

Because of this, C# lends itself particularly well to writing applications that uphold the object-oriented paradigm. Yet, as we pointed out in the Introduction to this book, merely using such an object-oriented language doesn't guarantee that the applications you produce will be true to this paradigm! You must be knowledgeable in both (a) how to design an application from the ground up to make the best use of objects and (b) how to apply the language correctly, our two primary intents of this book.

C# Is Free

One last valuable feature of C# that we'll mention is that it's free! You can download the C# compiler and all other libraries and utilities you'll need from the Microsoft Developer Network (MSDN) web site at no cost. We go into the details of setting up C# on your machine in Chapter 13 and Appendix C.


Team LiB
Previous Section Next Section