

A Different Way: Traits in PHP - lucasoman
http://lucasoman.blogspot.com/2009/09/different-way-traits-in-php.html

======
wvenable
Perhaps if you need traits, you're doing it wrong. Does PHP really need all
the added complexity of this? Does it really help solve the problem or did you
just add a new maintenance nightmare?

~~~
sam_in_nyc
Honestly, what did you expect? The link was called "Traits in PHP." The
article described the initial constraint as being "stuck in PHP." This wasn't
an article arguing that it's a good idea to do it, but more of an exercise.

 _So your questions, does PHP really need all the added complexity of this?_

That doesn't matter. If you don't need it, don't use it.

 _Does it really help solve the problem, or did you just add a new maintenance
nightmare?_

This question is a false dichotomy. First, it wasn't trying to solve any other
problem then getting traits to work. So yeah, it solved that problem. Second,
new code always adds new maintenance concerns. Whether or not it's a nightmare
depends on the quality of code, which seems to be above par in this case.

As Nycto pointed out in this thread, there is a "Traits" patch which seems
preferable to this code. It's likely that OP didn't realize it existed and did
reinvent the wheel. But still, in terms of an exercise in PHP, I found it
quite cool.

------
tkiley
This article has spent an hour or two on the front page with no discussion.
I've always wondered what that means; perhaps in this situation, it means that
YC's active commenters aren't active PHP developers?

Regardless, I think this is a pretty cool idea. It seems like a lot of effort
to emulate what's (arguably) a missing language feature, but for those of us
who are stuck in PHP for one reason or another, it's an interesting
development.

~~~
jriddycuz
Yeah, it sounds _kinda_ nice to me. But that' because I'm stuck with PHP for
the time being. I'm tired of fighting the language though, so creating these
kinds of hacks just becomes more of an intellectual exercise.

And I think you're right that YC's commenters are by and large not PHP
developers. I've only known a couple of real hackers that work in PHP, and
even they didn't work in it by choice. Though it makes me a little sad to say
this because PHP was the first language I learned (hooray sentiment!), I hope
PHP dies off soon. It has matured in recent years, but unfortunately not in
any new directions. I'm gonna go out on a limb and say that the vast majority
of PHP programmers are idiots who couldn't code their way out of a paper bag,
and the better PHP hackers tend to be enterprise-y, as that's the direction
PHP is headed nowadays.

~~~
leftnode
I tend to agree, but I'll fully admit, I'm a PHP hacker and I've been hacking
in it since around 1999 or so. I didn't see this as much of a hack (read parts
of the paper associated with it) as much as a way to do some cooler things in
5.3.

I consider myself a pretty good PHP programmer, but you're right, most of them
out there don't deserve the title "programmer". I'm so disgusted by 99% of the
open source PHP crap out there.

That said, I do look forward to learning new languages and new ways to develop
on the web (what I really love doing).

