Introduction to C #

Source: Internet
Author: User
Tags abstract inheritance object model versions

In the past 20 years, C and C + + have become the most widely used language in the field of commercial software development. They provide a very flexible operation for programmers, but at the same time sacrificing a certain amount of efficiency. As with languages such as Microsoft Visual Basic, it is often more time-consuming for an equivalent level of C + + applications to be developed. Due to the complexity of C + + language, many programmers are trying to find a new language, hoping to have a more ideal trade-off between function and efficiency.

There are languages at present that increase efficiency at the expense of flexibility. But these are the flexibility that C + + programmers need. These solutions are too restrictive for programmers, such as masking some of the underlying code-control mechanisms, and provide less satisfying functionality. These languages cannot be easily interacted with earlier systems, nor can they be combined well with current network programming.

The most ideal solution for C + + users is to quickly develop and invoke all the functionality of the underlying platform. They want an environment that is synchronized with the latest network standards and can be well integrated with existing applications. In addition, some C + + developers need to do some low-level programming when necessary.

Microsoft launches C #

C # (C Sharp) is Microsoft's solution to this problem. C # is an up-to-date, object-oriented programming language. It allows programmers to quickly write various Microsoft based. NET platform application, Microsoft. NET provides a range of tools and services to maximize the development of computing and communications.

It is precisely because of the C # object-oriented design that makes it ideal for building a variety of components-whether it is a high-level business object or a system-level application. With a simple C # language structure, these components can be easily translated into XML network services so that they can be invoked by any language on any operating system over the Internet.

Most importantly, C # enables C + + programmers to develop programs efficiently without losing the powerful functionality of C + +. Because of this inheritance relationship, C # is very similar to C + +, and developers familiar with similar languages can quickly turn to C #.

Efficiency and safety

The emerging cyber economy has forced business companies to respond more quickly to the threat of competition. Developers have to keep shortening the development cycle and rolling out new versions of the application, rather than just developing a "landmark" version.

C # is designed with these issues in mind. It allows developers to do more with less code, and it's not easy to make mistakes.

Support existing new standards for network programming

The new application development model means that more and more solutions depend on emerging network standards, such as HTML,XML,SOAP. Existing development tools tend to occur earlier than the Internet or when the network we know is still in gestation. Therefore, they generally do not support the latest network technology well.

C # programmers can be at Microsoft. NET platform to build an extension framework for your application. C # contains built-in features that allow any component to be easily transformed into an XML Network service that is invoked by any program running on any operating system over the Internet.

What's more, the XML Network Service Framework enables existing XML network services to be the same for programmers as C # objects. In this way, programmers can easily use the object-oriented programming techniques they already have to develop and leverage existing XML network services.

There are also some fine features that make C # a first-class network programming tool. For example, XML is becoming a standard for transferring structured data over a network. This collection of data is often very small. To improve performance, C # allows XML data to be mapped directly to struct data types, rather than class. This is very effective for processing small amounts of data.

Eliminate a large number of program errors

Even expert C + + programmers often make some of the simplest bugs-such as forgetting to initialize variables-but often these small errors bring unpredictable problems, some even take a long time to find and solve. Once a program is used as a product, even the simplest mistakes can be put to a very expensive price to correct.

The modern design of C # can eliminate many common C + + programming errors. For example:

1. Resource recovery eases the burden of programmer memory management.

2. Variables in C # are automatically initialized by the environment.

3. Variables are type-safe.

This makes it easier for programmers to write and maintain programs that solve complex business problems.

Provides intrinsic support for version updates and lowers development costs

Updating software Components is a very error-prone task, because changes to the code may inadvertently change the semantics of the original program. To help developers with this work, C # provides intrinsic support for version updates. For example, a method overload must be explicitly declared. This prevents coding errors and guarantees the flexibility of the version update. A related feature is the intrinsic support for interface and interface inheritance. These features enable C # to develop complex frameworks and update them as time progresses.

In general, these features make the process of subsequent versions of the development program project more robust, thereby reducing the development costs of subsequent versions.

Better correspondence between business processes and software implementations

The business plan of an enterprise should be put into reality, and it must be closely related to the abstract business process and the actual software implementation. But most languages are hard to do this. For example, today's program workers generally use code annotations to indicate which class corresponds to an abstract business object.

The C # language allows type-defined, extended metadata. These meta data can be applied to any object. Project builders can define domain-specific attributes and apply them to any language element-class, interface, and so on. The developer can then programmatically examine the attributes of each element. In this way, a lot of work becomes more convenient, such as writing a gadget to automatically check that each class or interface is correctly defined as part of an abstract business object, or simply create a report based on the domain-specific properties of the object. The close correspondence between the custom metadata and the program code helps to strengthen the correspondence between the expected behavior of the program and the actual implementation.

Extended interactivity

As an automatically managed, type-safe environment, C # is suitable for most enterprise applications. But the practical experience shows that some applications still need some low-level code, either because of performance-based considerations or because they are compatible with existing application interfaces. These situations may force developers to use C + +, even if they themselves prefer to use a more efficient development environment.

C # uses the following countermeasures to solve this problem:

1. Built-in support for the Build object Model (COM) and windows-based APIs;

2. Allow restricted use of pure pointers (Native pointer).

In C #, each object is automatically born as a COM object. Developers no longer need an explicit implementation of IUnknown and other COM interfaces. These features are built in. Similarly, C # can invoke an existing COM object, regardless of the language in which it was written.

C # contains a special feature that allows a program to invoke any pure API. In a specially tagged code, the developer can use pointers and traditional C + + features such as manual memory management and pointer operations. This is a great advantage relative to other environments. This means that a C # programmer can write a program based on the original C + + code, rather than completely discarding the code.

Both COM and pure API calls are designed to enable developers to have the necessary powerful functionality directly in the C # environment.

Conclusion

C # is a kind of modern object-oriented language. It makes it quick and easy for programmers to create Microsoft based. NET Platform Solutions. This framework makes it easy for C # components to be transformed into XML network services so that any platform's applications can invoke it over the Internet.

C # enhances the efficiency of developers while also working to eliminate errors that can lead to serious results in programming. C # makes it possible for C + + programmers to quickly network development while maintaining the power and flexibility that developers need.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.