Solved

How to create a full OOP application?

Posted on 2004-10-24
191 Views
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.

Regards,
Hamid
0
Question by:HamidHossain
    3 Comments
     

    Author Comment

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

    Accepted Solution

    by:
    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
     
    LVL 49

    Assisted Solution

    by:Roonaan
    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

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Highfive + Dolby Voice = No More Audio Complaints!

    Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

    A colleague recently asked me about how to give his client a small part of the web site that could be completely under the client's control.  Since I have done this sort of thing before to add emergency banners to a web site, I decided I would creat…
    Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
    Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
    The viewer will learn how to dynamically set the form action using jQuery.

    934 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

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now