Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.forth > #24836
| From | Christian Kellermann <ckeen@pestilenz.org> |
|---|---|
| Newsgroups | comp.lang.forth |
| Subject | Re: Request for comments on a first forth program |
| Date | 2013-07-29 10:09 +0200 |
| Organization | A noiseless patient Spider |
| Message-ID | <8738qxdbyd.fsf@pestilenz.org> (permalink) |
| References | (6 earlier) <87fvv3c9xt.fsf@pestilenz.org> <912b40eb-9435-4b53-a32f-3fd868fdedad@googlegroups.com> <877ggddbb7.fsf@pestilenz.org> <rKmdnecYscprum_MnZ2dnUVZ_rydnZ2d@supernews.com> <dd0b840e-962d-4e42-89bd-69aab331fb52@googlegroups.com> |
hughaguilar96@yahoo.com writes: > > What is good for large programs is also good for small programs. With > small programs you can fudge it and still get your program to work, > but if you make a habit of this, you will plateau at a fairly basic > level and never graduate to writing large programs. Also, remember the > maxim that I quoted previously: "Large programs that work started out > as small programs that worked." Most large programs started out as > small programs and then they evolved from there, but this only works > if the small programs were written using the same good practices that > are required for large programs. I disagree with you here. Let me add my own anecdotal claim: The large programs I have seen so far are most of the time in a constant state of rewrite. This is always due to changing specs and requirements from the users. Noone is able to foresee all possible requirements from the start. On the other hand programs written with all possible changes in mind tend to get more complicated than they have to be and one finds programmes just adding another layer of indirection around the first one they couldn't fully understand. > Also, I'm recommending that you use structs and array-definers. These > are simple data-structures. The data-structures aren't complicated, neither arrays, nor associated lists nor skip lists nor anything else. > That would be a very good practice, if he had actually done it. LOL What I did was writing a program that fits the *current* specification (which has been made up by myself very conveniently!) with as little effort as possible. What I got is a small and readable program, even if it is awkward in some placed because I didn't use common forth words (BL comes to mind, or BLANK for the initialisation of the board). > Don't get bogged down in implementing low-level support code like this > when you are just starting out. First, get your feet wet by writing > application programs. The purpose of the novice package is to let you > do this. You can work your way up from simple programs like this to > pretty large programs, just using the novice package. Later on, when > you have some experience, then you can write your own package > comparable to the novice package --- but you aren't going to be able > to write code comparable to the novice package without several years > of experience --- so don't rush it. I like building things from the ground upwards. If I need to know how other, more experienced people write more complicated data structures I can look at their code and learn or ask someone who knows. c.l.f is one of the few nice places on usenet for these kind of discussions. > Note that Elizabeth Rather and the entire Forth Inc. staff have NEVER > written anything comparable to the novice package. None of those books > from Forth Inc. mention structs at all, and structs are pretty > basic. I cannot speak for them. I personally find the books available nice as an introductory text and that's what their goal is. I am half way through the "Forth Programmers Handbook" and it has been a nice companion to the "classic" texts like "Starting FORTH" and "Thinking FORTH". Also Stephen's Program Forth book seems also great, it's next on my book stack. > If you spend upwards of $500 on SwiftForth, you don't get any > support for writing applications --- you are still exactly where you > are right now, wondering how to abstract out data-structures --- or, > worse, ignoring the problem and just manually coding this low-level > stuff (arrays!) inside of your application programs, as you did in > this robot-game program. I don't see why this is a Bad Thing at all. > Just to get an idea of how badly you have painted yourself into a > corner, try this exercise: upgrade the program so that the size of the > datum stored in the arrays is different from what it is now (add a > color datum associated with each board position). Or upgrade it so > there are more than one kind of robot that behave differently (some > that actively chase you, and some that wander around aimlessly). Or > upgrade it so there are more than one kind of hole (some shallow, so > the robot can climb out in a few clock ticks). Because you have > hard-wired so much information into your code, minor upgrades such as > this will be horrendous to implement --- this is a small program that > will NEVER evolve into a large program! As I said above, this is a change in spec that requires change in the program. And yes, the assumption that I store just a byte for each board position may become hard to maintain in the future. Then *this* part of the program needs to be replaced with a better data structure. > As a second exercise, rewrite the program from scratch the way that I > have described --- then pretend that your boss has walked into your > office and demanded the upgrades described above, which you had not > expected --- you will see that the upgrades are much easier to > implement when the foundation is solid. Let's pretend I projected a budget for the robots game with these specs, then the customer changes her mind about it. Then I would have gained speed if and *only* if I anticipated that mind change in the *right* way. If I would make a wrong guess, for my boss this would have been wasted money. On the other hand if I guessed right I would have been the hero of the day as the change could happen quickly. I claim that this is almost impossible to get right and all effort invested in implementing features based on guesses what the future requirements *might* be like is vasted effort. > The world is full of bad Forth programmers --- don't be one of them! > --- get into the habit of writing EVERY program in a professional > manner, whether it is small or large. :-) Now, I would like to say that if I am to implement your changes above, I would write yet another robot program reusing words maybe, but with a different data structure underneath. And as you said after a while I would see which words are worth keeping and are truly reusable. I did have a look at the novice package and it has been an interesting read! I still think for me this is -- at least for the moment -- to much to deal with. Thanks for your thoughts, Christian
Back to comp.lang.forth | Previous | Next — Previous in thread | Next in thread | Find similar
Request for comments on a first forth program Christian Kellermann <ckeen@pestilenz.org> - 2013-07-19 11:39 +0200
Re: Request for comments on a first forth program Ron Aaron <rambamist@gmail.com> - 2013-07-19 13:04 +0300
Re: Request for comments on a first forth program rickman <gnuarm@gmail.com> - 2013-07-19 12:43 -0400
Re: Request for comments on a first forth program Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-07-19 05:28 -0500
Re: Request for comments on a first forth program m.a.m.hendrix@tue.nl - 2013-07-19 03:56 -0700
Re: Request for comments on a first forth program m.a.m.hendrix@tue.nl - 2013-07-19 04:00 -0700
Re: Request for comments on a first forth program rickman <gnuarm@gmail.com> - 2013-07-19 12:51 -0400
Re: Request for comments on a first forth program Christian Kellermann <ckeen@necronomicon.my.domain> - 2013-07-20 21:28 +0200
Re: Request for comments on a first forth program anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-07-22 15:43 +0000
Re: Request for comments on a first forth program hughaguilar96@yahoo.com - 2013-07-24 20:00 -0700
Re: Request for comments on a first forth program Christian Kellermann <ckeen@pestilenz.org> - 2013-07-25 10:37 +0200
Re: Request for comments on a first forth program hughaguilar96@yahoo.com - 2013-07-26 00:00 -0700
Re: Request for comments on a first forth program Christian Kellermann <ckeen@pestilenz.org> - 2013-07-26 09:34 +0200
Re: Request for comments on a first forth program "Elizabeth D. Rather" <erather@forth.com> - 2013-07-25 21:40 -1000
Re: Request for comments on a first forth program hughaguilar96@yahoo.com - 2013-07-27 20:16 -0700
Re: Request for comments on a first forth program Christian Kellermann <ckeen@pestilenz.org> - 2013-07-29 10:09 +0200
Re: Request for comments on a first forth program m.a.m.hendrix@tue.nl - 2013-07-29 04:14 -0700
Re: Request for comments on a first forth program Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-07-29 07:49 -0500
Re: Request for comments on a first forth program "Elizabeth D. Rather" <erather@forth.com> - 2013-07-29 15:32 -1000
Re: Request for comments on a first forth program hughaguilar96@yahoo.com - 2013-07-31 17:50 -0700
Re: Request for comments on a first forth program Christian Kellermann <ckeen@pestilenz.org> - 2013-07-31 13:23 +0200
Re: Request for comments on a first forth program hughaguilar96@yahoo.com - 2013-07-31 18:05 -0700
Re: Request for comments on a first forth program Christian Kellermann <ckeen@pestilenz.org> - 2013-08-01 12:53 +0200
Re: Request for comments on a first forth program "Elizabeth D. Rather" <erather@forth.com> - 2013-08-01 09:58 -0500
Re: Request for comments on a first forth program hughaguilar96@yahoo.com - 2013-08-01 20:42 -0700
Re: Request for comments on a first forth program Brad Eckert <hwfwguy@gmail.com> - 2013-08-04 18:53 -0700
Re: Request for comments on a first forth program "Elizabeth D. Rather" <erather@forth.com> - 2013-08-04 22:05 -0500
Re: Request for comments on a first forth program hughaguilar96@yahoo.com - 2013-08-04 20:54 -0700
Re: Request for comments on a first forth program hughaguilar96@yahoo.com - 2013-08-17 17:06 -0700
Re: Request for comments on a first forth program Alex McDonald <blog@rivadpm.com> - 2013-08-05 05:50 -0700
Re: Request for comments on a first forth program hughaguilar96@yahoo.com - 2013-08-17 17:45 -0700
Re: Request for comments on a first forth program Christian Kellermann <ckeen@pestilenz.org> - 2013-08-05 22:14 +0200
Re: Request for comments on a first forth program hughaguilar96@yahoo.com - 2013-08-06 21:11 -0700
Re: Request for comments on a first forth program "Elizabeth D. Rather" <erather@forth.com> - 2013-08-01 01:04 -0500
Re: Request for comments on a first forth program albert@spenarnc.xs4all.nl (Albert van der Horst) - 2013-07-19 18:06 +0000
Re: Request for comments on a first forth program Christian Kellermann <ckeen@necronomicon.my.domain> - 2013-07-20 21:31 +0200
Re: Request for comments on a first forth program Christian Kellermann <ckeen@necronomicon.my.domain> - 2013-07-20 21:24 +0200
Re: Request for comments on a first forth program anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-07-22 15:32 +0000
Re: Request for comments on a first forth program Alex McDonald <blog@rivadpm.com> - 2013-07-19 06:49 -0700
Re: Request for comments on a first forth program Christian Kellermann <ckeen@necronomicon.my.domain> - 2013-07-20 21:34 +0200
Re: Request for comments on a first forth program Mark Wills <markrobertwills@yahoo.co.uk> - 2013-07-19 07:19 -0700
Re: Request for comments on a first forth program Christian Kellermann <ckeen@necronomicon.my.domain> - 2013-07-20 21:41 +0200
Re: Request for comments on a first forth program "Elizabeth D. Rather" <erather@forth.com> - 2013-07-19 07:55 -1000
Re: Request for comments on a first forth program Christian Kellermann <ckeen@necronomicon.my.domain> - 2013-07-20 21:47 +0200
Re: Request for comments on a first forth program "Elizabeth D. Rather" <erather@forth.com> - 2013-07-20 11:15 -1000
Re: Request for comments on a first forth program hughaguilar96@yahoo.com - 2013-07-20 20:09 -0700
Re: Request for comments on a first forth program "Paul E. Bennett" <Paul_E.Bennett@topmail.co.uk> - 2013-07-19 19:36 +0100
Re: Request for comments on a first forth program albert@spenarnc.xs4all.nl (Albert van der Horst) - 2013-07-20 12:36 +0000
Re: Request for comments on a first forth program Christian Kellermann <ckeen@necronomicon.my.domain> - 2013-07-20 21:53 +0200
Re: Request for comments on a first forth program Coos Haak <chforth@hccnet.nl> - 2013-07-21 02:02 +0200
Re: Request for comments on a first forth program "Elizabeth D. Rather" <erather@forth.com> - 2013-07-20 17:18 -1000
Re: Request for comments on a first forth program Ian Osgood <iano@quirkster.com> - 2013-07-23 16:07 -0700
Re: Request for comments on a first forth program Christian Kellermann <ckeen@necronomicon.my.domain> - 2013-07-20 21:48 +0200
Re: Request for comments on a first forth program stephenXXX@mpeforth.com (Stephen Pelc) - 2013-07-20 12:18 +0000
Re: Request for comments on a first forth program Christian Kellermann <ckeen@necronomicon.my.domain> - 2013-07-20 21:57 +0200
Re: Request for comments on a first forth program "Elizabeth D. Rather" <erather@forth.com> - 2013-07-20 11:24 -1000
Re: Request for comments on a first forth program Christian Kellermann <ckeen@pestilenz.org> - 2013-07-22 15:53 +0200
Re: Request for comments on a first forth program m.a.m.hendrix@tue.nl - 2013-07-22 08:06 -0700
Re: Request for comments on a first forth program albert@spenarnc.xs4all.nl (Albert van der Horst) - 2013-07-22 19:35 +0000
Re: Request for comments on a first forth program m.a.m.hendrix@tue.nl - 2013-07-23 00:41 -0700
Re: Request for comments on a first forth program Christian Kellermann <ckeen@pestilenz.org> - 2013-07-23 12:00 +0200
Re: Request for comments on a first forth program albert@spenarnc.xs4all.nl (Albert van der Horst) - 2013-07-23 12:10 +0000
Re: Request for comments on a first forth program Christian Kellermann <ckeen@pestilenz.org> - 2013-07-23 14:19 +0200
Re: Request for comments on a first forth program stephenXXX@mpeforth.com (Stephen Pelc) - 2013-07-24 09:27 +0000
Re: Request for comments on a first forth program anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-07-23 13:44 +0000
Re: Request for comments on a first forth program hughaguilar96@yahoo.com - 2013-07-20 20:02 -0700
Re: Request for comments on a first forth program albert@spenarnc.xs4all.nl (Albert van der Horst) - 2013-07-21 03:36 +0000
Re: Request for comments on a first forth program hughaguilar96@yahoo.com - 2013-07-20 22:28 -0700
Re: Request for comments on a first forth program albert@spenarnc.xs4all.nl (Albert van der Horst) - 2013-07-21 10:31 +0000
Re: Request for comments on a first forth program rickman <gnuarm@gmail.com> - 2013-07-20 23:41 -0400
Re: Request for comments on a first forth program anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-07-22 15:36 +0000
Re: Request for comments on a first forth program Lars Brinkhoff <lars.spam@nocrew.org> - 2013-07-23 12:22 +0200
Re: Request for comments on a first forth program Christian Kellermann <ckeen@pestilenz.org> - 2013-07-23 13:44 +0200
Re: Request for comments on a first forth program albert@spenarnc.xs4all.nl (Albert van der Horst) - 2013-07-23 12:26 +0000
Re: Request for comments on a first forth program "Elizabeth D. Rather" <erather@forth.com> - 2013-07-23 07:10 -1000
Re: Request for comments on a first forth program stephenXXX@mpeforth.com (Stephen Pelc) - 2013-07-24 09:30 +0000
csiph-web