[Must see !!!] I tried to summarize object orientation!

Introduction

** For beginners, object-oriented programming is often seen in reference books, but isn't it done without looking it up? ** ** ** Also, I think some of you may be interested in object-oriented programming. ** **

This time, I've summarized object-oriented programming in an easy-to-understand manner, so please have a look!

Target of this article

--Programming beginner --Those who are learning object-oriented programming languages ​​(Ruby, JAVA, C ++, etc.)

What is object-oriented programming?

Express it as if you were assembling a "thing" and let the computer operate

Nowadays, object-oriented languages ​​are the mainstream, so it is very important to keep the concept of object-oriented in programming. For example, the following programming languages ​​are all object-oriented languages.

--Java running on various platforms --Ruby, PHP, and JavaScript that give movement to web pages --Swift used in Mac OS and iOS app development --C ++, a well-established commercial programming language --VBA used as a macro in Word and Excel

To explain in an easy-to-understand manner .....

What is an object-oriented program? Creating a completed (app) by separating things and operations

For example Object (thing) → remote control Operation → Button, battery

It's like that! Lol

merit

――You can design and develop programs efficiently Take a web app button as an example In the case of a button defined as a thing, if there is a similar button, you can create another delete or edit button by changing the color of the button.

--It becomes easier to identify the cause of the problem Since object thinking is divided into things and operations, where the error occurred (thing code), It is easy to understand what kind of operation was performed (operation code) and identify the error.

--Easy to handle even if the usage of the program changes For example, suppose you have 100 buttons and you change the width of the buttons from 400px to 300px. Modifying 100 buttons can be a daunting task. However, simply changing the width of the "button" defined in object orientation will change the size of all buttons.

--With object-orientation, you can fix it in no time after development.

Keywords you want to remember

  1. Encapsulation → Mechanism to prevent changes from other programs as much as possible Taking buttons as an example, if you don't want to change the height and width of all buttons, encapsulation is an easy way to set and protect them from other programs.

  2. Inheritance A mechanism for reusing code by collecting similar programs in one place → If you write similar processes one by one, it will take time to modify the code of "Data registration process", for example. Inheritance allows you to organize your code into categories such as register, update, delete, etc. If you put them together as a category, you can use the same process when creating a new function. It will be easier to check if there is any similar processing.

  3. Abstraction The idea of ​​extracting important elements and common elements and discarding others → If you compare it to a car What size? What kind of design? It's not something you can't understand without asking The engine is on. Common elements that are absolutely necessary, such as 4 handles What I want to say is, "I haven't decided the details, but the elements that are absolutely necessary for development are XX."

  4. Polymorphism Mechanism for changing and using a part of inherited code Polymorphism can be used by changing only a part of the code → For example, creating a register, update, or delete button by changing only the button color means changing a part and inheriting it.

At the end

If you've been learning programming without understanding object-orientation, you'll probably find that part of this article! I hope you find it helpful!

Reference article

What is object-oriented? Easy explanation so that anyone can understand

Recommended Posts

[Must see !!!] I tried to summarize object orientation!
I tried to summarize object orientation in my own way.
[Personal memo] I tried to study object orientation lightly
I tried to summarize iOS 14 support
I tried to summarize Java learning (1)
I tried to summarize Java 8 now
I tried to summarize the methods used
I tried to summarize the Stream API
What is Docker? I tried to summarize
I tried to summarize the words that I often see in docker-compose.yml
I tried to deepen my understanding of object orientation by n%
I tried to summarize about JVM / garbage collection
I tried to summarize the state transition of docker
I tried to summarize various link_to used this time
I tried to verify yum-cron
I tried to summarize the basics of kotlin and java
I tried to summarize the basic grammar of Ruby briefly
I tried to summarize personally useful apps and development tools (development tools)
I tried to summarize personally useful apps and development tools (Apps)
I tried to chew C # (indexer)
I tried to interact with Java
I tried to explain the method
I tried to understand nil guard
I tried to chew C # (polymorphism: polymorphism)
I tried to explain Active Hash
I tried to summarize what was asked at the site-java edition-
[Ruby] Tonight, I tried to summarize the loop processing [times, break ...]
Special Lecture on Multi-Scale Simulation: I tried to summarize the 5th
Special Lecture on Multi-Scale Simulation: I tried to summarize the 8th
I tried to see if Koalas and Elasticsearch can work together
I tried to summarize devise which was difficult at first glance
I tried to summarize the methods of Java String and StringBuilder
Special Lecture on Multi-Scale Simulation: I tried to summarize the 7th
I tried to make a parent class of a value object in Ruby
Try to organize your own object orientation
I tried to introduce CircleCI 2.0 to Rails app
I tried migrating Processing to VS Code
I tried to summarize the stumbling points when developing an Android application
I tried Cassandra's Object Mapper for Java
I tried to solve AOJ's Binary Search
[Introduction to Java] I tried to summarize the knowledge that I think is essential
I tried to implement the Iterator pattern
[After learning Progate] I tried to summarize form_with while comparing with form_tag
I tried to build AdoptOpenjdk 11 on CentOS 7
I tried to build Ruby 3.0.0 from source
[Ruby] I tried to summarize the methods that frequently appear in paiza
I tried to use Selenium like JQuery
[Ruby] I tried to summarize the methods that frequently appear in paiza ②
I tried to touch JavaScript Part.2 Object-oriented
I tried to implement ModanShogi with Kinx
I tried to summarize again the devise that was difficult at first sight
[JavaScript] The strongest case when I tried to summarize the parts I do not understand
I tried to verify AdoptOpenJDK 11 (11.0.2) with Docker image
I tried to make Basic authentication with Java
I tried to implement polymorphic related in Nogizaka.
I tried to manage struts configuration with Coggle
[Rails] I tried to raise the Rails version from 5.0 to 5.2
I tried to manage login information with JMX
I tried to organize the session in Rails
java I tried to break a simple block
I tried to link grafana and postgres [docker-compose]