Path: news.cs.au.dk!news.net.uni-c.dk!newsfeed1.uni2.dk!newsfeed.online.be!ams-newsfeed.speedport.net!newsfeed.speedport.net!bignews.mediaways.net!news.netcologne.de!skynet.be!poster!not-for-mail From: Atle Newsgroups: comp.lang.beta Subject: OO - General questions, suggestions and ... Date: Tue, 27 Jun 2000 12:36:09 -0100 Organization: Belgacom Skynet SA/NV Lines: 37 Message-ID: <3958ADC9.C4E320B1@skynet.be> NNTP-Posting-Host: dialup79.charleroi.skynet.be Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: news1.skynet.be 962101891 12600 195.238.7.79 (27 Jun 2000 10:31:31 GMT) X-Complaints-To: abuse@skynet.be NNTP-Posting-Date: 27 Jun 2000 10:31:31 GMT X-Mailer: Mozilla 4.51 [en] (X11; I; Linux 2.2.5-15 i686) X-Accept-Language: en Xref: news.cs.au.dk comp.lang.beta:12493 .... the inevitable call for help :-) OK, so one of can ask more questions than ten of can answer ... that is old wisdom: Een taabe kan spørge mere, end ti viise kan svare ... :-D) But still, I am doing a 'tokenizer' as an excercise. The program scans the file for atoms, so the pattern file.getAtom determines what a 'token' looks like. I feel that there are three main object involved here: - Program - TokenStore - FileReader I have made a working program, but the only part of it I am satisfied with, is TokenStore. An instance of the TokenStore pattern understands - storeToken: (* Store a TokenName:, do nothing if token: already in TokenStore: *) - has: (* see if TokenName: already in TokenStore: *) - putLine: (* Write out the contents of TokenStore: *) But now what? This is where a C-programmer would write a procedure ReadFile, calling TokenStore.StoreToken for each found atom, and be happy if it works. But I know this is not the way, the beauty of TokenStore and the ugliness of the rest has me convinced. I am unable to see the 'Object' connection here: Is TokenStore a Partobject in FileReader? That would work, but ... how about the other way around: TokenStore knows how to get tokens from file? That is a little more logical ... but still not it. I don't like this sort of confusion ... but I think I know how it must be, but before I do it that way and upload my 'tokenizer', I would like to know what you think about it: I finally found an application for my generators - FileReader: is a TokenGenerator: ------------------------------ For each found token, it will SUSPEND with the found token in its EXIT list. The Program is the main singular object, and contains the TokenGenerator: and the TokenStore: as Partobjects. It will contain a loop (should it contain a FILE: or not?) calling TokenGenerator and StoreToken until (what? TokenGenrator returns: ___?) Is this the way?