Is it necessary for beginners to adhere to object-oriented design at all times?

Source: Internet
Author: User
Sometimes it is not appropriate to abstract the desired function into a class, it can only be implemented in a process-oriented way (even if there is no way to integrate into a function), then how to do it? Will the habit of "let the code run as expected and refactor later" negatively affect the future?

Reply content:

No, because it is impossible to learn so early. Learn to write code before you get to object oriented. Of course, this is not to let you do not use class, anyway beginners casually use, more use of excrement, after the best practice will understand more profound. In order to solve the problem to Oo is the right thinking, in order to Oo to oo that is sick, hopeless do not need, first of all, not all problems are suitable for the object-oriented solution, and then for beginners, the consolidation of the foundation is more important; If you want to learn to object-oriented, you might as well have done before the practice of the object


Follow my "Node Flash" column, 15 minutes to get started with a node/front-end skill that provides all the source code. Not everything has to be a class, object-oriented is just a way of doing things. If you really want to Oo Oo, a small program can be written very large, and there is no egg, because the class too much redundancy, is still not good maintenance.

Again, many times you can only "write to let code to run" This step, refactoring is still far away, a lot of projects probably even the opportunity to reconstruct is not round. The road of sword, need to view each family sword, from the complex into Jane, from out of the most general jurisprudence, to form their own understanding of the sword.
Then need to be simple into the complex, the general legal arrangement of the combination of the formation of their own sword.
The way of programming is also the first to have an object, and then to write to her code to write more, and so you back to use the framework (QT,WPF ... ), will read the mantra, and then learn these good framework of packaging ideas, at least the factory model you can learn.

I study c when each of the data structure of each algorithm to write their own, and then learned c++,java,c# later found that these things can have ready-made and used up so convenient, and then naturally learned to object-oriented. Process-oriented writing for processes.

After all, you are a beginner, do not know how to object-oriented.

At least it can be tolerated.
  • 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.