From: Mikael Brockman Date: 2004-08-19T14:32:06+09:00 Subject: Re: When to use parentheses around method args? Richard Dale writes: > On Patrick Logan's blog he gives a ruby example in discussing design > trade-offs implementing a visitor/decorator pattern with search trees that > are a mixture of elephants and boxes of elephants. > > http://martinfowler.com/bliki/CourtesyImplementation.html > > But I just couldn't work out what the code meant at first - it took me about > 5 mins of staring at it before the penny dropped.. > [...] > It's like one of the 'Escher mind teasers' where you seen a cube from one > perspective, and then suddenly your brain flip-flops to another one. > > Are there any rules of thumb for when it's a good idea to leave out the > brackets and when to use them? In method definitions, I use parens unless there's only one argument. In method calls, I use parens when I need to, or when omitting them looks weird. mikael