Why Bother with OOP?

Why use OOP? Welcome to the latest news from TalkIT. If you want to know more take at look at our courses in OOP languages, for example developing in C#. In the next newsletter we will look at recent developments in Functional programming. When I first coded with OOP it seemed to add complexity without many benefits. It took me a while to appreciate this approach. Today developers consider other approaches like Functional programming. Hopefully reading this newsletter will help you make your mind up. These are my thoughts based on programming and training over many years. Please add your comments below.

Contents

The Story of OOP How to do OOP Slippery Jargon The First Principle: Encapsulation Other Bits

The Story of OOP

Most programming languages created over the last 30 years are Object Oriented. This was not always the case. When I started as a programmer with ICL over 25 years ago I developed in COBOL and FORTRAN. The program was one long monolithic piece of code. It was only broken up by procedure definitions. OOP Today you cannot avoid thinking about OOP. C not an OOP language, but Java C#, Python & Objective C are. Some languages take a more casual approach to enforcing OOP. Some are more rigorous. If you want learn an OO language have a go at any of our online courses.

How to do OOP

So how do you use OOP? Start by splitting your problem into a set of objects. These represent real world items in your application. For example, you can create an employee or a car object. The application is not seen as a process, but a series of clearly defined objects. These objects hold all the data and code about a specific item.

Slippery Jargon

There is lots of slippery jargon in OOP. But a good place to begin is by understanding what classes and objects are. These terms are easily confused. A class is a blue print or definition. It is like an architect’s plan for a house. An object is the actual thing. It is like the house built from the plan.jargon Many languages provide lots of predefined system classes. These are really useful as they mean you do not have to create everything from scratch. Classes can represent anything in your code with:

  • Visual UI elements like text boxes
  • Abstract ideas like dates
  • Concrete business items like products

Classes contain two types of things, referred to as members:

  • Attributes or data (variables)
  • Behaviour or code (methods)

So a class is an abstract definition and an object is the thing built from the class. Many objects can be built from a single class. These objects are called instances of the class.

The First Principle: Encapsulation

Encapsulation is one of the key principles of OOP. It means classes encapsulate or box-up their individual data and code. Each class looks after its own members. Classes then have to communicate with each other and the outside world in a very specific way. Communication happens via the class interface. Encapsulation improves the maintainability and robustness of your code. If you want to fix up something about an employee you work with only the Employee class. A good way to thinks about this is there a clear separation between

  • the private implementation of a class
  • and its public interfaceObjectJs

Other Bits

TalkIT has been very active on social media recently. We have been posting on coding and IT humour. Why don’t you connect with us on Twitter or FaceBook? You can follow all the latest news and let us know what you think. 20% off HTML5 course in Feb. Enter the Coupon H001. Learn to code online when & where you want. Do you want to move forward with your career in 2017 … how about getting a developer certification? http://ow.ly/MGV5307FTtu  TalkIT: The Basics of HTML http://v.iew.bz/PqDPC8  . Create good looking web pages. What Programming Languages to Learn – 2017? Picking winners is a dangerous activity. Many come & go. http://ow.ly/F32S306QVSG  Top 5 programming languages in 2017? Which languages provide career opportunities & salary? http://ow.ly/93KP305XEGe  C# Course: “I purchased from TalkIT because I trust the source” M.D. http://ow.ly/zr9v303625f  How to Secure Data? Databases are vulnerable. A security plan is best implemented from start. http://ow.ly/3T6i308C2nK  What Programming Languages to Learn – 2017? Picking winners is a dangerous activity. Many come & go. http://ow.ly/F32S306QVSG  SQL Server Database Development and Administration courses Bath U.K. Make your data work for you. http://ow.ly/xRom306RBKy  Top 5 programming languages in 2017? Which languages provide career opportunities & salary? http://ow.ly/93KP305XEGe  Do you want to move forward with your career in 2017 … how about getting a developer certification? http://ow.ly/MGV5307FTtu  Learn #MVC fundamentals in easy step-by-step stages. Videos with free trial. Created by experts facebook_circle_color-64twitter_circle_color-64    

David Ringsell TalkIT 2017 ©

Scroll to Top
Share via
Copy link