Summary of the learning process of C and C ++

Source: Internet
Author: User

Summary of the learning process of C and C ++

I was always asked by the students to learn C and C ++. I thought about it. Here is a general response.

Let's talk about it. Welcome to shoot bricks.

1. You can consider learning C.

Most of the time, we do not aim to become a language expert, but to become a problem-solving expert. Be a useful programmer and a profitable programmer. Our value will be reflected in the value of our customers, rather than the well-written language.

C ++ is an object-oriented explanation of C. C ++ expands large-scale engineering applications for C and organizes and controls complex system structures. However, I think, C ++ is still C.

After all, to solve the specific problem, every function writes a program in C mode and is process-oriented.

Therefore, if you want to learn C ++ well, I suggest that you first learn C, learn the problem-solving skills, and then discuss the ability to solve big problems. Learning how to walk and how to run.

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

Why? As I have mentioned earlier, the development process of software language is a process of data privatization, large-scale engineering applications, emphasizing high cohesion, low coupling, and modular design, keep the code as flexible and secure as possible.

This is the core and soul of modern engineering development.

Therefore, it is a convenient way to get started with C to understand structured development thinking. Because C functions are originally prepared for reuse. At the same time, the difference between global variables and private variables in cpp and their usage principles can all learn a lot about structured development.

3. Start learning C ++

C ++ is not difficult to learn. Many people think that C ++ is difficult to learn because it provides many concepts, especially objects, and is hard to understand.

However, after so many years, I have reduced this problem. In my opinion, object-oriented is only a concrete embodiment of structured program design and is a tool provided by the compiler, forcing programmers to follow an example of data privatization, the relationship between C ++ and C, the core is nothing more than this.

Now let's go back to C and look at it. If we write a global variable into a cpp and do not declare it in the corresponding H file, is it only available for this module? Is it a private variable? Can the class understand this understanding?

4. Learn C ++ deep skills

After so many years of development on the basis of the class, C ++ actually provides many in-depth concepts and looks complicated. In fact, I think it is quite simple. For example, in the template, my understanding is "Class class". Do you mean it?

Is it hard to understand the template, STL, ATL, static template library, and dynamic Template Library? It is a lot of classes, which can be used to implement the classes required by many applications, without the need for programmers to write it themselves.

Okay, STL understands it. Is it still difficult to develop generic models? The so-called generic development is actually a template to define a set of algorithm rules. However, I hope this algorithm rule can be further abstracted and the core data type should not be limited, I can use all kinds of data. In this way, I don't need to rewrite the algorithm. Do you think this is true?

I learned that C ++ and C are almost the same. If you want to learn a language again, you will be blamed.

5. Learning application development

As mentioned above, the purpose of language learning is not to make others think they are experts, but to write programs to make money. Therefore, we need to learn application development after linguistics is complete.

What is application development? I can use a language, but the customer doesn't understand it. The customer directly writes a program on Windows and what functions do I need. Why Windows? Because I used.

OK. In many cases, application development needs to respect the customer's habits. Generally speaking, the language must be developed based on a specific platform to develop meaningful applications for money. In general, the client is a Windows system and the server is Linux. These are industry habits. It is hard to say that there are various platforms such as Palm, S60, Linux, and WinCE. It depends on your target customers.

When we select the target platform, there is a question about the language to choose. In many cases, the difference between students and commercial programmers is here. Students generally have no choice but to choose what they will do, programmers in enterprises do not. First, they must evaluate the needs and learn the language that is more appropriate and does not.

OK. If we select C and C ++, We need to select the development platform. We don't need to mention VC in Windows. This is the best practice. In Linux, gcc, similar to others.

If we develop VC and use C ++, we need to consider learning MFC at this time, because this is Microsoft's standard class library, at least in Windows, it is the most authoritative, you see no. How many steps have we taken since learning to move to MFC? Isn't it necessary for MFC to learn C ++?

6. Learning MFC

When I learned about MFC, many people started to look at its system architecture. It was a bit confusing and I couldn't understand the relationship dependency diagram of that module.

Oh, actually, it's not. Just like learning language, we don't want to become an expert in MFC. Instead, we need to use MFC to develop Windows applications and make money for us. See? MFC is a means, not an aim, and aims to develop Windows programs.

In fact, in Windows, there is a set of very standard C interfaces called Win32API, which is the core of Windows standard programming. Therefore, the objective of learning MFC is to understand Windows program development, we recommend that you study Win32API first. It seems that we have returned to C again. Is C useful at the beginning?

7. Win32API

In fact, Win32APi is not difficult to learn, because although it is very large and has many interfaces, it is not necessary. We can actually make a simple Windows application, but we don't actually use that much. Make a simple Dialog and implement a function. The vast majority of interface functions you encounter are commonly used in the future. It's okay to write frequently-used notes.

The key is to understand the Windows event mechanism through WinMain at this time. This is the core, but it is actually easy to say. In the past, because your program was not supported by the system, you had to do many things on your own. For example, if you checked the mouse and keyboard input, you had to write an endless loop and keep reading it on your own. Windows said, you don't need to do these things. I do better. If you are okay, let's go. I put the messages related to you in a queue, that is, your event queue. If you are okay, you can find them. If there are any new messages, you can do things if you have any, it's okay. Is it easy?

Of course, Windows is a multi-task operating system. Sometimes, our logic requires some concurrent functions. For example, when I wait for the mouse or Keyboard Message, I need to check whether the printer is ready, now we need to understand parallel computing. It has nothing to do with the language and the operating system. This is another topic. We will not talk about it here. You can look for relevant information about thread development.

I can't see it. To learn Windows programming well, we don't only need to learn the language, but also the operating system, Parallel Computing Principle, memory principle. Sometimes we also need to learn a lot about network communication and so on, therefore, learning languages alone cannot be a commercial programmer. A qualified programmer needs to understand too many things and should be widely studied.

When we understand Win32API and the basic window program design, we can go back to MFC to continue learning. Does it mean recursive return? Haha.

8. Return to the MFC

It was difficult to learn MFC because it encapsulated too many details and was difficult to understand thoroughly. But fortunately, we have Mr. Hou's in-depth introduction to MFC. Let's look at how to change from the pure C Programming of Win32API to the c ++ method of MFC, which is the fastest, after reading the first six chapters, I will not talk about them here.

9. COM

COM, COM, and COM are my biggest headache.

COM is a remote process call, that is, the code you request runs in another process, passing parameters and results back and forth through a communication protocol. That's all. DCOM takes a step forward, and the service provider can be on another computer. In the development of the company, everyone may work together. If you want to cooperate, we recommend that you use COM in Windows (I personally like socket communication)

In short, COM provides a mechanism for cross-process communication or even cross-machine communication. However, in order to transmit various types of parameters, COM can be said to be useless. It invented a smart pointer that 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 designs. If you don't see it, the basic functions of C ++ work. It also uses ATL.

To learn about COM, pay attention to the concept of an interface. Since developers are different people, calling programs and service programs may not be in the same language. OK, you cannot simply provide a C or C ++. Therefore, COM provides a standard interface. You can obtain available interfaces through queries within the program and call them with the interface ID. Very tiring.

After learning COM, you can understand ActiveX more. Then, you can learn about dll (Dynamic Link Library) and write OCX controls. Generally speaking, the OCX control is a good design, which can be used everywhere. A software module is ideal for development and is 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.