Blueprints for building (OOP)

Object Oriented Programming has been around for a while. When I began my career, I programmed using procedural methods until I learned about OOP. What is OOP really? When I began learning about OOP, it took me a bit to catch on to the concept. I found it to be somewhat of a large topic that at first was muddy. There are a lot of OOP principles to learn…more than can be explored within one blog post. I will periodically explore various OOP principles and you will find them scattered throughout my code projects.

When I began programming with OOP principles, one of the first items I had to learn was what classes and objects are and how they work together.

First…the definitions…

Class – a set of functions that work together to accomplish a task. It can contain or manipulate data, but it usually does so according to a pattern rather than a specific implementation. An instance of a class is considered an object.

Object – receives all of the characteristics of a class, including all of its default data and any actions that can be performed by its functions. The object is for use with specific data or to accomplish particular tasks. To make a distinction between classes and objects, it might help to think of a class as the ability to do something and the object as the execution of that ability in a distinct setting.

Here is another way of thinking about it…

Let’s say you were going to build a brand new subdivision where all the houses look alike. You create the blueprints and build your first house. You then re-create the blueprints and build a second house that looks exactly like the first one. You then repeat this process throughout the subdivision. This would not be a very wise way to build your subdivision. Why re-create the blueprints if the houses are all alike? It is a waste. Instead, you would use the first set of blueprints to build all of the houses within the subdivision.

Classes = Blueprints

Objects = Houses

So you create the class once and then can build a lot of objects from that class. Here is an example in Java…

[code lang=”java”]
// This is my class
public class House{
public House(String name){
// This constructor has one parameter, type.
System.out.println("Passed Type is :" + type);
public static void main(String []args){
// Following statement would create an object myHouse
House myHouse = new House( "ranch" );

Happy Coding!

Clay Hess

More To Explore

computer, laptop, work place-2982270.jpg

Unlocking Wireless Communication: A Dive into the Bluetooth API

Wireless communication has become an integral part of our daily lives, and Bluetooth technology is at the forefront of this revolution, enabling devices to exchange data over short distances and creating a world more interconnected than ever before. At the heart of this technology lies the Bluetooth Application Programming Interface (API), a powerful tool for developers looking to harness the capabilities of Bluetooth in their applications. In this blog post, we’ll explore what the Bluetooth API is, how it works, and the possibilities it opens up for innovation in wireless communication.

lighthouse, beacon, atlantic-8578318.jpg

Understanding the Beacon API: Simplifying Asynchronous Data Transfers

In today’s data-driven world, web applications often need to send data back to the server. Traditionally, this has been done using AJAX requests or similar methods. However, these techniques can come with a cost, especially when dealing with data that needs to be sent during the unload phase of a document, such as tracking and diagnostic data. This is where the Beacon API shines by allowing developers to send data to a server more reliably and efficiently.

Share This Post


Need help?

Let's have a chat...


Jump Back In!

Here at Webolution Designs, we love to learn. This includes sharing things we have learned with you. 


Begin Your Learning Journey Today!

Come back inside to continue your learning journey.