• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 198
  • Last Modified:

How to create a full OOP application?

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.

Regards,
Hamid
0
HamidHossain
Asked:
HamidHossain
2 Solutions
 
HamidHossainAuthor Commented:
Note that the 3 classes mentioned above are examples to clear the idea. real live application might more than three connected classes.
0
 
hernst42Commented:
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:
http://www.zend.com/zend/trick/tricks-app-patt-php.php

Also read this thread to better unsteadn the way OOP works.
http://www.sitepoint.com/forums/showthread.php?s=&threadid=89421

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  {
...
}

0
 
RoonaanCommented:
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.

-r-
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now