Introduction to Object Oriented Programming

In this article I’ll try to describe (at a very simple level) my interpretation of Oject Oriented Programming (OOP).

OK, let’s get started with OOP. Basically, there are things called classes. Just think of a class as being a ‘type’ of thing. For example, if you have a website that lets users register and log on to the site, you might set up a user class to enable them to do this.

Classes can be described and they can also do things. So, for example, for our user class we might describe (identify) users by means of their names, passwords, and email addresses.

‘Name’, ‘password’ and ’email address’ are called data members. The user will also be able to do things, for example, register with the site, log on to the site and, say, create articles. ‘Register’, ‘log on’ and ‘create article’ are called methods.

When a user attempts to log on to the website, probably by entering their name and password into a form, the ‘log on’ method can be called to check that the user is allowed to access the site. This will probably be done by checking the user’s name and password against a list of users stored in a database.

When a user attempts to log on, they create a particular occurrence or instance of a class. So, for example, if the class is called ‘users’, an instance of that class might be ‘john’. The class describes the users, whereas john is an actual user – he’s an object.


Author: John Dixon