|
|
Subscribe / Log in / New account

Quotes of the week

Every project I've seen that undertook "code cleanup" was very soon canceled. The insight is this: if a project has nothing better to do, no more pressing customer demands, no greater innovation to bring to market than changing code comments, then it is near death already.
-- Rob Weir

- pa_log_warn("D-Bus name org.pulseaudio.Server already taken. Weird shit!");
+ pa_log_warn("D-Bus name org.pulseaudio.Server already taken. My word, "
              "this is an extraordinary occurence I dare say!");
-- Eric Williams cleans up PulseAudio

Programming is tough enough; don't go putting pretending the object is more important than the verb, for goodness' sake! Verbs verbs verbs.
-- Tom Christiansen

to post comments

Quotes of the week

Posted Jul 14, 2011 9:37 UTC (Thu) by richard_weinberger (subscriber, #38938) [Link]

Don't you have better things to do than fixing offensive PulseAudio logs? ;-)

Quotes of the week

Posted Jul 14, 2011 11:59 UTC (Thu) by randomguy3 (subscriber, #71063) [Link] (1 responses)

I would disagree with Tom Christiansen here.

$wizard->summon("Gandalf");

is the equivalent of

$wizard, summon Gandalf!

and so it's a perfectly natural order.

$mage = Wizard->summon("Gandalf");

reads as

Set $mage to the result of telling Wizard to summon Gandalf.

Again, a perfectly natural order.

Quotes of the week

Posted Jul 15, 2011 5:27 UTC (Fri) by jzbiciak (guest, #5246) [Link]

For "factory" type objects, which is what your example roughly is, the object of the verb is not the object itself, but what you'd have the object produce. In this case "summon Gandalf" is the phrase, and Gandalf is the object of the verb.

In this case, "summon" is not a mutator. It doesn't appear to change the Wizard object's state (unless Gandalf was cranky that day and took it out on Wizard on the way in).

Tom's pattern really applies to mutator-type methods--that is, methods that act on their host object itself. For example, consider "$image->resize($new_x, $new_y)". You're image resizing to the dimensions ($new_x, $new_y)? Maybe if you're Yoda. "Resize image to ($new_x, $new_y)" feels like more natural English. Here, the verb "resize" acts directly on the object $image.

Which order feels more natural really depends on whether the verb (ie. method) operates primarily on the object itself or primarily on some other object. So really, we need both orderings.

Verbs and tenses

Posted Jul 15, 2011 16:13 UTC (Fri) by rfunk (subscriber, #4054) [Link]

Sorry, but in so many cases (maybe most, but definitely not all), demoting the object to second-class status (or worse) means the reader has trouble finding the context for the action.

Reading that Christiansen post reminds me of why I grew to hate a language I once loved. Designing a programming language based on the ideas of your natural language gives you all the ambiguity and imprecision of natural language.
(Similar to why people hate reading legal documents, which are an attempt to give natural language the precision and lack of ambiguity of programming languages.)

And I don't know why he mentions both
sort { a <=> b } @nums
and
{ a <=> b }->sort(@nums)
but not the most logical
@nums->sort { a <=> b }
other than the possibility that the latter is invalid in Perl.

Quotes of the week

Posted Jul 21, 2011 18:24 UTC (Thu) by Zizzle (guest, #67739) [Link] (3 responses)

Rob Weir continues to motivate me to hack on LO.

If only I could get it to build on my machine.

Quotes of the week

Posted Feb 16, 2012 10:08 UTC (Thu) by dag- (guest, #30207) [Link] (2 responses)

I guess there is a reason Rob's quote became a quote of the week, and it would have been interesting to learn why.

> Every project I've seen that undertook "code cleanup" was very soon canceled. The insight is this: if a project has nothing better to do, no more pressing customer demands, no greater innovation to bring to market than changing code comments, then it is near death already.

If we apply this quote to the LibreOffice project (which is what it was referring to, I presume) it is a misplaced comment. The statement that a project that does code cleanups has nothing better to do, is a false or misleading statement. The fact that Rob only saw such projects fail, may be related to the context of Rob's work, who knows ?

Fact is that if you look at the monthly releases of LibreOffice since the project started, you see a vast progress at a fast pace. And even with code cleanups being part of these releases, a large chunk is bugfixes, improvements and feature enhancements. Anyone following this progress feels a new breeze in what used to be OpenOffice.

But there are (of course) valid reasons to do a code cleanup, especially when you inherit a large piece of code that's been at least 15 years old and has changed owner a few times during its course. For one, less code is easier to read and maintain, hides less bugs and generally runs faster. But it is also important to restructure your code base so other people understand how stuff relates. One could say that the code base reflects how open and transparent a project is and if there is a wish/need for a code cleanup it positively reflects on the project and how it is run.

So despite the insinuations of that quote, in no way does it reflect what is happening in reality. And that in itself should make it suspicious and begs the question: what's behind the statement ?

Quotes of the week

Posted Feb 16, 2012 17:52 UTC (Thu) by dmarti (subscriber, #11625) [Link] (1 responses)

Come on, be fair. The idea of "cleanup" scared me too, when I was using Subversion. Almost as bad as "refactoring."

Quotes of the week

Posted Feb 16, 2012 19:07 UTC (Thu) by dag- (guest, #30207) [Link]

What's up with the lack of substance ?

Look at the progress LibreOffice has been making, did the current cleanup make the product worse ? Did it affect functionality ? Did it slow down new features and progress ? Apparently not. If you get scared of the idea of a "cleanup" maybe LibreOffice can prove how it needs to be done and get you over that phobia ?

No FUD needed if reality is catching up...


Copyright © 2011, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds