[Newbies] Spaghetti code

Ron Teitelbaum Ron at USMedRec.com
Sun Feb 18 14:21:14 UTC 2007


Comments in message.

> From: Blake
> Sent: Sunday, February 18, 2007 4:12 AM
> 
> Hey, Ron,
> 
> 	Thanks for the feedback. It is a fun question.
> 
> > Welcome to the list.
> 
> Heh. I've been on this list since it started and on the general list for
> years, but I guess I don't make much of an impression.

I'm really sorry, I'm sure it's not you.  I'm glad you choose to post your
question, and I'm happy to see the newbies list be so successful!  

> 
> > ...it may be better to let your son solve the problem on his own and
> > then go back and build something else using some new techniques that you
> > can show him.
> 
> Sorry if I hadn't made that clear: That's precisely what I am doing.

That's good.  I think I posted this comment as much for you as for me.  I
learned the hard way by trying to teach math to my daughter.  It didn't go
well!  So now I review homework, sometimes point out errors, teach some
concepts later.  It's not an easy transition to make, but it does work
better (some).

> 
> > Second there are a lot of possible designs for this problem.  The
> > implementation of the design should be kept separate from the design
> > itself. Whether or not you use a text file or how you store the data is
> > a detail.
> > The details come easy once you have a good design.  So focus on design
> > first.
> 
> Right. I meant to draw contrast to a traditional state machine where
> things are fixed, and went to a specific detail.
> 
> > That aside this is a fun question.  (Although I really don't like the
> > actual flow chart, killing and kids don't mix well in my mind.  I know
> > there are
> > lots of killing video games but not that I let my child play)
> 
> Not to get sidetracked on the issue, but I introduced my son to computers
> and gaming at the age of...oh...15 months by having him sit on my lap and
> fire the weapons in Doom 2. I can't really explain in brief the extent of
> the positive changes this wrought. He's had an abiding love of
> games--including "violent" games--ever since. (I put "violent" in quotes
> for a lot of reasons that are also not on topic.<s>) Completely
> coincidentally, he's by far the most compassionate persion I've ever met.
> I've never met anyone so completely devoid of cruelty and so quick to help
> others in distress.
> 
> (Of course, results not typical, your mileage may vary. I filter out
> plenty of other things I think are bad for him; it's just that his list is
> different from other kids'.)
> 
> By the way, in case it's not obvious, this is a flow chart for the
> pen-and-paper RPG "Dungeons and Dragons", and is meant as a jokey
> simplification of that game.

I played DnD when I was in grade school.  We had an after school club and it
was really fun.  What concerns me is the level of violence in video games
today.  I'm a bit out of touch with games.  I saw a group of programmers in
my last job set up a game server, I can't remember what it was, and they
spent a whole lot of time at it.  It was really violent.  So what I know is
mostly second hand.  I read about violence and exposure to TV and Video
games and the evidence seems to support a very negative impact on children,
including violent activity, anti-social behavior and attention disorders.  I
remember reading about increased hand-eye development but I question the
benefit of that considering the down side.

I'm not sure I really understand the whole concept very well.  I also have
read about children that are not well adjusted because of a lack of exposure
to the things they will experience later in life.  I suppose that if society
of today requires a certain amount of desensitization then if we can't
change society we should provide the right level of exposure.  

I'm happy that your son is well adjusted and doing well.  I'm sure that
comes partly from having a good Dad.  I wonder if the feeling of safety that
comes from new experiences in your presence, like exploring the world but
only in sight of Mom (one of the eight stages of development), accounts for
your success.  It makes me wonder if some of the negative impacts can not be
accounted for because of the lack of supervision in TV and video games.

> 
> > System:  Enter Property Name:
> > You: Scary
> > System:  Enter Question for Property Scary:
> > You: Is it Scary?
> > System:  Answer to question Is it Scary?:
> > You: yes
> 
> Ah. Yes. This is "Animals", in essence. That's an excellent segue to a
> larger project!
> 
> http://www.animalgame.com/play/faq.php
> 
> > Notice there is no branching code any more. To follow a flow you start
> > from the root tree.
> 
> Yes, that's what I was going for. Your design is deeper than mine, though.
> Thanks.
> 
> > Ok so why did we build thingys?  Well because things can now answer
> > questions for themselves and we can build costumes on thingies and get
> > them to run around on screen.  Now we don't have to ask the user
> > questions we can just send messages.
> 
> I'm not sure what that--doesn't the game go away at that point?<s>

Not really.  I guess my point here is that you can use your properties to
build real things.  Those things can be very useful in many different ways.
Say like a classification tree.  Once you answer questions the system could
give you the name of the thing you found.  You found Caulerpa taxifolia.  Or
if you have your thing running around on screen and trying to talk to you,
it seems silly to ask you if it's alive and talking.  I guess I was trying,
but not well, to show the benefit of properties to construct useful things.

> 
> > (Like KILL! Ugh).
> 
> lol
> 
> All things that live, kill. Or, minimally, all organisms compete for
> resources that other organisms could use to survive.

Agreed.  Since we are so off topic anyway, and I'm sure nobody else is
bothering to read this far, I am quite well read on the theories of
evolution.  It is an extremely interesting field of study.  It's also
interesting to consider the effects of competition in human development.
You don't have to go far to see the quick return to the mean, in things like
the French Revolution, or the Russian removal of the Czar.  I really believe
that we are in deep trouble when we isolate ourselves and consume such vast
resources.  I like the OLPC project because I believe that projects just
like that one will help to even out world resources and could help to bring
peace.  As humans maybe we can learn to share and manage the resources so
that other species won't be wiped out in the process.  After all it's true
there are limited resources, but considering we have a very nice sun, there
is still a lot to go around.

> 
> > So to summarize my suggestion: you use a tree construct to represent
> > branching instead of using hard coded flows.
> 
> Good. That's the ball-park I was in.
> 
> > (It is not really a linked list) You build objects that represent
> > properties that have questions and
> > answers.  You can then build things that have these properties.
> 
> Yeah, I hesitated to use the term "linked list" but it's (non-technically)
> a list of linked items. I suppose, technically, it's an n-tree.
> 
> Thanks again!

You are very welcome.  

Ron 

> 
> 	===Blake===




More information about the Beginners mailing list