[wp-hackers] Improving the mailing list. (Was Auto Update Plugins)
wordpress at santosj.name
Sat Feb 21 20:52:36 GMT 2009
The "Code is Poetry" mantra is a farce and should die as the religion
behind it is no more (Not to say WordPress as a religion or Hinduism is
dead, but the nonexistant religion used to slam the slogan is). A code
review of some of the older bits has shown in the past that if you are
talking about core code, you will see gems worthy of TDWTF.com. There
are some beautifully written parts of code, some date back to 2.0 and
even a few date back as far as 1.5 (plugin API, new, not the old).
That said, the instance I'm talking about was in the widget API and that
wasn't created until I believe 2.0 and wasn't included until 2.2. There
have been other parts, but I don't actively care or review code for
smelling (not that I can fix add_post() anyway, it probably has good
reason for it's extremely high C.R.A.P)
I think the problem with it, is that it takes from Behavior Driven
Development and the philosophy that function calls should be words that
people (developers and end users) can understand, as well as the code
should be self-documentable.
To use the discussion from a co-worker:
"Why do they say, 'Code is Poetry'?"
"I don't know, that is just something they say."
"The code doesn't rhyme."
If the slogan is supposed to be that the code shouldn't "Stink" then it
should say so, but "Code is Poetry" means nothing, unless it is applied
to some worthless to something of worth from Apple, whose shit doesn't
stink and is gold colored (some say that is because it actually is gold,
but I don't tend to believe crazy talk).
That said, there are many part of the WordPress code that does Smell and
smells quite awful sometimes. If you apply the metrics for coding to
WordPress, most of the functions will be off the wall, passed what they
are normally and what they should be. Now, I do know that metrics aren't
everything and being able to break them is part of developing a project,
yet it stands that the majority of important parts of the code exists of
functions with around or over 20 lines, with fantastic level of C.R.A.P.
So I mean, "Code is Poetry" should not be applied to WordPress, unless
you want someone to go through the worthless task of creating functions
of names that actually do rhyme when you call them in HTML. "Code
Doesn't Smell" should be the slogan of WordPress, as they can go to
Wikipedia to get the meaning and learn all about the techniques about it.
I would rather plugins, themes and patches not smell, than contain
"poetry." Code smelling (Blob class anti-pattern, lack of inline
documentation, lack of test cases, lack of code reuse, etc) is quite
frankly a bigger problem and something I'm more concern with than code
being some half-baked philosophy from what it would appear to be some
hippie or "drug specialist." (Specialist of the Weed (not the kind you
pull up from the garden)).
I'll rather people not associate me with a drug user or a hippie thank
you. My code doesn't (hopefully, and by damn, I will fix it if it does)
PS: Although the use of fallacies of argument are used throughout the
reply, I don't think it takes away from the overall message that "Code
is Poetry" is worthless, because it doesn't mean anything except to Matt
Mullenweg and if he uses it, then it will be another argument from
fallacy. People may think they know (I have no clue, except what I've
read of "good" code that doesn't "smell"), but they don't, because it
hasn't been defined by the person who stated it. If we are going to have
the philosophy that function names should reference the action they are
going to take and describe the purpose of the function, then that is
okay. There is a name for that and it isn't "Poetry" and I implore
people to find it.
Peter Westwood wrote:
> On 21 Feb 2009, at 00:47, Mike Schinkel wrote:
>> Your list is very helpful but can I please ask for clarification on
>> this point?
>> * Work with the project philosophy not against it
> Ok. It is hard to describe in a succinct way but there are a few
> things in general.
> * "Code is Poetry"
> * WordPress is a platform
> * "Options are bad" - User Interface should be simple, obvious and
> easy to use for everyone (including your cat ;-))
> * Standard compliance
> "Options are bad" is the one that people often come up against and
> have the most trouble with. The basic idea behind this (for me) is
> that the software needs to be configurable but you should only present
> the user with the options they really need to care about - the rest of
> the time you make a decision about what is the best behaviour and you
> just implement that. This implementation should be done in such a way
> that hooks (actions/filters) are available so that a different
> implementation can be provided by a plugin.
> I'm sure I've missed a lot here.
More information about the wp-hackers