Introduction & Overview
Object Orientation & C# Classes
The course is part of this learning path
This course takes code from the Data Types and Variables course and refines it using object-oriented (OO) principles. We explore some of the main concepts of OO programming during this process, such as encapsulation, code reuse, and inheritance.
Along the way, we learn more about essential code structures such as conditional evaluation with if-then-else statements, functions for grouping code that performs a specific task, and for-loops for dynamically repeating an action. We will also look at how .NET and C# have object-oriented baked-in as a fundamental design principle underpinning the framework and language.
- Understand the benefits of object orientation and what came before it
- Learn about essential code structures and turn code into a class
- Refine the class code and learn more object-oriented concepts
- Learn about inheritance, a fundamental object-oriented concept
- Understand how object-orientation is a foundation principle of C# and .NET
This course is intended for those who already have an understanding of data types and variables in C# and now want to learn about object-oriented principles.
To get the most out of this course, you should have an understanding of C# as well as basic data types: strings, numbers, and Booleans. In order to follow along with the demos, you should also have a working development environment, whether in Windows, Linux, or macOS.
The GitHub repository for this course can be found here.
Object-oriented programming is a vast topic to which whole books are devoted to explaining and expounding its virtues. This course will discuss the elementary concepts of object-oriented programming and key features that mark it as different from other programming paradigms or styles. Then we'll move onto rewriting or refactoring, as it is correctly termed, some code from the previous course using OO principles. Finally, we'll look at how object orientation is baked into C# and .NET. Along the way, I'll introduce new concepts and features that will help us as we learn about OO programming.
As we saw in the first course, the compiled code that the computer executes is incomprehensible to most humans, so object orientation is all about writing code that easier for us to understand. Well written code is often referred to as clean or elegant, and to this end, there are several principles associated with object-orientation we need to follow to achieve this.
Two of these principles are:
A block or segment of code should be responsible for performing a single task.
The code to perform a task should be primarily self-reliant, so not dependent on the state of some unrelated variables elsewhere. This type of functional independence is called encapsulation.
To fully appreciate what object-oriented programming offers, we need to look at what writing code was like before the advent of OO or in a non-OO style. Looking at the Arrays program from the last course, we have lines of code that are all lumped together and execute sequentially, starting at the top. This example program is not difficult to read or understand as there are only a few dozen lines. What if there were thousands of lines, and some lines needed to be executed more than once, possibly out of sequence? Then things start to get complicated.
Hallam is a software architect with over 20 years experience across a wide range of industries. He began his software career as a Delphi/Interbase disciple but changed his allegiance to Microsoft with its deep and broad ecosystem. While Hallam has designed and crafted custom software utilizing web, mobile and desktop technologies, good quality reliable data is the key to a successful solution. The challenge of quickly turning data into useful information for digestion by humans and machines has led Hallam to specialize in database design and process automation. Showing customers how leverage new technology to change and improve their business processes is one of the key drivers keeping Hallam coming back to the keyboard.