Compendium Article 9: A Newbie's Introduction to Object-Oriented Programming, Java, and tutorial links to keep you motivated
Hello fellow Java noobs! As my journey continues further into the world computing and specifically programming, we’ve now arrived at Object-Oriented Programming (OOP) and Java. The names alone sound intimidating, but don’t worry! I'm here to explain what Ive learn to your ------from one beginner to another.
Getting
Started
1.
Go
to the Oracle website or OpenJDK to get the Java Development Kit (JDK).
2.
Pick
the JDK version that matches your computer (Windows, macOS, Linux) and download
it.
3.
Open
the downloaded file and follow the on-screen setup instructions.
4.
To
check if Java is installed, type java -version in your command prompt or
terminal. If you see a version number, you're all set!
5.
For
writing Java code, you'll need an IDE (a program where you’ll write the code).
Good options for beginners include Eclipse, NetBeans, Visual Studio Code, and
IntelliJ IDEA.
6.
After
doing some Google research I chose IntelliJ IDEA because it's popular and user-friendly
for beginners. Just download and install it like any regular program.
7.
IntelliJ
IDEA should also install smoothly. Make sure it's set to recognize .java files.
8.
And
that's it! You're ready to start coding in Java
Understanding
Object-Oriented Programming (OOP)
What is Object-Oriented
Programming? Simply put, it is a programming paradigm that’s quite different
from traditional procedural programming. It’s like building with Lego blocks
(objects) rather than molding a sculpture from a lump of clay (procedural
programming). Procedural programming breaks a program into functions that use
variables. It's easy at first, but with growth, it can become messy, leading to
repeated and tangled code that's hard to manage (also known as Spaghetti
coding). OOP organizes code into objects, combining variables (properties) and
functions (methods) together. This method, like grouping car features and
actions into a car object, avoids the mess of procedural code and keeps things
organized. Common ones include Java, C#, PHP, Python, C++, etc.
OOP
Concepts
Learning a new programming language comes with its own set of jargon which can be a lot to take in as a beginner. It's normal to feel swamped by all the new terms in tutorials and videos. To make things easier, I've broken down some of these terms for you and included links to resources that explain them clearly from tutors that really delivered the information in a humorous, yet concise way. If you've already tried to get a simple "hello world" program running in Java already like I did, I bet it felt like overkill compared to Python, right? With all the "public static void" stuff, it's easy to get lost. Luckily, John breaks it down with some humor in the first video tutorial I've linked below. Beginners in coding will certainly have a good laugh! 'Coding with John’ has helped me understand a lot of things in four videos and makes humor of getting started with Java and comparing it to Python. He delivers very short videos and explains “Why it's hard”. He says that if you think Java's tough to crack, you're not alone. That it feels like needing a whole kitchen just to make a PB&J. In Java, a simple 'Hello World' requires a class, a main method, and a print statement—definitely more than Python's one-liner. Java’s like an iceberg; what you see is just the tip. Variables and if-statements are just the start. Then comes the avalanche—inheritance, polymorphism, collections, and the list goes on. As he delivers information, he keeps it simple for beginners, such as stating that “a Class is just a fancy name for a Java file”. For the beginner concepts, I watched ‘Programming with Mosh’ where he explained this in 7 minutes with animation on a YouTube tutorial. The four pillars of OOP are encapsulation, abstraction, inheritance, and polymorphism.
1.
Objects
& Classes: In
the real world, an object is anything tangible like a car or a book. In OOP,
objects are similar but digital. They contain data and ways to interact with
that data. These are instances of classes with state (attributes) and behavior
(methods). Classes are like blueprints for these objects, defining what they
will be and what they can do.
2.
Encapsulation: Grouping related variables and
functions (methods) together in objects to reduce complexity. This allows for
reusing objects in different parts of a program or across various programs.
3.
Abstraction: Hiding the details and showing
only the essentials. It simplifies the user experience and isolates the impact
of changes in the code, which also reduces complexity.
4.
Inheritance: Eliminating redundant code by
enabling new objects to take on properties and behaviors of existing objects.
5.
Polymorphism: Refactoring and simplifying code
by allowing methods to behave differently based on the object, eliminating the
need for ugly switch-case statements.
The first
three links to check out to get you started are included below, as are further
videos with John:
1.
Learn Java in One Video - 15-minute Crash Course – Coding
with John https://youtu.be/drQK8ciCAjY?si=Y4mua1LzAew_DAMd
2.
Object-oriented Programming in 7 minutes | Mosh https://youtu.be/pTB0EiLXUC8?si=wGjU6uUwzW5SFFdR
3.
IntelliJ IDEA Full Course Amigoscode IntelliJ
IDEA Full Course https://youtu.be/yefmcX57Eyg?si=Z9p_YDZGEx1fFTZw
References
P. W. M. (2018, March 30). Object-oriented Programming in 7 minutes |
Mosh. YouTube. https://www.youtube.com/watch?v=pTB0EiLXUC8
C. W. J. (2021, August 11). Learn Java in One Video - 15-minute Crash
Course. YouTube. https://www.youtube.com/watch?v=drQK8ciCAjY
A. (2019, September 22). IntelliJ IDEA Full Course. YouTube.
https://www.youtube.com/watch?v=yefmcX57Eyg
Comments
Post a Comment