Object Oriented Programming with Java

This blog post is a guide of  what java programming is, how to get started with Java programming, and concepts and features of object-oriented programming.

When I began learning Java I was nervous.  I have been learning how to code in Python for about a year and a half now.  Python is a different programming language and has different syntax (the way the code is written etc.).  I began to learn Java from going from the start as if I knew nothing about coding.

I first began by reading about how to install Java on my PC by going to the site Oracle Java documentation.  This site gave me step by step instructions on how to complete this task.  After I downloaded and installed Java on my PC, I thought it would be a good idea to learn about Java and how it works. 

I came across a break down of object oriented programming (OOP) at the site Geek for Geeks , which I have used for a basic tool for information on a variety of computer science topics.  This let me know the concepts of object-oriented programming and it provided a link to more information about each OOP concept.  

OOP has a few concepts in which it goes by to make it work.  These concepts are polymorphism, inheritance, encapsulation, abstraction, class, object, method, and message passing. 

Polymorphism is the ability of program languages to recognize the difference between variables that have the same name (ex. int t, int z).

Inheritance is a major feature of OOP.  Inheritance is the way a class can inherit the features of another class.  This allows for less code writing by being able to reuse class features as a program gets bigger.

Encapsulation can be thought of as a way to keep code inside of a class away from other classes.  the code in java can be labeled as private within the class to keep the code from being altered by other classes.

Abstraction is the way the code is kept from the user.  The user is not interested in what the code says, only the main idea.  Writing code in detail is for instructions and abstraction takes that code and displays the final product to the user.

Class is the draw up of where all of the objects are created.  Class has a way of describing what is in the class such as declarations.  Declarations are modifiers, class name, superclass interfaces and body.  Class is the baseline of OOP.

Object:  Everything is an object in Java OOP.  Objects have a state, behavior and identity.  It is up to the programmer to describe these in a way they can be understood by the compiler and other programmers on their team or future programmers who might need to update the program.

Methods are a group and things that have instructions on what task they will complete.  I will not go into detail on methods.  Methods are basically blocks of code that do something when they are called.  I would recommend you refer to Methods in the link to learn about what methods are in Java and how to create and call them.

Message Passing is how objects communicate with each other in the program.  "Message passing involves specifying the name of the object, the name of the function and the information to be sent".

These are the concept of OOP in Java.  Java is a programming language that has been around for years and provides many features that have evolved and are evolving everyday.  The concepts that I talked about in this blog will help you get the idea of what OOP is and how it is used.  I would suggest going through a tutorial like w3schools that goes through all of what Java has to offer.  It has examples and exercises on each topic to help a newbie work through Java.

As of the date of this blog post I am a few days into reading and studying about Java.  I am learning more everyday about how to construct a Java program.  From the first few days I have seen that I like how Java is statically written.  I believe it helps me be more descriptive with my code and when I look back at lines I have earlier written, I can get a better grasp of what I did (even without comments).

List of Sites to learn more about OOP and Java:

https://docs.oracle.com/javase/tutorial/index.html

https://www.geeksforgeeks.org/object-oriented-programming-oops-concept-in-java/

https://www.w3schools.com/java/java_methods.asp

No comments:

Post a Comment