On Sun, 28 Feb 2010, James Foster wrote:


On Feb 28, 2010, at 1:58 AM, Stéphane Ducasse wrote:

Lukas do you have some code samples.
Something that I particularly hate is the following

        self bla ifTrue: [
                ...

        ] ifFalse: [
                ...
        ]

I'd like to understand what it is about the above you hate.

It's like C code, not like a message send. Do you write code like this?

aCollection do: [ :each |
        ...
] separatedBy: [
        ...
]


That is see in the code.

I want
        self bla
                ifTrue: [ ...
                                        ]
                ifFalse: [
                        ...             ]

Does the code in the ifTrue: block begin on the same line? How about the 
ifFalse: block? If it begins on the same line, then how many indents for the 
second line?


IMHO, if the code in the first block is short enought, then it's only a single line, otherwise not, for example:

self bla
        ifTrue: [ self bar ]
        ifFalse: [
                ... ]

self bla
        ifTrue: [
                ... ]
        ifFalse: [
                ... ]

This book has great guidelines:
http://stephane.ducasse.free.fr/FreeBooks/WithStyle/SmalltalkWithStyle.pdf


Levente



_______________________________________________
Pharo-project mailing list
[email protected]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
_______________________________________________
Pharo-project mailing list
[email protected]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

Reply via email to