Newsgroups: comp.lang.smalltalk
Path: cantaloupe.srv.cs.cmu.edu!europa.chnt.gtegsc.com!news.mathworks.com!news.alpha.net!uwm.edu!fnnews.fnal.gov!gw1.att.com!gw2.att.com!pacbell.com!tandem!nntp-hub2.barrnet.net!nntp-sc.barrnet.net!sony!col.hp.com!news.dtc.hp.com!hplextra!hplb!news
From: Gunther Walther <gw>
Subject: Re: Smalltalk formatting styles...
Sender: news@hplb.hpl.hp.com (Usenet News Administrator)
Message-ID: <D7y4tp.Dp6@hplb.hpl.hp.com>
Date: Tue, 2 May 1995 10:22:37 GMT
X-Url: news:3nsibv$1fp@Mercury.mcs.com
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset=us-ascii
References: <3nsibv$1fp@Mercury.mcs.com>
Nntp-Posting-Host: gwalther.hpl.hp.com
Mime-Version: 1.0
X-Mailer: Mozilla 1.1N (X11; I; HP-UX A.09.05 9000/715)
Organization: Hewlett-Packard Laboratories, Bristol, England
Lines: 53

loverde@MCS.COM (AstralWolf) wrote:
>     I have just begun dabbling with Smalltalk, and had some questions 
>regarding code style.  (After several years of C++, I have developed what
>I consider a fairly structured and easy to read code style)  
>     While I don't have any problem with the syntax, I have found it 
>somewhat awkward to structure the code so that it is readable. 

Just stick with your C style, at least thats what I do. What exactly that
means for you, depends on your C style ;-)

	style isSimilarToC ifTrue: [
		self looksGood.
	] ifFalse: [ :iKnowThisIsWrong|
		|localVar|
		localVar := #isBug.
		self perform: localVar.	
	].

For one liners I keep try to keep it in one line:

	style isSimilarToC ifTrue:  [self looksGood.]
			   ifFalse: [self looksBad.].

*For me* it is important to close something, on the level I opened it.

	style whileBad: [
		self doImprove.
		self sleepOverIt.
	]

> I'm not sure how to indent the
>code to maximize aesthetic value (and hence readability).

I found that it is not as necessary in Smalltalk as in C to
maximize the readability of code. Smalltalk allows me to keep
the code simple and short, and that goes a long way towards readability.

IMHO the build in formater in VisualWorks is of questionable value,
but then, formating style is also a matter of taste.

gunther


PS: As we have lots of small methods, consistency between these
    methods might be also an important issue of ST  style.
-- 
------------------------------------------------------------------
Gunther Walther                 | Phone: +44 117 9228518 (direct)
Hewlett-Packard Laboratories,   |    or: +44 117 9799910 x28518  
Filton Road, Stoke Gifford,     | FAX:   +44 117 9228972
Bristol, BS12 6QZ, U.K.         | EMAIL: gw@hplb.hpl.hp.com
NOTE THAT BRISTOL HAS NOW A NEW AREA CODE: 117 9 CHANGE YOUR RECORDS

