Hey there, fellow aspiring developers!
If you're reading this, you're probably a complete newbie at programming! Welcome to the club :) A few weeks ago, I started learning Object-Oriented Programming using Java, and I figured I could help some people out by giving you a few pointers that I've learned from my own short experience!
π» Installing Java (Without the Computer-Geek Hassle)
Ok, so let’s admit it. Installing a new piece of software is one of those “dragging your heels” activities. Instead of adding to the several “how-to” articles out there, I’ll just give you the links I used to install Java and write my first “hello, world” program:
Official Java Download Page – Download the latest version of Java Development Kit (JDK).
Java - "Hello World" Program - Step-by-step instructions with explanations for each line of code
How to Set Up Java in Visual Studio Code - Watch to Learn how to install Java in Visual Studio Code
For my code editor, I am using Visual Studio Code. It's lightweight, easily customizable, and works really well after you install the Java Extension Pack. The Java Extension Pack includes support for syntax highlighting, IntelliSense, debugging, and more.
After installing the JDK and setting up VS Code, I was able to run my first Java program (Hello World) without any real problems. There are hundreds of quick tutorials and YouTube walk-throughs out there, like the one in the last link above, if you need them.
π What Is Object-Oriented Programming (OOP), Anyway?
OOP (Object-Oriented Programming) is a programming model that uses physical objects as the basis for organizing information and programs. In other words, instead of perceiving a chunk of code as a list of instructions for a computer to carry out, the developer thinks in terms of objects with properties (data) and the actions they are able to perform (functions).
The 4 Major Principles of OOP (explained how I wish someone explained them to me):
π Encapsulation
Consider how a coffee machine works; you put some coffee in it, add water, and press a button to get a cup of coffee ready to drink. You don’t have to think about the nuts and bolts or the inner mechanisms in order to get that cup of coffee, so a coffee machine is a kind of black box.
In the same way, encapsulation is the hiding away of data and functions in our program. It’s like packaging them up for later use.
π Abstraction
Abstraction is similar to encapsulation in the way that it allows a user to interact with a machine, for example, a car, without understanding the internal mechanisms. In a car, all the user does is put the key in the ignition and press some pedals and the steering wheel.
π Inheritance
Inheritance is the passing down of characteristics and features from one generation to the next. In programming, a new child class is created from the original parent class, but the child class inherits the parent class’s properties and behaviors.
π Polymorphism
Simply put, it is a fancy word meaning many forms, shapes, or appearances. One action can take many different forms according to the object you’re using it with. For example, draw is one word, but it can take on many different forms, like drawing with a pencil, drawing with paint, or drawing up a blueprint.
π± TL;DR
Java can seem overwhelming at first, but it becomes more comprehensible after installing it and getting your first programs to work.
Knowing the concept of OOP is sort of like learning the art of code organization.
This is just my humble opinion, as I am learning and still feel like I don’t fully understand Java and all of its aspects.
If you are learning, don’t worry. Keep those links saved, keep playing around with your code, and make mistakes. That’s how we learn and improve ourselves!
There will be more posts on my learning journey as I work through Java and object-oriented design, and if you are learning as well, I would love to see you in the comments. Until next time, happy coding!
No comments:
Post a Comment