[thelist] php design question

Max Kanat-Alexander maxka at cats.ucsc.edu
Mon Nov 18 20:55:01 CST 2002


--
[ Picked text/plain from multipart/alternative ]
At 06:34 PM 11/18/2002, you wrote:
>or an include is a snippet of code, like the footer text, which i have
>a hard time seeing why i would want more than once per page...

         Yeah, in those cases I usually use includes as well. In fact, in
almost every case I use includes.

         It is, of course, generally poor programming structure, but
includes are much better supported in Web-Development languages.

>thanks for trying, but could you relate that to html, divs, web pages, and
>includes (which i take to be portions of web pages, or portions of the
>scripts that generate web pages) -- like, a nav bar at the top of each page

         All right. The difference between includes and objects, as far as
web development goes, it often not significant. However, there is:    A) A
conceptual difference
         and
         B) A difference to the server

         Include Way:
         1) I have CODE for a nav bar.
         2) I include that code in a page.
         3) Server generates a nav bar every time I ask for any page, and
then sends it to the user.

         Object Way:
         1) I have a file that contains code for a nav bar.
         2) When I save that file, I now have a "Nav Bar" as a concept.
         2a) I can say, "Dance, Nav Bar, dance!"
         3) I "call" that object from my page. (navBar.show(), let's say)
         4) Server asks the Nav Bar to generate itself and then sends it to
the user.

         Now, that's really, really basic. It's not even totally accurate.
I could have made that explanation way more complex, but I don't think that
it needs it.Web Pages don't USUALLY require totally object-oriented
programming. (As for the question "what IS object-oriented programming,
really, and why use it..." don't ask. :-) That one took me a year of
writing application code to really understand. There are some excellent
explanations online somewhere, I am sure.)

         The short answer is: No, there's almost never a difference between
objects and includes in current web development languages, but there is a
CONCEPTUAL difference, and that difference may matter in the future.

         -Max
--




More information about the thelist mailing list