[squeak-dev] Coding style

Bert Freudenberg bert at freudenbergs.de
Wed Mar 10 10:33:36 UTC 2010


On 10.03.2010, at 11:29, Nicolas Cellier wrote:
> 
> 2010/3/10 Bert Freudenberg <bert at freudenbergs.de>:
>> On 10.03.2010, at 02:53, commits at source.squeak.org wrote:
>>> 
>>> +     ^packageList ifNil:[packageList := (PackageInfo allPackages collect: [ :each | each packageName]) sort]!
>>> -     ^packageList ifNil:[packageList := (MCWorkingCopy allManagers collect:[:each| each packageName]) sort]!
>> 
>> 
>> This to me replaces one style of too few spaces with another of too many ;)
>> 
>> I'd have written
>> 
>>        collect: [:each | each packageName]
>> 
>> but I just looked at the Blue Book and there indeed is a space before and after a block argument. OTOH it does conform to Kent's examples:
>> 
>>        http://c2.com/ppr/formatting.html
>> 
>> Generally I feel this is not much of a problem. But I have occasionally seen rather strange formatting, So for the benefit of better readability, do we want to have general rules for formatting code?
>> 
>> Many projects have such rules. One good example IMHO is PEP-8 in the Python community.
>> 
>> For Smalltalk I only know Kent Beck's rules from "Best Practice Patterns" which seem like a good set. And IMHO any rules are better than none, so maybe we want to just agree that if in doubt, follow that suggested practice?
>> 
>> - Bert - (hoping this does not open a can of worms ...)
>> 
> 
> Same discussion was just taking place at Pharo a few days ago.
> There seem to be established rules also for Seaside & co package developpers.
> 
> Nicolas

Ah, can you point us to those rules? Simplest might be to just adopt them for trunk packages.


- Bert -





More information about the Squeak-dev mailing list