Why OO? WAS Re: [thelist] php design question

rudy r937 at interlog.com
Tue Nov 19 19:18:01 CST 2002


>          Okay. Not to belabor this too much more, but I just had another
idea.

no, don't apologize, this is web development, so this is on topic

>          Say you want the menu items to DO different things on different
pages.

form versus function?  style versus content?  why would i want to
encapsulate that?

>          Say that you want one to turn red, one to turn grey, and the
> seventh one down (whatever it is) to turn blue, because this is page
number
> seven. (Also, imagine that the colors that you want things to turn are
> different for every page, adding up to several million combinations.)

you do not indicate how this colour change is to happen

i would expect it to be done via stylesheet classes, not FONT tags

actually, i've done something very much like your "smart" nav bar --

   http://lists.evolt.org/index.cfm/a/harvest/b/detail/c/_/d/3803

and as for millions of combinations, i realize you were trying to construct
an example, but that's contrived, nobody would build a web page like that

>          Object Way
>          1) Write a function for the menu object, called init(), which
does
> the above correctly based on the page you're in.

heh, that conveniently sweeps a whole boatload of coding under the carpet

millions of combinations, you said

the code will be just as messy as the include, if not worse

>          If you want to change what every page in the whole system does,
> you just have to change how the init() function behaves.

sweep, sweep...

> And more useful in application code than in web pages.

i believe that

;o)




More information about the thelist mailing list