Learning C and C + + 9 points of experience summary _c language

Source: Internet
Author: User

is always asked, how to learn C and C + + is not at a loss, is not chaos, think about it, here gives a general reply.

Opinion, welcome to the brick-ha.

1, you can consider learning C first.

Most of the time, the purpose of language learning is not to become a language expert, but rather 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 the customer, not the language is not good to write.

C + + is an object-oriented interpretation of the C. C + + for the expansion of large-scale engineering applications, complex system structure of the Organization and control methods, but, I think, C + + in its bones or c.

After all, solving specific problems, within each function, are written in C to write the program, or process-oriented.

Therefore, want to learn good C + +, my suggestion, first learn C, first learn to solve problems, and then discuss the ability to solve big problems. is to learn how to walk first, and then learn how to run.

2, learning the process of C, must understand the structured programming thinking.

Why, I have said before, 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 of thinking, can be said to be a very convenient path. Because C's functions are intended for reuse. At the same time, the difference between the global variable and the internal private variable of CPP, its use principle, these can learn a lot of structured development thinking.

3. Start learning C + +

C + + is not difficult to learn, many people think that C + + difficult to learn, in fact, because it is outside the C, but also provides a lot of concepts, especially objects, very difficult to understand.

However, after all these years, I think the problem is rather weak, I believe that object-oriented relative to the process, is only a concrete embodiment of structured design, is the compiler to provide means, forcing programmers to follow the data privatization of an example, C + + and C relationship, the core of this.

Now we go back to C and look, if we put a global variable, write to a CPP, and in the corresponding H file does not declare, it is not the only module can be used? Is it a private variable, so that the class can understand it?

4, learn the depth of C + + skills

C + + On the basis of the class, after so many years of development, in fact, provides a lot of in-depth concepts, looks very complicated, in fact, I think it is very simple. For example, the template, my understanding is "class class", we say is not?

Now that the template is understood, stl,atl these, static template library, dynamic Template Library, still difficult to understand? is a large number of classes, you can use this to achieve a lot of applications need classes, do not need the programmer to write their own.

Ok,stl understand, generics development is still difficult? 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 further abstract, the core data types do not limit the death, I put a variety of data into, can be used, so, only the algorithm this part, I don't need to rewrite it. Do you think this is the truth?

Learn here, C + + and C, in fact, is almost. To learn the language, is jellyfish, too much.

5. Learning Application Development

As I said before, the purpose of learning a language is not to make others think of themselves as experts, but to make money by writing programs. Therefore, the completion of linguistics, to learn application development.

What is called application development, I will a language, but, customers do not understand, the customer said very directly, under Windows to write 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, can develop a meaningful application to sell money. Then, 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. Be based on your target customers.

When we select the target platform, there is a problem, choose what language, a lot of times, students and business programmers are different here, students generally have no choice, what they will use what Bai, the Enterprise programmer will not, to assess the needs first, see which language 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 learn from the beginning, how many steps to go to MFC? is MFC not learning C + + You have to learn to come up here?

6, Learning MFC

Learn MFC, a lot of people began to look at its architecture, see confused, that module dependency graph, I can not read now.

Oh, actually not, and learning language, we learn the purpose of MFC, also not 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 a goal, to develop Windows programs.

In fact, Windows, a set of very standard C interface, called Win32API, this is the standard programming core of Windows, so, learning MFC, the real purpose is to understand the development of Windows, the proposal can learn win32api, it seems we have to go back to C ha, hehe. Is it useful to learn C at first?

7, Win32API

In fact, Win32API is not difficult to learn, because although it is very large, there are many interfaces, but not necessarily, we really do a simple Windows application, in fact, not so much. Do a simple dialog, and then implement a function, you encounter the interface function, in fact, most of the later used. Use the commonly used notes skillfully, just OK.

The point is that this is the time to understand the Windows event mechanism by WinMain Way, which is the core, in fact, simple to say to death. Before your program, because there is no system support, a lot of things must be done by themselves, such as checking the mouse and keyboard input, you need to write a dead loop, you keep looking, and Windows said, these things you do not do, I do better than you. You have nothing to play on it, I put and you related to the message into a queue, is your event queue, you have nothing to look for, there is no new news, have 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 be concurrent, for example, when I wait for the mouse keyboard message, I need to see if the printer is ready, and there's a need to understand parallel computing, which is not about language, it's not about the OS, it's another topic, Here is not much to say, you can find the thread development of the relevant information to see.

See, 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 theory, may sometimes also need to learn network communication, and so many knowledge, so that learning language alone, is not a commercial programmer, a qualified programmer, There are so many things that need to be understood, so much to learn.

When we understand the WIN32API and the Basic windowing program, we can go back to MFC and continue to learn. Is it a bit recursive to return the meaning? hehe.

8, Back to MFC

It is difficult to learn MFC, because it encapsulates too many details, it is difficult to understand thoroughly. But fortunately, we have Hou teachers in simple and simple MFC, to find the original to see how, from the Win32API of pure C programming, to change the MFC C + + way, see this fastest, basically the first 6 chapters read, has been, here I will not say more.

9, COM

com, com, com, I have the most headaches of COM, hehe.

COM is a remote procedure call in which the code you request is run in another process, passing parameters and results back and forth through some kind of communication protocol. That's all. DCOM took a step and the server could be on another computer. In the development of the company, you may do a piece, if you want to cooperate, Windows recommended more use of COM. (I personally like socket communication ha)

Simply put, COM provides a mechanism to communicate across processes, even across machines. However, in order to pass the various types of parameters, COM is the most useless, it invented the smart pointer, can point to any type of data, at the same time, in order to implement smart pointers, it uses a large number of C + + generic design, see no, C + + basic functions, but also used ATL

Learn COM, pay attention to the concept of an interface. Since developers are different people, calling programs and service programs may not be the same language, OK, can not simply provide a C or C + +. H file to answer the interface, so COM provides a standard interface, in which the user obtains the available interfaces in a query, and then invokes them with the interface ID. It's exhausting.

Learn to COM, you can understand a little more ActiveX, then learn a little DLL (dynamic link library) of knowledge, we can already write OCX control. Generally speaking, OCX control is a very good design, which can be used, a software module, the ideal is to develop into this look, more flexible than EXE.

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.