Less code is not necessarily more readable (and it's often less maintainable). I much prefer
draw(Rectangle rect, Point point)
over
draw(rect, point)
Notwithstanding the fact that the former enables automatic refactoring and easy browsing while hardly anything can be deduced from the latter.
— a comment by Cedric Beust on his Continuous Tax
Read the examples carefully for a moment. Do you notice anything amusing? I'll give you a hint. How much more maintainable would the first example be with only one simple change?
draw(Rectangle rectangle, Point point)
There. That's much much better better. It almost doesn't need a comment.
"Draw" is such a vague name...drawRectangleAtPoint(Rectangle rectangle, Point point)
Re:Actually...
lachoy on 2007-12-20T15:14:04
Or:rectangle.drawAt( point )Re:Actually...
chromatic on 2007-12-20T16:41:43
You must be a Perl hacker. The compiler can't enforce and your IDE can't infer anything about
rectangle
orpoint
. What if someone accidentally passed in aBouncyBall
? It's like the end of Watchmen all over again.Re:Actually...
jjore on 2007-12-23T07:02:06
"Ok?"
^rectangle drawAt: pointRe:Actually...
jjore on 2007-12-23T07:08:51
Just meaning, I get a pretty awesome IDE in Smalltalk but all I can infer about rectangle is that it responds to the draw: method.Re:Actually...
chromatic on 2007-12-23T18:19:12
Smalltalk had an IDE? It's impossible to write an IDE for a dynamic language! Now Eclipse, that's an IDE.
(Before anyone responds, ask yourself "Hey, why did he mention Eclipse and Smalltalk together?")