Object Oriented Programming (OOP) concepts: Java
    Good Day, fellow Newbies! I'm back again, this time with some helpful tips on installing and learning Java, an object-oriented programming (OOP) language. Java is a versatile language that can easily prot applications across different platforms due to its object-oriented structure, which makes it a simple matter to swap out program modules without worrying about breaking the greater program.
Installation
The first thing we need to do to get started programming in Java is to install the latest version of the Java SE Development Kit (JDK) from here. Even if you already have Java, downloading the latest version is always considered to be a best practice in programming.
After downloading and installing the latest version of the JDK, you'll want an Integrated Development Environment (IDE). An IDE is a program designed to facilitate the development of other programs, featuring many helpful tools such as real-time debugging, error checking, and function library for a multitude of languages. I used Apache's Netbeans IDE, which can be found here, but there are a number of options to choose from, such as Microsoft's Visual Studio, Jetbrains' IntelliJ IDEA, or Eclipse. Which one you choose is largely a matter of taste, so give them a try and see which one works for you!
What is an Object?
It seems like a weird question, something so basic, but aside from just being a "thing", it's surprisingly deep. An object, both in programming and in real life, is an object that exists with both properties and behavior. In programming, these are called it's State (it's current properties) and Method (what it's doing). creating a program object allows programmers to define a function that performs a particular thing without having to copy the entire function every time it's used. Instead, the object acts as a container for the function and its associated variables. For instance, instead of having to machine every part of a bicycle from scratch every time you needed to go to the store, You need only build it once and then you can store it in your garage and take it out again every time you need it.
How Do We Use These Objects?
To use an object, we must first define a class. Think of a class as a blueprint for making objects, defining what it is, what it does, and what variables and states it can have. Before making our bike, we first must know what a bike is, what it does, and how it does it. Creating a class in Java is as simple as evoking the class definition followed by what you wish to name it, then defining the container by what's in the brackets. like this:
class Bicycle {
};
This stores the definition of what constitutes a bicycle in the program's memory for later use.
Once we've stored the blueprint of what a bicycle is, we can now make one, called an instance, by evoking the class we made to create a new object like this:
Bicycle1 = new Bicycle();
You can make as many instances of an object that you have defined as you want, and each can be modified and called upon as separate entities that use the same pattern and limitations.
Why Use Objects? 
Objects allow code to interact with one another, be reused, and duplicated during the code execution without needing to copy over the entirety of the function into the code itself, improving readability and compaction of the code. By allowing the program itself to create new instances of an object during execution, or call other containers in order to modify states, it makes programs more flexible and dynamic, allowing them to be scaled up and down in scope depending on your needs. For our example, using our Bicycle object, if we didn't use an object class to store the definition of a bicycle, we would be limited to only however many copies of the code are stored in the program itself. So if we only coded one bicycle, we would only have one bicycle. However, using object classes to tell the program what a bicycle is, we can define as many instances of a bicycle as we want, even creating new kinds of bicycles by having the new class inherit the properties of the Bicycle class to build off of. We could recreate the entire Tour De France without significantly bloating the program, because instead of having to tell the computer what a bicycle is every time we need one, we created a template it can call on to make as many as we want.
Conclusion
Using Object-Oriented Programming makes coding programs easier and the final result more compact and easy to use. Learning to utilize objects in programming is essential to understanding how to structure your programs and makes it possible to debug and troubleshoot only specific portions of a program without risking the integrity of the rest. 
No comments:
Post a Comment