Object oriented programming is a term you will hear and read about often. Not only when it comes to C# but other modern programming languages. Terminology can be very important when you are understanding all the concepts and fully grasp all the functionality of a programming language.
C# is an object oriented language.
What does this mean?
- It means that it’s grouped into and carried out by objects.
- The objects are defined by classes that are used to create objects.
- What’s the advantage of OOP?
- Code is divided into stand-alone groups. We can easily construct a program that has multiple classes, allowing each classes to have a very specific set of instructions and then we use the class to build the objects that we can later use to carry out that functionality
- Code can be easily re-used. We can build code once, put it into a class and multiple parts of our application utilize that class to create objects to carry out functionalities. We should only be writing code and functionality one time then use it over and over again in different parts of the application and expose the classes to other application which they can later be used.
- Complexity is greatly reduced. Each class can be easily managed as separate files which allows easy access to modify them in the future.
- De-coupling can be achieved. Think if we build a large complex application, you can see how every part of the application depends on other parts of the application. This can be an issue when it comes to maintaining the application as the application may need to be evolved based on the business requirements. By de-coupling, it means that each classes don’t necessarily depend on each other, there’s not a lot of hard wired functionality making it easier to update each classes independently without having cascading surprises inside the program.
- Extensibility, if the functionality of the application are separated into discrete section of code, we know as classes, we can easily add classes that can extend the functionality of an existing class without overriding any existing functions.
Object Oriented Programming really helps us create very efficient applications that can be very easily maintained even extended and changed. To really appreciate this, you would have to have experience working with some of the non-objected oriented languages such as basic or C that required a structured line by line set of instructions that would start from top to bottom running in order.