Learn C (1)
I now understand C
/ * Various reasons, many energy should be put into Java learning and use, want to form a series of articles learning C , there is no style, there is no timetable, think of where to write. Here, a part of an article published by yourself another ID as the first one of this series, is it started. * /
Learn C focus on understanding the semantics represented by its various language facilities, as well as the design idea representing the semantics they can expressed by C . First start from macro, you need to understand that C is the essence of programming language. Here I write C most important nature: C is a static type check, based on C memory mode, support four basic programming models. Note that three essential characteristics are described, static illustrate the type check nature of the language, telling us that all the operations related to memory in C need to be responsible, so that many design programs have brought a lot of design programs Where you need to pay attention, it is understood that the four basic models supported are the basis for understanding various language facilities. Then remember the biggest design philosophy of C , which is also an essence of the application C . I cited a sentence in the "C Primer" Chinese version of the preface - "C foundation is a variety of facilities, they allow users to pass Define new data types to extend the language itself, these new types can be used as the built-in type (how to understand this sentence is key, my understanding is: User defined type can be used as its replacement when using the built-in type The user defined type can be declared like a built-in type, which can be initialized, can be copied to each other, can be used with many operators like a built-in type object, which can be passed to a function as a parameter, As the return value of the function, it can be used as an operation object of the container, and the user-defined type can be used as a template as a template as a built-in type. (Which facilities are to allow the user to define the type as the built-in type, as convenient, including the facility, including What is the first step in constructive, copy, deconstruction functions, operational secondary overload ....., is to understand the basic language (what is the basic language? It is C Better C part).
Here, I still want to make a very important concept: the most essential thing in a language is its type system, any language has its own unique type system, learning C is learning his type system. So first, you need to thorough understand what is the concept of data type. So your ideas are clear, you have selected, learn from each C support design.
Structured design ----- is also the Better C part in C , you need to overload and reference these two most important languages on the basis of C.
Object-based - you need to build C most powerful concepts - class, which is the user-defined type, which is actually the concept of abstract data types in the data structure, and a series of language measures for reasonable constructing classes. And always remember that the design is used in C to indicate the concept we need to represent. Class is also the core concept in the C abstract mechanism.
Object-oriented - here you need to know the OO concepts such as inheritance and polymorphism, as well as such common design technology such as the handle, here you need to understand that you started to enter the interface programming. At the same time, you have to learn OO thinking, and some of C facilities are just sufficiently expressed in the semantics supported by OO thinking. However, here, you need to understand that the Semantics expressed by C is limited by its original language design principles (what principles? Static type check, not pay for unwanted things, the option is in the hands of the programmer itself To force programmers to make a choice, that is, the OO idea that C can represent can be called OO thinking with C features. Which of this OO thinking and the pure OO represented by Java? Didn't contrast, because their own design concept is different. Wild design ---- Here you need to understand the most important thing is that the C TemLate mechanism is what the original intention is what the original intention is, now the true meaning of his representation is: This understands the core of genericity - the specificity of various types as an abstract condition, can C measures to define abstract conditions? No, this condition can only be defined in our own heart, but we can use the type of avatar as an abstract condition to be realized in the template mechanism, so that TemPalte will become further more further than the type derivation mechanism, that is Abstract conditions derived. That is, we no longer see the parameters accepted by the template as a type, but to regard the template as a mechanism to accept abstract conditions, regardless of its type, as long as this type meets the abstract conditions accepted by TemPalte. As a parameter, it means a generic thought ----- type is no longer fundamental, abstract condition is that the type is just an abstract condition of the outer garment and implementation in C . Industrial products that are technically born in combination with object and generic design patterns --- STL.