Home >Backend Development >Golang >What is the Go language oriented towards?

What is the Go language oriented towards?

青灯夜游
青灯夜游Original
2023-01-28 10:45:191864browse

The Go language is neither object-oriented nor process-oriented, because Go has no obvious tendency, but rather allows programmers to consider how to use it. Perhaps its characteristic is flexibility, programming Readers can use it to implement object-oriented, but it does not support object-oriented semantics itself. Go is said to be object-oriented because Go can bind functions to structures (structures can be regarded as objects in object-oriented). It is said that Go is not entirely object-oriented because object-oriented has three major characteristics: encapsulation, inheritance, and polymorphism; and go's structure does not support inheritance.

What is the Go language oriented towards?

The operating environment of this tutorial: Windows 7 system, GO version 1.18, Dell G3 computer.

The Go language is neither object-oriented nor process-oriented, but if you want to implement them, you can actually do it.

  • Object-oriented: think about the behavior of objects with the object as the center;

  • Process-oriented: in programming, function as the center Think about the purpose of the function.

It is said that Go is object-oriented because Go can bind functions to structures (structures can be regarded as objects in object-oriented); it is said that Go is not entirely object-oriented. Object is because object-oriented has three major characteristics: encapsulation, inheritance, and polymorphism. Go's structures do not support inheritance (but support nesting/combination of structures).

It is said that Go is process-oriented because Go does not have to bind functions to structure objects and can be designed and programmed in a process-oriented manner.

So strictly speaking, Go is not an OOP language, but it does allow OOP programming style. Its flexibility tends to allow developers to consider how to use it.

Golang can be said to be neither, because Golang has no obvious tendency, but prefers to let programmers consider how to use it. Perhaps its characteristic is that it is flexible and programmers can use it. It implements object orientation, but does not natively support object-oriented semantics.

Expand knowledge:

  • Object-oriented

Object-oriented (OO) is The current focus of the computer industry is that it was the mainstream of software development methods in the 1990s. Object-oriented concepts and applications have transcended programming and software development and expanded to a wide range. Such as database systems, interactive interfaces, application structures, application platforms, distributed systems, network management structures, CAD technology, artificial intelligence and other fields.

When it comes to object-oriented, there are many articles in this area. However, there are very few that explicitly give or state the definition of an object - at least I haven't found one yet. Initially, "object-oriented" specifically refers to the use of design methods such as encapsulation, inheritance, polymorphism, and abstraction in programming. However, this definition obviously no longer fits the situation. Object-oriented thinking has been involved in all aspects of software development. For example, object-oriented analysis (OOA, Object Oriented Analysis), object-oriented design (OOD, Object Oriented Design), and what we often call object-oriented programming (OOP, Object Oriented Programming). Many articles about object-oriented only describe the issues that need to be paid attention to in object-oriented development or the better design methods adopted. Reading these articles can benefit you to the greatest extent only if you truly understand what an object is and what object-oriented is. At this point, I am afraid that beginners and even those who have been engaged in related work for many years will have a vague concept of them.

  • Procedure Oriented

"Procedure Oriented" (Procedure Oriented) is a process-centered programming idea. These are programming with the primary goal of what is happening, as opposed to object-oriented who is being affected. The obvious difference from object-oriented is encapsulation, inheritance, and classes.

【Related recommendations: Go video tutorial, Programming teaching

The above is the detailed content of What is the Go language oriented towards?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn