"Bobby Rahman" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I am new to PHP and was wondering whether to develop small applications
(20
> pages ) is it worth it to use OOP?

My take is that on 20 pages especially if they behave like app, it makes
sence to use OO.

> In particular I am having troubles breaking my application design-wise,
into
> classes and operations.

I could give you some hints how would you go on dividing things with
TemplateTamer.

When working with TT, you need to define a class for each page on your site,
and this class provides the data in the run time needed to display the page
(i.e. it provides values for the variables, and which templates get
displayed, etc).

First you would define base class for your site, that would contain handling
of elements common to all of your pages. For instance menu, footer, you get
the idea. For the parts that change from page to page (perhaps title, or
main content in the middle, or..) you would call a member function leaving
this function responsible to return correct values.

Now when defining the class for particular page, you would go on by
extending this base class for this site, and automatically inherit common
behaviour. For things that are specific for this page you would overide
member functions from the base class and provide specific implementation
(for instance function returning a middle content).

Now dependning on the size and complexity of your site, 2 things would
probably come naturaly. One is that you would refine your class hiearchy of
pages. So you would for instance have one base class, then for instance
class for the user pages, and class for supervisor pages, both of them
extending base class. Now all user pages would extend user page class, and
all supervisor pages would extend supervisor page class.

Anothe thing that could happen is that you would define classes for parts of
your interface, for instance toolbox, or similar. When you do so, you will
be able to configure them and insert as components in each particular page.

Probably it does sound like a lot of complication, especially in the
begging, but once you get a hang of it, it is a real time saver, an let's
you concentrate on your applications behavior and functionality. If you need
some more advice how to use TemplateTamer and OO togehter, drop me an
e-mail.

rush
--
http://www.templatetamer.com/




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to