[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now


How to create a full OOP application?

Posted on 2004-10-24
Medium Priority
Last Modified: 2010-05-18
I am creating a content management system using PHP. I am trying to use oop classes.

My problem is:

I have created so many classes. One for database, file manipulation, data validation and so on. Now, database class needs to call some functions in the validation. file manipulation needs to call database and validation also.

I cannot use :: to execute a function in another class. I have to create an object of each and every class. because class function needs each others.

Finally, I found that I have to create extended classes ALWAYS, to have access of all functions. I am really scared about using this as the application grows.

Any advise would be highly appreciated.

Question by:HamidHossain
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Author Comment

ID: 12396499
Note that the 3 classes mentioned above are examples to clear the idea. real live application might more than three connected classes.
LVL 48

Accepted Solution

hernst42 earned 500 total points
ID: 12397647
Why don't you use a db-object in the file-maninpulation class instead of extending the file-manipulation class from the db-class

Have a look at this design pattern of OOP:

Also read this thread to better unsteadn the way OOP works.

If you get stuck, Could you post you clas -definitions here (what you have so far) without the function-code like this:
class A {
  function b() {

class B extends A  {

LVL 49

Assisted Solution

Roonaan earned 500 total points
ID: 12398137
As the "design patterns" phrase has already be mentioned; take a look at www.phppatterns.com

They offer a clean description and implementation of patterns.

For a CMS system, you could read into the singleton, registry and possibly observer/observable and decorator pattern.


Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to count occurrences of each item in an array.
Suggested Courses

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question