Introduction to C # syntax and Miscellaneous

Source: Internet
Author: User

The home page in the garden has been in the so-called C # Big debate and language battle, and the wind and the fire have continued for nearly a month, and I think it should have been over for a while.

I will only write down my opinion here.

1. C # syntax sugar

Before that, whenever someone asks me about a new language feature of C #, I always say that this is actually the same thing. He is just a syntactic sugar and there is nothing unusual about it, you can take a look at the decompilation of reflector.Code.

But now, after careful consideration, I found that the syntactic sugar is not only for our convenience, but also represents a change in programming mode and thinking mode.

In the simplest wayArticleSpeaking of this, the core of a process-oriented language lies not in functions, but in the process of processing things. functions are only available for the purpose of code standardization and maintainability. However, after we organize several functions into our class libraries, in addition to being easy to use, we need to improve our logic hierarchy and crude the original fine-grained logic.

I saw this example in the winter-CN article. I put the elephant in the refrigerator and divided it into several steps. The first, the second, and the third, the ivovy boss replied to this sentence, language Development is to turn these steps into one step: loading elephants into refrigerators. I strongly agree that this is the future direction of language development.

In my previous article "natural language-based software engineering andProgramIn design, I talked about the future direction of language development as natural language-based programming. I also talked about an ideal situation where people who can speak can write programs. Even if we don't put our eyes so far, I think that it is totally impossible for people who understand the business logic to program.

Next, let's look at a keyword in C #3.0: var. Before that, many people said that VaR is mainly used to prevent lazy people from typing out types. In fact, I personally think that when the VaR keyword is combined with our powerful Visual Studio tool, we are advocating that we look at the problem from the perspective of team thinking.

When we call the interface provided to us at the underlying layer or use methods returned to us by other class libraries, we do not need to know the specific type of the interface. We only need to use VaR to obtain the type, then, we can use the SMART awareness of powerful vs development tools to obtain the desired attributes (or methods.

As for the FP thinking advocated by lambda expressions, I will not talk more about it.

In short, in the eyes of firelong, the C # language is becoming more and more bloated and should be simpler and simpler. I personally think that,This is not to erase the progress of C #. More importantly, it is to erase the progress of a programming thinking..

2. Language or language

At the beginning of the language generation, the competition for language seemed to have never stopped. C and C ++. Or Java and C #. Always stick to one word, and then it is difficult to win.

I am not a good man. I can't give a variety of reasons like Jeffery Zhao to oppose Java or other languages. At least in my current stage, I am not a language attacker.

I can only analyze from the perspective of Economics: every language, every popular language, and a language that occupies a certain share of the market must have its own advantages, otherwise, he will be eliminated by the market. Each language also has its own disadvantage and inapplicability. This gives birth to the development of other languages and produces a balanced relationship.

Here, I only speak managed languages. To some extent, at least to my current degree, I think it is not appropriate to develop a desktop program using a hosted language, as opposed to C ++. (I have not had much experience in developing desktop programs.) For most commercial products, whether it is the old version of fetion or the concept version of QQ, the adoption of managed language is undoubtedly a failure, and we can see that most mature desktop programs are still developed using C ++, which can indeed prove some truth.

The famous ghost 4 adopts C ++ and C # for interaction and development. It also illustrates the weakness of C # In the UI in a certain program. (Read the news and legends without confirmation)

In short, I personally think:Do not attack a language easily. each language has its applicability. Your project fails because of C #. You can only say that your project should not select C #, if C # cannot meet your project requirements, C # is a failure. This logic is obviously incorrect..

3. Language and Design Model

In my previous article, I threw out the following idea:The design pattern sacrifices the natural nature of semantics in exchange for software reusability and maintainability..

For an object-oriented language such as C #, it is essential to start from object-oriented,So what is the core of object-oriented? Each class has rules to follow..

However, in many cases, we have to resort to gof or other design patterns for scalability, reusability, and maintainability. I personally think that,The design pattern highlights the helplessness of "language "..

Therefore, integrating the design model into the language layer is not a mistake, I personally think. On the contrary, it is an inevitable trend of language development, at least an inevitable trend of object-oriented language development.When object-oriented language develops to the extreme, it should be a syntax (or "syntactic sugar") we don't need to rely on the design pattern, as long as we rely on the syntax provided to us by the language. it is enough to complete the work we can do with other design patterns. This is the development of object-oriented language..

Further, no programming mode is silver bullet, which can solve all our problems, whether it is object-oriented, process-oriented, or FP, A well-developed language should integrate various programming modes and provide programmers with an extremely high abstract of thinking. This is the direction of the future language.

 

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.