C# Introduction and Overview
Currently, C and C++ are the most widely used languages for developing commercial and business software. While both languages provide the programmer with a tremendous amount of fine-grained control, this flexibility comes at a cost to productivity. Compared with a language such as Microsoft Visual Basic, equivalent C and C++ applications often take longer to develop. Due to the complexity and long cycle times associated with these languages, many C and C++ programmers have been searching for a language offering better balance between power and productivity.
C and C++ programmers have dreamt of a world where rapid code development and raw horsepower would provide access to all the functionality of any underlying platform. This ideal environment would also provide an environment that is completely in sync with emerging Web standards and one that provides easy integration with existing applications. Additionally, C and C++ developers would like the ability to code at a low level when and if the need arises. The Microsoft solution to this problem is a language called C#.
C#The Broad Spectrum
C# is a modern, object-oriented language that enables programmers to quickly build a wide range of applications for the new Microsoft .NET platform, which provides tools and services that fully exploit both computing and communications. C# is a great choice for developing a wide range of componentsfrom high-level business objects to system-level applications. Using simple C# language constructs, these components can be converted into Web services, allowing them to be invoked across the Internet from any language running on any operating system.
More than anything else, C# is designed to bring rapid development to the C++ programmer without sacrificing the power and control traditionally reserved for C and C++. Because of this heritage, C# has a high degree of fidelity with C and C++. Developers familiar with these languages can quickly become productive in C#.
In today's burgeoning and profitable Web economy, where competitors are just one click away, businesses are being forced to respond to competitive threats faster than ever before. Developers are called upon to shorten cycle times and produce more incremental revisions of a program, rather than a single monumental version. C# is designed with these considerations in mind. The language is designed to help developers do more with fewer lines of code and fewer opportunities for error.
C# and New Web Standards
Today's Web-based solutions require the use of new emerging Web standards like Hypertext Markup Language (HTML), Extensible Markup Language (XML), and Simple Object Access Protocol (SOAP). Existing development tools were developed before the Internet or when the Web as we know it today was in its infancy. As a result, they don't always provide the best fit for working with new Web technologies. C# programmers can leverage an extensive framework for building applications on the Microsoft .NET platform.
C# includes built-in support to turn any component into a Web service that can be invoked over the Internetfrom any application running on any platform. Even better, the Web services framework can make existing Web services look just like native C# objects to the programmer, thus allowing developers to leverage existing Web services with the object-oriented programming skills they already have.
If current trends continue, XML will be the standard used to pass structured data across the Internet. Such data sets are typically very small. In this environment C# really shines; for example, to improve performance, C# allows XML data to be mapped directly into a struct data type instead of a class. This is a more efficient way to handle small amounts of data.
C# Makes You a Better Programmer!
Ask yourself this question, "How many times have you used an uninitialized variable in your code?" Even expert C++ programmers can make this simple mistake which can lead to unpredictable problems that can remain undiscovered for long periods of time. Once a program is in production use, it can be very costly to fix even the simplest programming errors. The modern design of C# eliminates the most common C++ programming errors. C# empowers the traditional C/C++ programmer by providing:
Automated garbage collection that relieves the programmer of the burden of manual memory management
Automatically initialized variables
C# is a language that makes it far easier for developers to create and maintain applications that solve complex business problems.
C# Enhances an Application's Longevity
Adding software components to an existing product has always been an error-prone task. Code modifications can unintentionally change the semantics of an existing program. C# solves this problem by including versioning support. For example, method overriding must be explicit and cannot happen inadvertently as in C++ or Java. This helps prevent coding errors and preserve versioning flexibility. A related feature is the native support for interfaces and interface inheritance. These features enable complex frameworks to be developed and evolved over time. When combined, these features make the process of developing later versions of a project more robust and thus reduce overall development costs for the successive versions.
Accurate Transitions from Design to Implementation
For rapid and accurate code development it is necessary to have a close connection between an abstract business process and the actual software implementation. Unfortunately, most language tools don't have an easy way to link business logic with code. The C# language aids this transition by allowing typed, extensible metadata that can be applied to any object.
A project architect can define domain-specific attributes and apply them to any language element classes, interfaces, and so on. The developer can then programmatically examine the attributes on each element. This makes it easy, for example, to write an automated tool that will ensure that each class or interface is correctly identified as part of a particular abstract business object, or simply to create reports based on the domain-specific attributes of an object.
Many programmers are forced to use C++ even when they would prefer to use a more productive development environment because real-world experience has shown how some applications demand the use of "native" code to manage a type-safe environment for performance reasons or to interoperate with existing application programming interfaces. C# solves these problems by:
Supporting native support for the Component Object Model (COM) and Windows_-based APIs.
Supporting restricted use of native pointers.
Implementing every object as a COM object.
No longer will developers have to explicitly implement COM interfaces. Instead, those features are built in. C# programs can use existing COM objects, no matter what language was used to author them. C# includes a special feature that enables a program to call out to any native API.
Inside a specially marked code block, developers are allowed to use pointers and traditional C/C++ features such as manually managed memory and pointer arithmetic. This is a huge advantage over other environments. It means that C# programmers can build on their existing C and C++ code base rather than discard it. In both casesCOM support and native API accessthe goal is to provide the developer with essential power and control without having to leave the C# environment.