C # interview with head Architect Anders Hejlsberg

Source: Internet
Author: User
Tags microsoft c

John Osborn, editor of o'reilly, attended the Microsoft Professional Developer Conference on October 13, July. Here, he interviewed Anders Hejlsberg, a famous engineer and chief architect of Microsoft. Net Framework C # language. Anders Hejlsberg is widely known for designing Turbo Pascal, one of the earliest languages on PCs. He licensed Turbo Pascal to Borland and led the team to create Delphi, an extremely successful visual client/server application design tool. At the time of the visit, there were Microsoft C # product manager Tony Goodhew and OReilly's Windows Editor Ron Petrusha.

Osborn:

I have seen some news stories about C # (pronounced "See sharp"), and I have noticed that there are a lot of opinions that seem to tend to be like this, or theoretically, C # cloning of Java or Microsoft replacement of Java. If you are doing propaganda, how do you want people to comment on this language?

Hejlsberg:

First, C # is not a Java clone. During the design of C #, we studied many languages, C ++, Java, Modula 2 and C, and Smalltalk. Many languages share the same core idea we are interested in, such as deep object-oriented and simplified object (object-simplification.

C # the key difference between C # and these other languages, especially Java, is that it is very close to C ++, which is produced by our efforts in our design. C # borrowed most operators, keywords, and declarations from C ++. We also retain many language features abandoned by Java. Why is there no enumeration in Java? I mean, what is the theoretical basis for abandoning them? In C ++, enumeration is obviously a very meaningful concept. In C #, we keep enumeration and keep its type safe. In addition, enumeration is not just an integer. They are actually strongly typed value types derived from System. Enum in the. NET base class library. If no styling conversion is performed, the enumeration type "foo" and enumeration type "bar" are not interchangeable. I think this is an important difference. We also retain Operator Overloading and type conversion. The overall structure of the C # namespace is very close to that of C ++.

However, beyond these traditional language topics, a key goal of our design language is to make C # component-oriented. We add all the concepts you need when writing components to the language itself. For example, properties, methods, events, attributes, and documentation are all first-class language components. Our work on features is brand new and innovative, and features can be used to add type and scalable metadata to any object. This is not seen in any other programming languages currently. C # is also the first language to merge XML annotation labels. the compiler can use it to generate readable documents directly from the source code.

Another important concept is the one-stop-shopping software ). Once you write code with C #, you write everything in an integrated manner. Header files, IDL (Interface Definition Language) files, GUIDs, and complex interfaces are no longer required. Because it is a self-contained unit, once you can write self-described code in this way, you can embed your software into ASP pages or implant various environments, this was previously impossible.

Let's go back to these key component concepts. There is a lot of debate in the industry regarding whether the language should support attributes or events. Yes, we can express this concept in a way. We can use block naming patterns such as "get" or "set" to simulate attribute behavior. We can use the interface and the adapter that implements the interface and forward it to the object. This is all possible, just like object-oriented programming in C. But it is more difficult and requires more manual work. In order to truly express your thoughts, you have to do all the work in the end. We think it is time to use a language to make it easier to create components. In the past few years, developers have been creating software components. They do not create the entire application or the entire class library. Everyone is creating components inherited from the base components provided by the host environment. These components reload some methods and properties, process events, and install the components back to the system. Establishing these concepts is the key first lesson.

Osborn:

When you recently introduced C #, the first slide says, "the first component-oriented language in the C/C ++ family ".

Hejlsberg:

Yes. This is one of my primary goals. It is also critical that we talk about how everything is an object. It was previously possible for both Smalltalk and Lisp languages to do this, but it was expensive. I think C # contains some beautiful and interesting innovations to make component development easier. For example, the concept of packing and unpacking. Packing can convert a value type value into an object, and unpacking can convert an object into a simple type value. This may have existed before, but the way we apply it to language is a beautiful innovation.

We strive to avoid designing C # And. Net frameworks in the form of an ivory tower. We cannot afford to rewrite all of our software. The industry cannot afford it, especially today we are moving to the Internet era. You must be good at using what you already have. Therefore, I think interoperability is also critical. We are committed to providing programmers with all appropriate Internet-compliant interoperability solutions, such as HTTP, HTML, XML, and existing Microsoft technologies. So you won't find a new one when you fall into the abyss. NET Framework does not provide something you use, or when you realize that you want to use some existing APIs or components. You have seen that we have built all COM interoperability capabilities into the language and general runtime; you have seen that you can use the DllImport feature to import existing DLL (dynamic connection library ); you have seen that even if none of them can fulfill your expectations, we also have the concept of Insecure code. Insecure code allows you to write inline C code using pointers, which can perform insecure styling conversion and suppress memory so that it will not be accidentally spam collected.

Related Article

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.