Re: OOP in web development

From: Date: Wed, 14 Feb 2001 10:16:45 +0000
Subject: Re: OOP in web development
Groups: php.general 
Request: Send a blank email to php-general+get-39606@lists.php.net to get a copy of this message
I don't want to start an OOP flame thread here, so I'll shut up after this posting - it's just that nobody is speaking up for not using OOP :) The point needs to be made that code reuse, readability and maintainability do not come from whether or not you choose to use OOP techniques. They come from a combination of careful thought, planning, skill and experience. In almost all cases, whatever you write will be executed by a microprocessor that knows nothing of OOP, but just plods through a sequence of instructions, occasionally shooting off to execute a subroutine or two. What this shows is that whatever fine OOP constructs you devise they can be represented in the plain old procedural world. I'm pretty sure that most of the OOP tricks PHP does are done by pretending that things are objects but really they are arrays, and as you might expect, the procedural way to implement the same functionality is to use arrays! Mark's example comparing: create_table($data,"nowrap","black",null,"white",null,null,null,"Tahoma",12, null,null,null,array(array("bold"))); with: $t = new Table; $t->options = "nowrap"; $t->heading["bgcolor"] = "black"; $t->heading["fontcolor"] = "white"; $t->global["font"] = "tahoma"; $t->global["fontsize"] = 12; $t->column["total"]["format"] = "bold"; could more fairly have used something like: $t=create_table(); $t['options'] = "nowrap"; $t['heading']['bgcolor']= "black"; etc. As you can see, there is hardly any difference at all. My point is really that you can use whatever technique you want, but you can get your code reuse, readability and maintainability from either. As you might have guessed, I favour procedural as I feel that more of the code is visible and in my control. YMMV -- Phil Driscoll Dial Solutions +44 (0)113 294 5112 http://www.dialsolutions.com http://www.dtonline.org

« previous php.general (#39606) next »