[nycphp-talk] OOP
Jim Hendricks(Biz Computing)
jim at bizcomputinginc.com
Thu Oct 17 08:18:53 EDT 2002
>
>
>I've been concentrating recently on building reusable components and
>frameworks. While this is doable with procedural code, having object
>handling makes some of it much easier. In PHP, the lack of private and
>protected entities makes this more a syntactical issue than true
>encapsulation.
>
>I do, however, find that even the illusion of encapsulation tends to
>encourage better code organization.
>
reusable modules are always your best candidate for OOP. In this
situation, the implementation details are only important at the time of
module development or improvement. For the consumer of the module, the
interface is all that matters. And yes, your right, this can also be
done with procedural code, you produce your module as a seperate file,
each procedure's call interface clearly documented, all data passed as
procedure arguments.
There's also no argument from me that OOP encourages better code
organization. With procedural code you can make a real mess, OOP
provides the organizational framework so your potential for a mess is
lower. I don't want to sound all doom and gloom on OOP, but I don't
think it really is all that it's hyped up to be. If I could get the
same performance out of OOP code as I can out of proc code, I wouldn't
care. It just seems that OOP has become the be all and end all of
development in most developers minds without even questioning it's
benefit or seeing it's downside. I also don't like a half implemented
OOP. I was first introed to OOP in the early days of PowerBuilder. I
had an acedemic understanding of OOP from C++, but PB was where I got my
feet wet. I initially produced some pretty nasty code, mostly because
PB allowed both proc code and OOP. It took a while for me to realize
that with OOP, the more OOPish my code, the more I would reap the
benefits of OOP. By the time I got into Java, I had it down pat, and
loved the fact that Java forced me all OOP so I couldn't get careless
and go back to the half breed code I was originally producing in PB.
I guess in the case of PHP, as with ASP/JavaScript/VBScript, I don't
like the OOP/proc mix. I guess I also don't like a half implemented OOP
where key features of OOP are missing. I've only been working with PHP
for about a year now and only the past 6 months or so with real
development. I also don't have any paying projects yet in PHP so my PHP
time is only a fraction of my dev time. I have yet to really dive into
the OOP side of PHP so you never know, I might find I like it and flip
all my stuff over to OOP. I do know that I have some stuff in my
existing app that could really benefit from inheritance.
More information about the talk
mailing list