On 17 Jul 2002 at 12:43, Michael Hall wrote:

> There is no simple answer here. I have started using classes where I
> find I am writing a lot of related functions that share similar
> parameters. Database connection and queries are a good example.
> Authentication is another.

Yeah.

> I have another class that builds forms, because I just hate the tedium
> of coding HTML forms by hand. It is really just a collection of
> functions, though, and could work fine as such.

This is a gray area imho. I'd leave all html to the person who cares 
what it looks like, not what it does. I usually also use a code 
generator to create html and their forms but they are a separate 
layer. I use templates, wish a lot more php people would as well 
although I've seen some weird stuff where in this one bb they store 
templates in the database. That's interesting. 

> I'm still learning/exploring ... I am always guided by the principle
> that whatever makes less work for me (but achieves the same result) is
> probably a good thing.
> 
> IMHO classes are best for more universal code that really can be used
> in many different places. My functions tend to be more application
> specific.

Yeah, can't say too much more than that. There is the style of coding 
where one application is completely independent of another. Then you 
begin to realize, gee ... I could just cut and paste this code. And 
then there's always the funny repetion of the exact same code every 
30 lines or so (depending on memory of programmer I guesss). 
Eventually you begin to realize gee ... could I put this stuff in a 
library. A CLASS after all is just a collection of functions with a 
data model. But ... there is modular and then there is OO imho. I'm a 
die hard modular programmer who is trying to think in a more OO way. 
But of course when you just gotta get something done, do it. The 
value in spending a bit more time going the modular/OO route is that 
your application will be easier to evolve and debug.

Peter-- http://www.readbrazil.com/
Answering Your Questions About Brazil


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

Reply via email to