[JAVA] The illusion of object orientation

The object is Manusa!

Introduction

This article is an article that I would like to deliver to those who are surrounded by the illusion of object orientation. I'm object-oriented! This is an article I want the brave man to read.

Object-oriented illusion 1

** I'm doing Java, so I'm using objects! ** **

・ ・ ・

There is no such reason.

Java also adopts multi-paraguim and can be coded in the following styles.

The reason why Java = object-oriented is I've used the word ** object-oriented ** as a marketing term to spread Java. Java itself was the culprit who increased the number of people who did not understand object orientation correctly.

Object-oriented illusion 2

** Create a data class, create a logic class, and classify each role properly ** ** I'm object-oriented! ** **

・ ・ ・

It's procedural.

This is the traditional development style Because there are many ** function split type ** styles in which the person in charge is separated for each function and development is performed for each function. It is thought that it has come to be used with high affinity with the procedural type.

Koroske named Manuha!

To put it simply, object-oriented is:

** Implement data class and logic class in the same class **

This is essentially the "changeability" that object-oriented aims at.

What exactly is "changeability"?

Object-orientation Class A (logic + data) B class (logic + data)

** Procedural ** Data class α Class A (logic) that uses data class α B class (logic) that uses data class α

In this case, if the data class is modified, In the procedural type that reuses the same data class Both A class and B class will need to be repaired and tested.

In the case of object-oriented, even if the A class is modified B class does not fluctuate.

This is the essence of object orientation.

Is there anyone who has read this far and can say that they are using object-oriented programming?

If you have read this far and are interested in object orientation, please see below. For those who want to use object-oriented programming properly (Software Design separate volume)

Recommended Posts

The illusion of object orientation
[Rails] Check the contents of the object
About object orientation
Verify the contents of the argument object with Mockito
[Java / Kotlin] Resize considering the orientation of the image
The world of clara-rules (2)
Judgment of the calendar
The world of clara-rules (4)
The world of clara-rules (1)
The world of clara-rules (3)
The world of clara-rules (5)
The idea of quicksort
The idea of jQuery
How is the next value of the Time object correct?
About the handling of Null
How to use the getter / setter method (in object orientation)
Docker monitoring-explaining the basics of basics-
Get the object name of the instance created by the new operator
About the description of Docker-compose.yml
Understand the basics of docker
The play of instantiating java.lang.Void
Explanation of the FizzBuzz problem
The basics of Swift's TableView
Median of the three values
Switch the version of bundler
I tried to deepen my understanding of object orientation by n%
Summary of results of research on object orientation [Updated from time to time]
[Java] Delete the elements of List
Continuation: The parable of OOP (omitted)
Qualify only part of the text
Understand the basic mechanism of log4j2.xml
About the basics of Android development
'% 02d' What is the percentage of% 2?
Replace the contents of the Jar file
[Java version] The story of serialization
Check the version of Cent OS
[Swift] Change the textColor of UIDatePicker
[Ruby] See the essence of ArgumentError
Explanation of the order of rails routes
I read the source of ArrayList I read
The basics of SpringBoot + MyBatis + MySQL
Note on the path of request.getRequestDispatcher
The basic basis of Swift dialogs
The basic basis of Swift's Delegate
This and that of the JDK
Check the migration status of rails
The story of @ViewScoped consuming memory
Filter the fluctuations of raw data
Explaining the columns of Spree :: Taxonomy
A memorandum of the FizzBuzz problem
I read the source of Long
Official logo list of the service
Explain the column of Spree :: Product
Various methods of the String class
About the role of the initialize method
Get the ID of automatic numbering
I read the source of Short
I read the source of Byte
Order of processing in the program
Explanation about Array object of Ruby
I read the source of String