Programming with Classes – My Personal Journey into OOP with C#
Over the past few weeks at my College Byu- Idaho— I had the opportunity to dive deep into the foundations of Object-Oriented Programming (OOP) using C# and wow, what a journey it’s been!
Rather than just learning syntax or solving isolated exercises, this experience helped me shift my mindset to think like a true software developer. I worked on hands-on projects inspired by real-world scenarios—like an exercise tracker, order management system, and a gamified EternalQuest program—each one reinforcing the four core pillars of OOP: abstraction, encapsulation, inheritance, and polymorphism.
These weren’t just theoretical buzzwords. They transformed the way I think about writing code—clean, modular, scalable, and adaptable to change. Here's how each of these pillars played a key role in my development process:
🧠 1. Abstraction
Definition:
Abstraction means hiding unnecessary implementation details and showing only the essential features. It helps us focus on what an object does, not how it does it.
How I used it:
In my last Exercise Called Tracking Program, I created an abstract base class called Activity
with general methods like GetSummary()
and GetDistance()
. The specific calculations—like speed and pace—were implemented in child classes like Running
, Cycling
, and Swimming
.
Why it matters:
Thanks to abstraction, I can now easily add a new activity (like Yoga or Rowing) by simply creating a new class that inherits from Activity
. No need to touch existing code. Clean. Scalable. Beautiful.
🔒 2. Encapsulation
Definition:
Encapsulation means bundling data and behavior inside a class, while restricting direct access to that data. It’s about protecting the internal state.
How I used it:
I made fields like _date
, _minutes
, and _distance
private, and accessed them via safe public methods. I also included validations—like preventing the creation of an activity with zero minutes.
Why it matters:
Encapsulation gave me control and confidence. I can now update internal logic without breaking the rest of the codebase. It prevents errors, reduces bugs, and makes debugging way easier.
🧬 3. Inheritance
Definition:
Inheritance allows a class to use (or extend) the features of another class. It reduces redundancy and promotes reuse.
How I used it:
My Activity
base class holds all common logic, and my specific activity types (like Running
or Hiking
) inherit and customize their own behaviors.
Why it matters:
Want to add a new activity? Just inherit. Override. Done. This design keeps everything DRY (Don't Repeat Yourself) and makes my code future-proof.
🌀 4. Polymorphism
Definition:
Polymorphism allows different object types to be treated as a common type, and to execute their own behavior accordingly.
How I used it:
I stored all my activities in a List<Activity>
and looped through calling GetSummary()
—but each object executed its own version of the method, based on its class.
Why it matters:
One loop. Unlimited possibilities. I don’t have to check object types or duplicate logic. My program is flexible, clean, and open to endless expansion.
Final Reflections
This experience was more than just a course or assignment—it was a mindset shift. From scratching my head over abstract classes to feeling like a code ninja with polymorphism, I’ve grown a lot.
Now, I don’t just write code—I design smart, flexible solutions.
Still not sure if I’m a software developer or just a wizard in disguise, but one thing’s for sure:
I’m ready for the next level.
Thank you for reading!
May Heavenly Father bless you with wisdom and joy in all that you do.
📬 Let’s stay connected:
GitHub: github.com/thneri95 Peak a look at my portfolio!
See you out there! 🧑💻