JavaScript-does object-oriented need to be process-oriented, and what are the similarities and differences between component and modularity?

Source: Internet
Author: User
Predecessors, the object-oriented all need to face the process first?
When it comes to object-oriented programming, how can the logical relationships between objects be quickly combed and positioned?
Where does object-oriented agility manifest itself?
Object-oriented for the more heavy-duty development, ordinary JS write small effects such as the carousel also need to object-oriented?
What are the similarities and differences between object-oriented and component-based JavaScript, and what are the similarities and differences with modularity?

Reply content:

Predecessors, the object-oriented all need to face the process first?
When it comes to object-oriented programming, how can the logical relationships between objects be quickly combed and positioned?
Where does object-oriented agility manifest itself?
Object-oriented for the more heavy-duty development, ordinary JS write small effects such as the carousel also need to object-oriented?
What are the similarities and differences between object-oriented and component-based JavaScript, and what are the similarities and differences with modularity?

The problem involves too much to say.

In software development, the process is absolute, and program = The orderly execution of the process. In fact, there was no process-oriented concept before, but after an object-oriented appearance, in order to differentiate that approach from the way in which it was previously used to organize code, then the code used to organize the function is process-oriented. (Personal opinion only)
Object-oriented is a kind of code organization, a variety of benefits, your own random search on the line.

The above shows that the process or object-oriented refers to the way the code is organized, while the components and modularity refer to how the functions in the project are organized, so they are irrelevant.

Module damage in microelectronic repair as long as the module is replaced, it extends to software development, where modularity refers to the explicit encapsulation of code, with definite scopes rather than affecting the entire project.
The various tools used in the daily life are the component ideas, and the components are often widely reused without being limited by the scope of the module.

As for your various questions, the last is the same answer: depending on the needs, to meet the requirements of the good. Note that the readability, elasticity, and maintainability of code are part of the requirements, which is very, very important.

Very simple comparison:

//最简短的代码是1行alert('Yeah');//最简短的函数要4行function f() {    alert('Yeah');}f();//最简单的对象要7行function o() {    this.f = function() {        alert('Yeah');    }}var obj = new o();obj.f();

The design of the content is a bit more, object-oriented and process-oriented is two different ideas, but there must be a process in the inside to be able to elicit objects, process-oriented is analysis, object-oriented is the construction. Component and modularity are object-oriented and process-oriented products (personally think)

Process-oriented, as well as modularity, these are all programs that must be written.
Process-oriented understanding, all programs are process
Modularity is also well understood, that is, the process can be independent of the part of the Independent, to ensure the readability of the program, and whether it is to control errors or eliminate bugs are more concise. believe that learning C later to learn C + + people will think of a problem, that is, the structure and objects in the end what is the difference, they can play the role of code modularity, if you say that the structure of no method, I can also define the structure of the function pointer Ah, you say the structure does not have this pointer, A lot of times this pointer and grammar sugar I think there is no difference, as for the constructor or something more simple structure can be done.

What I'm saying is that the most important thing about object-oriented is inheritance.
When you go to school, the teacher will give examples, such as the person as the parent class, then can derive the teacher class and the student class, the student class can derive the male class, the female class.
However, this example is very unreasonable, and very poor, students in the course of homework does not derive a lot of useless classes.
And in fact, the vast majority of developers do not have the right to randomly derive bizarre classes out, which will lead to poor program readability.
Then the inheritance of the class is usually used.
Give an example of a real existence

I recently wrote React, each with a state Component the beginning is so written, class XXX extends react.component{}
Here, as long as I inherit the react.component, my Component has the Render method, can display the class capacity on the webpage, my Component also has the Componentwillreceiveprops method, The ability to execute the process I want when component receives new data. I don't have to worry about these things, but I know he's going to trigger this, and that's the ability to inherit a class.

Similarly, you use VS to develop a WPF window program or something, your form will also inherit a class from the Microsoft Basic Library, so that your form has a basic click Response Ah, drag and drop a variety of functions, you do not have to write.

There are all kinds of frameworks, and everything is the same, you inherit the framework of the basic class, you can get the framework to provide you with the functionality.

Textbook refers to the object-oriented time will generally refer to software engineering, and the book "People's Month myth", software engineering, object-oriented are programmers in the large-scale development of software when summed up something, similar to building a house, first lay the groundwork, the foundation played on it I build more features. Therefore, if we just follow the textbook to do some exercises, it is impossible to understand the many meanings of object-oriented

Ha ha. That's a really good question to ask. I'll take the time to answer, Mark.

  • 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.