Concepts of Object-Oriented Programming

     While there is a specific set of rules to communicate with a computer, there are still multiple ways to achieve this. Similar to the previously explored concept of Python in this blog, Java is also what is known as a Object-Oriented Programming System (OOPs). 

 

Image via Olivia Cuthbert at Science Data Central

    

Some of the common terminologies used when discussing OOPs are as follows:

  • Object: To be considered an object, an item only needs a state and behavior (JavatPoint, 2021). An object can be physical (like the keyboard I am typing on right now) or logical (like the concept of a law).
  • Class: A grouping of objects that are categorized under logical capabilities (Banda, 2020). 
  • Method: A change made at the class level that affects all the included objects (Banda, 2020). 
  • Instance: A specific object that can be held up as an example of a class.


Via Tech Vidian   

    Now that we've defined some of the most common terms used in Java, it is time to take a look at the four base concepts the programming language is built on. 

  • Inheritance is found when the different objects in a class inherit the characteristics of that group's commonalities (Oracle, 2021). For example, in the class of dishes, coffee mugs, wine glasses, and sippy cups all inherit the characteristics of their parent, or superclass, of cups. 
  • Polymorphism is illustrated when the same task is done in accomplished in different ways. In sending my child to the store for an item, he could get there by driving, bike riding, roller skating, or walking. All these varying modes of transportation still get him where he needs to be to accomplish the task set to him.
  • Abstraction is knowing how to operate something such as a smart thermostat without an in-depth knowledge of the components and computing that goes on inside it. I can use the app on my phone to set a schedule for achieving certain temperatures in my house without having to understand the chips and transistors inside the devices used.
  • Encapsulation can be seen as "a protective shield that prevents the data from being accessed by the code outside this shield" (GeekforGeeks, 2021). This wrapping or binding of code creates a single unit all its own.



Via Java T Point

 

    To gain experience with Java, I recommend installing the Java SE development Kit from the Oracle website. Additionally, a shell to practice writing code should be added. Some good ones are NetBeans IDE, IntelliJ IDEA, Eclipse, and Notepad ++. If you do not have access to your own computer with the freedom to download these software programs, JDoodle is an online, free to use, compiler to practice your coding skills. Have fun exploring Java!



References:

Banda, F. (2020, March 20). The four pillars of Object Oriented Programming. Retrieved February 04, 2022, from https://info.keylimeinteractive.com/the-four-pillars-of-object-oriented-programming

GeeksforGeeks. (2021, August 02). Encapsulation in Java. Retrieved February 04, 2022, from https://www.geeksforgeeks.org/encapsulation-in-java/

Oracle. (2021). What is inheritance? Retrieved February 04, 2022, from https://docs.oracle.com/javase/tutorial/java/concepts/inheritance.html

 JavatPoint. (2021). Java Oops Concepts. Retrieved February 04, 2022, from https://www.javatpoint.com/java-oops-concepts




Comments