** 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!
--Programming beginner --Those who are learning object-oriented programming languages (Ruby, JAVA, C ++, etc.)
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
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
――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.
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.
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.
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."
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.
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!
What is object-oriented? Easy explanation so that anyone can understand
Recommended Posts