Writing classes in object oriented programming (OOP)

Writing classes in object oriented programming (OOP)

Classes are the future of programming. As a beginner programmer I learned basic statements and syntax. As my skillset evolved this lead to functions and ultimately classes. The basic philosophy being what we refer to as object oriented programming where you can model real world behaviors by reusing already built models in your code. I’m creating this page as a central place to define various terms in Class programming along with their usage.

Example of a class

Modeling the function of a car’s speedometer by inheriting various other models (classes). These may combine a wheel model, gear model, and shaft speed model into a vehicle speed class.

Shaft RPM * gear ratio * wheel circumference = Vehicle speed

The vehicle speed class could then contain various transforms to display in kilometer per hour, mile per hour or other units.

This type of class programming is prolific. When I started programming as a child it wasn’t as common. My upper level programming courses I took in undergrad as well as through my engineering career provided me a grasp of the more advanced methods of behavioral modeling (aka programming).

However, it wasn’t until recent years those programming methods became more common. Now it’s vital to understand class modeling techniques with code reuse, object oriented programming, being so prolific.

Class programming syntax and terminology

My intention is not to provide a complete rundown of class programing here. Rather a glossary of various terms used to write class code. Modern programming languages pretty well all support Object Oriented Programming / Classes thus the terms are similar between languages but not necessarily always the same. What I will share below is as pertains to C# and or C++ the language I originally learned in.

UNDER CONSTRUCTION

They keep coming out with new class syntax and identifiers which I have to lookup. I get tired of searching the web constantly to research those. This page serves as my notes for when I program so I can look at one spot! It will be updated as I progress through writing code.

static

namespace

Memory Access

friend

virtual

internal (c#) utilized as a class identifier in .NET programming. This limits visibility of the class to the parent class / assembly which references it.

internal class InternalClass { 
     public void PublicMethod() { 
         Console.WriteLine("This is a public method in an internal class."); } 
}

public

private

protected

Return Types

The traditional way a compiler would return data is by throwing it on the stack. Now days lots of code is interpreted. Various threads and processes (independent programs sharing a processor) may share data via other means. Long story short, after a routine, method, or function completes it’s code it can optionally return data to the code that called it. That data must be defined as a custom defined datatype, (class, enum, etc) or an existing data type such as an integer, floating point, etc.

void if no data is returned then we place void in front.

Matthew Jeschke

I've been hard on jeans since childhood when my single most important job was to stuff my Fisher Price camera in my pocket and set out to explore. My mission was to photograph animals I wanted to make pets such as squirrels, chipmunks, and rabbits. A sense of adventure propelled me deeper into the grassy fields of rural Nebraska. My trusty sidekick Domino (pet dog) was a great companion always by my side. An old Schwinn bicycle served my iron horse. We set our sights set on the distant horizon over which, somewhere, the rolling hills of Nebraska had to turn into mountains. Years later I landed on that distant horizon asked to make aerospace parts whatever those must be. I was a long ways from those squirrels and endless cornfields in Nebraska. I'm also few boot sizes bigger from those days, but still armed with my cameras and and a sense of adventure. Only this time I have a vast desert and dozens of mountain ranges to explore. The wilderness here hasn't much changed since the original Spanish colonists arrived nearly 500 years ago. Heck I imagine this place is not much different than when God created it. What has changed is the internet. Nobody grew up dreaming of being an internet sensation, rotary phones were still the big thing! The only viral videos to be found were on Saturday morning of Wile E Coyote chasing the roadrunner.

Comments are closed.