[JAVA] What is object orientation?

I have been involved in Java system development for about 10 years. What is object-oriented several times? You can talk about it in the field, read a book, or look it up online.

Meanwhile, what is a good object-oriented place for on-site interviews? I was asked. At that time,? ?? So I tried to reorganize my thoughts and put them into words.

Like me, I have a long experience in the field, but what is object-oriented? When asked again, what? ?? Those who become. I hope it will be a key to organizing the thoughts of such people.

Reference site

-Understand object orientation correctly

What is object orientation before organizing?

It brings the way of thinking and appearance of the real world to the world of programming as it is. Therefore, object-oriented programs are intuitively easy to understand (because they are similar to the real world).

I was thinking.

But that? Really? Was that the program you've seen so far? As a result of asking myself, I came to another conclusion.

What is object-oriented after organizing?

I will borrow the words of the reference site.

"In object-oriented programming, the whole function is not regarded as a monolith, but as a collection of" objects "with data and procedures."

I will get this.

Therefore, it is concluded that the object-oriented program has high independence of individual parts, so maintainability and reusability are high, development man-hours and repair man-hours are less than before, and productivity is increased. It has reached.

"In object-oriented programming, the whole function is not regarded as a monolith, but as a collection of" objects "with data and procedures."

To add my understanding "Data" ・ ・ ・ Attributes "Procedure" ・ ・ ・ Behavior "What you can do if you get together" is the "function" of "objects" that have.

Conclusion that development man-hours and repair man-hours will be less than before and productivity will increase

The objects are independent. Independence is important.

Development man-hours can be reduced (reusability)

An independent "Tarosuke object" can participate in both A and B functions. That is, if you create a "Tarosuke object" when you create the A function, you do not have to create it again when you create the B function.

Reduced repair man-hours (maintainability)

Since the independent "Tarosuke object" participates in both the A function and the B function set, If you want to correct the "procedure" that is common to the A and B functions, you only need to modify one of the "Tarosuke objects".

If you organize the three major features in your own words based on the above

Polymorphism

The instructing side is easy.

Specifically, when I thought, "I want you to create a user management screen." Whether the person you are instructing is "Tarosuke" or "Karasuke", if you instruct "Please create a user management screen", it will be created. The contents are "Tarosuke" and "Karasuke", and you can create a unique "user management screen".

Furthermore, even if "Monosuke" appears, you can follow the same instructions.

Inheritance

Leave it to the common parent classification.

Specifically, the same procedure for "Tarosuke" and "Karasuke" is done by creating "parents" and "good nights" in the "suke classification" and leaving it to them. Is it like that?

The good thing about this is that you can use the procedure even if "Monosuke" appears.

Encapsulation

The instructor does not have to know the specific contents of the work. This is not recommended because it is likely to be a round throw at the system development site, but it is easy for program development.

When I thought "I want you to make a user management screen" that I talked about in polymorphism, Whether the person to instruct is "Tarosuke" or "Karasuke", if you instruct "Please create a user management screen", it will be created.

The instructor does not have to know how to make it.

The story.

that? After all, what's good about object orientation?

Since the independence is high, the development man-hours and repair man-hours are less than before, and the productivity is increased. Wonder.

That said, there are no silver bullets out there. If so, everyone is using it (laughs) So I don't think it fits all.

However, it is regarded as one of the convenient methods. Use where you can. I think that is good.

Bad sentence

I was able to organize it with my head! When I think about it and put it into words, it gets stuck in various ways. Verbalization is important w

Recommended Posts

What is object orientation?
[For super super beginners] What is object orientation?
[Technical Note] What is Object Oriented?
What is Cubby
What is Docker?
What is null? ]
What is java
What is Keycloak
What is maven?
What is Jackson?
What is Docker
What is self
What is Jenkins
What is IM-Juggling?
What is params
What is Facade? ??
What is Java <>?
What is Gradle?
What is POJO
Array is object
What is Java
What is centOS
What is RubyGem?
What is programming?
About object orientation
What is before_action?
What is Docker
What is Byte?
What is Tomcat
What is Maven Assembly?
What is `docker-compose up`?
What is vue cli
What is an interface?
What is Ruby's self?
What is Ruby's attr_accessor?
What is Java Encapsulation?
What is permission denied?
What is instance control?
What is an initializer?
What is Spring Tools 4
What is an operator?
What a beginner did to understand Object Orientation
What is Guava's @VisibleForTesting?
What is MVC model?
What is an annotation?
What is Java technology?
What is Java API-java
What is @ (instance variable)?
What is Gradle's Artifact?
What is JPA Auditing?
[Swift] What is dismiss?
[Java] What is flatMap?
What is a Servlet?
What is web development?
[Java] What is JavaBeans?
[Android] What is Context? ??
[Java] What is ArrayList?
[Ruby] What is true?
What is object-oriented after all?
What is docker run -it?
What is Java Assertion? Summary.