Always asked by the students, how to learn C and C + + is not vacant, it is not disorderly learning, think about, here give a total reply.
Opinion, welcome to shoot Brick ha.
1, you can consider learning C first.
Most of the time, the purpose of our language learning is not to become a language expert, but to be a problem-solving expert. Be a useful programmer and be a money-making programmer. Our value will be reflected in the value of customers, not the language is not good.
C + + is an object-oriented interpretation of a, C + + for the expansion of large-scale engineering applications, complex system structure of the Organization and control methods, but I think, C + + bones or C.
After all, the solution to the specific problem, within each function, is the C-way to write the program, or process-oriented.
Therefore, want to learn good C + +, my advice, first study C, first to learn the ability to solve problems, and then discuss the ability to solve large problems. is to learn how to walk first, then learn how to run.
2, in the process of learning C, we must understand the structured programming thinking.
Why, I have earlier article said, the development of software language is a process of data privatization, large-scale engineering applications, emphasizing high cohesion, low coupling, modular design, to maintain the maximum flexibility and security code.
This is the core and soul of modern engineering development.
Therefore, the use of C this language to get started, to understand the structural development thinking, can be said to be a very convenient path. Because C's function is intended for reuse. At the same time, global variables and CPP internal private variables, the use of the principle, these can learn a lot of structured development thinking.
3. Start learning C + +
C + + is not difficult to learn, many people think C + + difficult to learn, in fact, because it in C, but also provides a lot of concepts, especially objects, very difficult to understand.
But after all these years, I have seen the problem, I think object-oriented relative process, is only a concrete embodiment of structured programming, is the compiler to provide means, forcing programmers to follow the data privatization of an example, C + + and C relationship, the most core of this.
Now we go back to C and look, if we put a global variable, write to a CPP inside, and in the corresponding H file does not declare, it is not only this module can be used? Is it a private variable, to this understanding, the class can understand?
4. Learn C + + in-depth skills
C + + On the basis of the class, after so many years of development, actually provides a lot of in-depth concept, looks very complex, in fact, I see is very simple. For example, the template, my understanding is "class of class", people say is not?
Since the template understands, Stl,atl these, static template library, dynamic Template Library, still difficult to understand? is a bunch of classes that can be used to implement many of the classes in the application, do not need the programmer to write their own.
Ok,stl understand, is it difficult to develop generics? The so-called generic development, in fact, I do a template to define a set of algorithm rules, but I hope this algorithm rules, can be further abstracted, to the core data type do not limit death, I put all kinds of data into, can be used, so, only the algorithm this part, I don't need to rewrite it. Do you think that's the truth?
learned here, C + + and C, in fact, have been almost. To learn language again is to demand perfection, too much.
5. Learning Application Development
Said before, the purpose of learning language, not to let others think they are experts, is to write programs to make money. Therefore, when linguistics is finished, it is needed to learn application development.
What is the application development, I will a language, but, the customer does not understand, the customer said very directly, under Windows to write me a program, I want what function. Why Windows? Because I'm used to it.
OK, many times, application development to respect customer habits, generally speaking, language, or to combine the development of specific platforms, to develop meaningful applications to sell. Well, generally speaking, the client is a Windows system, the server is Linux, these are industry habits, embedded bad, all kinds of platforms have, palm,s60,linux,wince, and so on. According to their own target customers to decide.
When we select the target platform, there is a problem, choose what language, many times, students and business programmers difference is here, students generally have no choice, what they will use Bai, the enterprise programmer will not, to assess the needs first, to see which language is more appropriate, not the language, to learn.
OK, assuming we choose c and C + +, then we need to choose the development platform, Windows Needless to say, VC, this is the best use, Linux, GCC, the other is similar.
If we develop VC, and use C + +, this time, only need to consider learning MFC, because this is the standard class library of Microsoft, at least under the Windows platform, it is the most authoritative, you see no, we start from the study, how many steps to go to MFC? is not MFC is not learning C + + You have to learn to come up?
6. Learning MFC
Learning MFC, a lot of people began to look at the system architecture, see confused, the module relationship dependency diagram, I have not read it.
Oh, actually not, and learn the language, we learn the purpose of MFC, nor want to become an expert in MFC, but to use MFC to develop Windows applications, for us to make money. Did you see that? MFC is a means, not an objective, to develop Windows programs.
In fact, Windows, a set of very standard C interface, called Win32API, this is the standard Windows programming core, so, learning MFC, the real purpose is to understand the Windows program development, suggest that you can learn win32api, it seems we went back to C ha, hehe. Is it useful to start learning C?
7, Win32API
In fact, Win32API is not difficult to learn, because although it is very large, there are many interfaces, but not necessary, we really do a simple Windows application, in fact, not so much. To do a simple dialog, and then implement a function, you encounter the interface function, in fact, the vast majority, is commonly used later. The usual proficiency in the mind, OK.
The point is, this time through the WinMain way, to understand the Windows event mechanism, this is the core, in fact, it is simple to die. is before your program, because there is no system support, a lot of things must do their own, such as checking the mouse and keyboard input, you need to write a dead loop, you constantly go to see, and Windows said, these things you do not, I do better than you. You are OK to play, I put the relevant information and you put in a queue, is your event queue, you have nothing to look for, there is no new news to do things, nothing to play well. It's simple, isn't it?
Of course, Windows is a multitasking operating system, sometimes, our logic needs to concurrency some functions, for example, I am waiting for the mouse keyboard message, I need to see the printer is ready to do not, here need to understand the parallel computing, which is not language-independent, and operating system-independent, this is another topic, There is no more to say, you can find out the thread development of the relevant information to see.
See no, in order to learn good Windows programming, in fact, we need not only to learn the language, but also to learn the operating system, the principle of parallel computing, memory principle, may sometimes need to learn network communication, and so many knowledge, so that, by learning language alone, is not a commercial programmer, a qualified programmer, Need to understand the things, too much, to learn widely.
When we understand the WIN32API, as well as the basic windowing programming, we can go back to MFC to continue learning. is not a bit recursive return meaning? hehe.
8. Back to MFC
The original learning MFC difficult, because it encapsulates too much detail, it is difficult to understand thoroughly. But fortunately, we have Hou Teacher's simple words MFC, to find out how to look, how to Win32API pure C programming, change to MFC C + + way, see this the fastest, basically the first 6 chapters to read, has been, here I will not say more.
9. COM
com, com, com, my most headache of COM, hehe.
COM is a remote procedure call where the code you are requesting runs in another process, passing parameters and results back and forth through some kind of communication protocol. That's all. DCOM is in a step, and the server can be on another computer. In the development of the company, everyone may do a piece, if you want to cooperate, Windows recommends more use of COM. (I personally like socket communication ha)
Simply put, COM provides a mechanism to communicate across processes and even across machines. However, in order to pass various types of parameters, COM is a fair bet, it invented a smart pointer, can point to any type of data, and in order to implement smart pointers, it uses a large number of C + + generic design, see no, C + + 's basic function, but also use ATL.
To learn COM, pay attention to the concept of an interface. Because developers are different people, calling programs and service programs, may not be the same language, OK, cannot simply provide a C or C + +. H file to answer the interface, so COM provides a standard interface that the consumer obtains from within the program by querying the available interfaces, and then invoking them as an interface ID. It's tiring.
Learn com, you can understand a little more ActiveX, then learn a little DLL (dynamic link library) knowledge, we can already write the OCX control. In general, OCX control is a good design, which can be used, a software module, the most ideal is to develop into this look, more flexible than EXE.
C and C + + learning process Summary