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.
** 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.
** 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.
** Implement data class and logic class in the same class **
This is essentially the "changeability" that object-oriented aims at.
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.
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