Archive for the ‘OOP’ Category

Background

I’ve graduated in March 2010 and I don’t need to visit university any more. However, I enjoyed studying there and I know what challenges my fellow students-programmers have. That’s why I continue the job started this autumn – computer club, we call it “Geeks’ Club”. Sure, we’re not true geeks there, but we tend to be :) So I’m helping students who’re interested in web-technologies and in object-oriented programming. I explain them things that are not covered in the standard university course. Things, that are more practical and they can be paid money for.

Continue reading ‘Requirements and Use Cases. SMS Notification System.’ »

Low coupling

When designing some architecture, you face with the problem “which object should perform X task?” We discussed this question in my previous post in this series. There we noted, that object should perform the tasks he has enough info for. He should be an “expert”. But because one of the main OOP characteristics is interaction between objects, it’s often hard to answer this question.
Continue reading ‘Low Coupling and High Cohesion – GRASP (Design patterns series)’ »

Introduction

OOP stands for Object-Oriented Programming. What does it mean? And what’s the difference between OOP and procedural programming? We’ll go through all these terms, We’ll demonstrate the difference of these approaches and advantages of the OOP over procedural concept. Examples are for PHP, but concept is the same in all object-oriented languages.

So, let’s start with defining, what OOP is and how it differs from procedural programming. Just take a look around. For example, you see a table. Consider you have to program it. When using procedural approach, you focus on it’s behaviour (for example, you write function, that calculates height or that assembles it from the given dimensions). However, table has properties besides behaviour. When following procedural paradigm, we create variables for each property – height, width, length, square, weight. All that data – properties (variables) and behaviour (functions) describe the object from the real world – table. What’s wrong with this approach? Nothing wrong, everything is fine, when we’re dealing with one table.
Continue reading ‘What is OOP (Object-oriented programming)?’ »