hello! I'm Marisabel! Marisabel
Category: learning to code

Object-Oriented Programming (OOP) in Java flow chart

Updated on 03.23.21

I can finally move on. The past two weeks (exactly 2 weeks!) I have been dedicating my time trying to understand how Object-Oriented Programming in Java works. Though I am definitely not a guru yet, I feel much more confident with what I have learned. I have invested exactly 28 hours in this beautiful flow chart.

I am looking for feedback on it to see if I really understood the concepts or not. But here is a brief summary.

Object-Oriented Programming in Java consist of four main concepts:

(sorted by order of difficulty)

Encapsulation

This is setting fields/variables as private in order to protect the information and access them via getters/setters and a constructor on an external class.

Get: is a method which has a return type

Set: is a method that requires the parameters which to set

The nice thing is, IDE’s make these so easy to build by a few keystrokes.

IntelliJ: ALT + insert 👍🏻

Inheritance

This is where we extend child classes to their parent classes in order to use their fields or methods.

Polymorphism

This is where we override or overload via inheritance.

Override: this happens via inheritance from one Super (Parent) class to other sub (child) classes.

Overload: this happens inside the same class, where we duplicate the class but use different signatures (parameters) to create different methods.

Abstraction

WHY WHY WHY! No one would tell me WHY would I use this! But now I get it!

Abstraction is an idea, a template, which you use for classes. Classes are a template for objects.

Interface is used also as an abstract template, but it is a contract, and you must use all the methods in it to implement another class.

Abstract classes are not Interfaces but Interfaces are Abstract. 😵

Use Abstract classes if the classes are related.

Animals – cat, dog, fish, bird

Building – house, store, school

Use Interfaces if the classes are not related but use the same basic principles.

Writing Tool – pen, pencil, crayons

Player – radio, mp3, DVD player

If you want to see the full explanation, feel free to check my repository where I saved all the notes and test codes. I had a lot of fun experimenting with different options of parameters, fields, methods, and all the concepts of OOP.

Here is a screenshot:

Ok, so the flow chart actually took me an hour, and it was the whole point of those 28 hours invested. My goal was to take this complex subject in Java and create the simplest explanation possible. In the hopes that it helps others too. I am also taking an OOP course next summer, so that will help me understand it even more.

The next week (or 2, depending on how much time I can dedicate to it) I will be learning about Arrays before taking a pause from Java to learn SQL (as I will be using arrays with it).

Leave a Reply