Spaghetti code

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

Spaghetti code

Blake-5
I'm half thinking-out-loud here and soliciting thoughts on a programming  
lesson. If this sort of thing bugs you, feel free to ignore.
---
My son is coding this flow-chart as a Q&A type application:

http://media.www.gamespy.com/articles/633/633817/img_2913464.html

So, it says, "You found something!" then asks "Is it alive?" and then  
branches out accordingly. I'm letting him muddle through with the idea of  
using his code as a platform to teaching him a better approach (or  
approaches).

Looking at the chart, it looks like spaghetti code, and reminds me of some  
of the stuff I did in BASIC. And that's sort of what he's doing within  
Smalltalk. I'm actually tempted to show him how it would look in BASIC  
using GOTOs and line numbers. It would have the advantage of being easy to  
see all in one glance.

But I want to, of course, show him a better approach and explain why it's  
better. My first thought was to make a state machine, but I don't think  
that'd be much better, in fact.

Then I thought of what I would do, professionally, in a similar context:  
The problem with the spaghetti code and even a state machine is that it's  
static, and adding bits and pieces tends to require everything to be  
massaged around the new parts. In the real world, I know that the chart's  
not going to be static.

I'd probably end up create a linked list of one-exit nodes and two-exit  
nodes.

So, that's what I'll probably show him.

The other thing I'd do, though, is put this all in an editable text file,  
like:

1,foundsomething,"You found something",alive
2,alive,"Is it alive?",friend,smash
2,friend,"Is it a friend?",lately,scary
1,smash,"Smash it with a stick!",shiny

But I'm wondering if this last wouldn't be too much.

Thoughts?
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

RE: Spaghetti code

Ron Teitelbaum
Hi Blake,

Welcome to the list.  Before telling you what I would do I have two things
to say.  

First when I'm teaching people Smalltalk (and by the way I'm not a teacher,
the only people that I've taught is coworkers or people that worked for me)
I give a them a lot of latitude to make mistakes.  I give a lot of credit to
someone for making something that works.  Only after they succeeded in doing
something on their own do I go back and explain methods and techniques that
would improve their programming, usually on a different project.  So keeping
that in mind 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.

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.

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)

The real problem is that it is difficult to gather the requirements so since
this is just a conversation I thought I'd just make them up.

First I want my game to be able to add things.  It should be easy to do.
The things should be able to answer questions based on properties of the
things.  Next I want the thing to be able to follow multiple question flows.
It should be easy to add properties, questions and flows to the design.  I
would personally like to be able to ask random questions so that I can
follow random flows.

OK so this is Smalltalk so let's figure out what objects we have.

We have: Thing, Property, Question, Message, Tree.

The Thing has properties.

The Property has a question.

The Question has an answer of yes or no.

The System gives user Messages.

And we build the flow with a Tree.

The Tree routes by Questions.

If the Tree does not have a question then it routes automatically to the
next Tree.

If the Tree does not have another Tree then we are done.

Ok so first thing we need to do is build properties.  

Each property has a question so build a property by giving it a question.
We could also add a name.

Property
        instanceVariableNames: 'propertyName question'

In your example there are only properties that have yes answers but there
could be a property that applies on a no answer.  For example:

Property
--------
question -> Question
            --------
            Question -> Is it round?
            answer -> no
propertyName -> non round thingy

So now have your system add properties by asking you to name the property
and then type in a question and its answer.

For example:

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

Now that we have properties we can build thingys  

What we do is have you provide the things name and then ask you all the
questions from all the properties that you added.

If you answer the question with the same answer that is stored on the
property question then the property is added to the thingy.

Now you have thingys with properties.  We need to build a flow.

A tree has a question or a message.

Tree
        instanceVariableNames: 'questionOrMessage yesOrDefaultTree noTree'

So now you build your tree by having the system ask you for a question from
the list of questions added by properties or you can optionally type in a
message.

If you add a message like: Boring find another thing.  Then you can either
add a default tree to the message or nothing indicating that you are done.

So for every question added, the system should ask you for the next question
or message allowing you to specify the yes or no tree to add too.  And it
should verify each branch on the tree has a yes and no tree or ends in a
message.  

Notice there is no branching code any more. To follow a flow you start from
the root tree.

Tree >> processFlow
        "move along the tree branches until there are no more trees,
displaying the question or message and following the path based on answers"
       
        anAnswer := nil.
        self dispayQuestionOrMessage
        self treeHasQuestion ifTrue: [
                "do not allow anAnswer to be set to nil"
                anAnswer := self getAnswer.
        ].
        (anAnswer isNil or: [anAnswer isYes]) ifTrue: [
                self yesOrDefaultTree isNil
                ifTrue: ["we are done"
                        ^self]
                ifFalse: [^self yesOrDefaultTree processFlow]
        ].
        ^self noTree processFlow

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.  (Like KILL! Ugh).

So to summarize my suggestion: you use a tree construct to represent
branching instead of using hard coded flows.  (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.

Hope that helps and wasn't too complicated.

Ron Teitelbaum
President / Principal Software Engineer
US Medical Record Specialists
www.usmedrec.com


> From: Blake
> Sent: Saturday, February 17, 2007 7:11 PM
>
> I'm half thinking-out-loud here and soliciting thoughts on a programming
> lesson. If this sort of thing bugs you, feel free to ignore.
> ---
> My son is coding this flow-chart as a Q&A type application:
>
> http://media.www.gamespy.com/articles/633/633817/img_2913464.html
>
> So, it says, "You found something!" then asks "Is it alive?" and then
> branches out accordingly. I'm letting him muddle through with the idea of
> using his code as a platform to teaching him a better approach (or
> approaches).
>
> Looking at the chart, it looks like spaghetti code, and reminds me of some
> of the stuff I did in BASIC. And that's sort of what he's doing within
> Smalltalk. I'm actually tempted to show him how it would look in BASIC
> using GOTOs and line numbers. It would have the advantage of being easy to
> see all in one glance.
>
> But I want to, of course, show him a better approach and explain why it's
> better. My first thought was to make a state machine, but I don't think
> that'd be much better, in fact.
>
> Then I thought of what I would do, professionally, in a similar context:
> The problem with the spaghetti code and even a state machine is that it's
> static, and adding bits and pieces tends to require everything to be
> massaged around the new parts. In the real world, I know that the chart's
> not going to be static.
>
> I'd probably end up create a linked list of one-exit nodes and two-exit
> nodes.
>
> So, that's what I'll probably show him.
>
> The other thing I'd do, though, is put this all in an editable text file,
> like:
>
> 1,foundsomething,"You found something",alive
> 2,alive,"Is it alive?",friend,smash
> 2,friend,"Is it a friend?",lately,scary
> 1,smash,"Smash it with a stick!",shiny
>
> But I'm wondering if this last wouldn't be too much.
>
> Thoughts?
> _______________________________________________
> Beginners mailing list
> [hidden email]
> http://lists.squeakfoundation.org/mailman/listinfo/beginners


_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Spaghetti code

Blake-5
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.

> ...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.

> 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.

> 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>

> (Like KILL! Ugh).

lol

All things that live, kill. Or, minimally, all organisms compete for  
resources that other organisms could use to survive.

> 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!

        ===Blake===

_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Spaghetti code

Herbert König
In reply to this post by Blake-5
Hello Blake,

B> Looking at the chart, it looks like spaghetti code, and reminds me of some
B> of the stuff I did in BASIC. And that's sort of what he's doing within
B> Smalltalk. I'm actually tempted to show him how it would look in BASIC
B> using GOTOs and line numbers. It would have the advantage of being easy to
B> see all in one glance.
for things I would have considered a state machine in previous
languages in Squeak I usually take a Dictionary.

I've only used them two levels deep up to now and for a real deep tree
it's not appropriate.

But they are easy to follow by opening explorers on them and
programming consists of going to the right dictionary typing:

self at: "I now want to handle this case" put: [ the Block of code to
handle this].

Lately I put these Dictionaries into class vars and on the class side
I have some file in/ out code using reference streams. (Tried this
only with Dictionaries containing no code, but I guess it should work
with blocks too.)

Cheers,

Herbert                            mailto:[hidden email]

_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

RE: Spaghetti code

Ron Teitelbaum
In reply to this post by Blake-5
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===


_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Spaghetti code

tblanchard
In reply to this post by Blake-5
You're building an expert system.  There are well known patterns/
algorithms/architectures for that.

I developed ObjectiveCLIPS http://objectiveclips.com  which is an  
open source framework for building this kind of thing in ObjectiveC  
on the Macintosh.  A great book on the topic is http://www.amazon.com/ 
exec/obidos/redirect?link_code=as2&path=ASIN/
0534384471&tag=blackbagopera-20&camp=1789&creative=9325

Basically you want a rules based production system based on the rete  
algorithm.  This is important because decision trees are fragile and  
difficult to maintain.

CLIPS is a good free system to play around with.  I've often wished  
we had a rete algorithm implementation in Squeak.  http://www.ghg.net/ 
clips/CLIPS.html

Todd Blanchard

On Feb 17, 2007, at 4:11 PM, Blake wrote:

> I'm half thinking-out-loud here and soliciting thoughts on a  
> programming lesson. If this sort of thing bugs you, feel free to  
> ignore.
> ---
> My son is coding this flow-chart as a Q&A type application:
>
> http://media.www.gamespy.com/articles/633/633817/img_2913464.html
>
> So, it says, "You found something!" then asks "Is it alive?" and  
> then branches out accordingly. I'm letting him muddle through with  
> the idea of using his code as a platform to teaching him a better  
> approach (or approaches).
>
> Looking at the chart, it looks like spaghetti code, and reminds me  
> of some of the stuff I did in BASIC. And that's sort of what he's  
> doing within Smalltalk. I'm actually tempted to show him how it  
> would look in BASIC using GOTOs and line numbers. It would have the  
> advantage of being easy to see all in one glance.
>
> But I want to, of course, show him a better approach and explain  
> why it's better. My first thought was to make a state machine, but  
> I don't think that'd be much better, in fact.
>
> Then I thought of what I would do, professionally, in a similar  
> context: The problem with the spaghetti code and even a state  
> machine is that it's static, and adding bits and pieces tends to  
> require everything to be massaged around the new parts. In the real  
> world, I know that the chart's not going to be static.
>
> I'd probably end up create a linked list of one-exit nodes and two-
> exit nodes.
>
> So, that's what I'll probably show him.
>
> The other thing I'd do, though, is put this all in an editable text  
> file, like:
>
> 1,foundsomething,"You found something",alive
> 2,alive,"Is it alive?",friend,smash
> 2,friend,"Is it a friend?",lately,scary
> 1,smash,"Smash it with a stick!",shiny
>
> But I'm wondering if this last wouldn't be too much.
>
> Thoughts?
> _______________________________________________
> Beginners mailing list
> [hidden email]
> http://lists.squeakfoundation.org/mailman/listinfo/beginners

_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Spaghetti code

Blake-5
In reply to this post by Ron Teitelbaum
On Sun, 18 Feb 2007 06:21:14 -0800, Ron Teitelbaum <[hidden email]>  
wrote:

> That's good.  I think I posted this comment as much for you as for me.  I

Yeah, I'm definitely in "thinking out loud" mode. It's good to see how  
others think, too.

> 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).

Ah. My kids are homeschooled so I have no outs there. It's still not so  
much teaching as sort of get-out-of-the-way while they learn.

> I played DnD when I was in grade school.  We had an after school club  
> and it was really fun.

I'd guess you're slightly younger than I, then. When I was a teen, the  
issues raised with D&D were virtually identical to the issues being raised  
today about video games (and about comic books in the '50s, pulp fiction  
in the '30s, etc.), with the added twist of a few self-proclaimed experts  
insisting that D&D contained REAL SPELLS.

> 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.

Well, of course, games are not violent so much as pretend-violent. And  
gamers tend to quickly break down a game into its numbers. Which is why  
games like Katamari Darcy and Viva Pinata can be phenomenally successful  
even among hardcore gamers, despite being opposed to the usual  
dark/gory/faux-serious that demographic gravitates toward.

In his "A Theory of Fun For Game Deisgn", Ralph Koster re-imagines Tetris  
as a game where you're a Nazi dropping Jews into a pit. It's an  
illuminating discussion.

> 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've never seen anything that struck me as even remotely reliable.  
However, I do think TV and games are completely opposite. Television and  
movies are passively absorbed. Even in the best filmed entertainments,  
which engage you emotionally and intellectually, you have no control, and  
are therefore encouraged to accept what you see.

Games are meant to be beaten. Figured out. Controlled. Gamers expect to be  
Cause rather than Effect. One of the best references I can make here is to  
Adam Cadre's text adventure game "Photopia". It's the story of a girl who  
dies in a car accident, told backwards. You can't change this; the  
interactivity comes entirely from how you experience the character when  
she's alive. It's a very moving work, perhaps the most moving game I've  
ever played, and it pissed not a few people off because they had the  
gamer's expectation that they could keep the character from getting killed.

http://adamcadre.ac/if.html

Anyway, this mindset (IMO) makes the player less susceptible to influence  
than the viewer. It's precisely why it's so difficult to create a game  
that rises to the level of art. ("Starflight" had a twist that completely  
altered the player's view of the game mechanic, not unlike the  
aforementioned Tetris/Nazi thing. But it's rare.)

> I remember reading about increased hand-eye development but I question  
> the
> benefit of that considering the down side.

Well, you can get those hand-eye development benefits playing any twitch  
game, regardless of context, I'd imagine.

> 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.

As I say, it's done nothing to desensitize my son. Well, yeah, maybe it's  
desensitized him to movie and game violence. :-) Real violence appalls him  
and I think he thinks violence even on the level of, say, boxing is pretty  
stupid.

OTOH, violence with survival value (say hunting or fishing) seem okay to  
him (though we haven't done anything like that yet).

> I'm happy that your son is well adjusted and doing well.

Heh. My children aren't well-adjusted. They adjust the world.

> 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.

Might be. There are six of us and we have one TV in the main room. The  
computers are also in the main room. And, again, it's about knowing your  
kid. My son, when he was two, we watched the movie "Phantoms". Eye-sucking  
aliens didn't bug him at all. But there's a scene where Ben Affleck, the  
town sheriff, describes how he left the FBI after accidentally shooting a  
child. =That= freaked him out. So I learned: No Ben Affleck. No,  
seriously, I discovered that in the context of the fantastic, anything  
goes, but if it were realistic, you had to be very careful.

No substitute for knowing your child.

>> 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.

See my response to Todd as far as this goes.

> 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 agree with the former. As far as the latter, I would argue that our  
"vast consumption" is what makes things like the OLPC possible.

> 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.

Our concern for other species--and even groups of men apart from us--is  
made possible by our vast wealth; we tend to deplore our materialism, but  
we neglect the positive things abundance brings. To a starving man, a  
spotted owl is dinner. To a man without shelter, a redwood is a roof.

The OLPC rocks. I hope they mass market to first world nations. It has the  
potential to change everything. Commoditize computing power completely.

I hope my children are able to benefit from and contribute to it.

        ===Blake===
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Spaghetti code

Blake-5
In reply to this post by tblanchard
On Sun, 18 Feb 2007 11:51:55 -0800, Todd Blanchard <[hidden email]>  
wrote:

> You're building an expert system.  There are well known patterns/
> algorithms/architectures for that.

Thanks for the tips. I've saved them for later digestion. I've fallen  
behind on expert system technology apparently.<s>

However, the point isn't really to build an expert system. I've been  
teaching my son with Squeak for a while, and it was only the combination  
of PopUpMenu and the aforementioned chart that ignited his interest. He  
saw something he could imitate and extend/expand. So the fact that it's a  
sort-of expert system is incidental.

Where we're actually going, at least from all the signs, is an adventure  
game. And he's expressed an interest in doing a roguelike. (I'd kill for a  
smalltalk text interface right about now....)

Intriguingly, he doesn't really relate to eToys, and while we've used  
Stephane's Bots book to great effect, he's actually much more comfortable  
coding in the full Squeak. Strange.

        ===Blake===
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Spaghetti code

Blake-5
In reply to this post by Herbert König
On Sun, 18 Feb 2007 02:48:46 -0800, Herbert König <[hidden email]>  
wrote:

> But they are easy to follow by opening explorers on them and
> programming consists of going to the right dictionary typing:
>
> self at: "I now want to handle this case" put: [ the Block of code to
> handle this].

That's interesting. I wouldn't have thought of that.

> Lately I put these Dictionaries into class vars and on the class side
> I have some file in/ out code using reference streams. (Tried this
> only with Dictionaries containing no code, but I guess it should work
> with blocks too.)

Thanks for the suggestion. I'll think on it.

        ===Blake===
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners