Re: Thinking in OO



Greg,

I learned OOP thank to Smalltalk and this book:

http://bookshelved.org/cgi-bin/wiki.pl?SmalltalkObjectsAndDesign

The first lesson from this book is to think about objects as
"homunculus" which means "small human" in Latin. A main task
while designing an OO program is inventing a language to talk to the
objects. This language, composed of the classes and methods names,
should be human readable and easy to understand.

To me, your turn.left, turn.right and so on are ok. They are clear and
easy to understand.

I like very much also your "attack" or "evade" thinks, but they
are maybe other objects. They might be seen as strategies that could be
applied to robots. Hence, you could have Strategy objects given to your
robot and guiding their behavior by sending them lists of commands
turn.rigt, turn.left etc... Strategy could be an abstract class with
several inherited classes such as AttackingStrategy, DefendingStrategy
and so forth.

Robot r2d2 = new Robot()
r2d2.adoptStrategy(new AttackingStrategy())

Again, always try to have the best word to name your classes and
methods. I am not sure that Strategy is the best name here. Do not
hesitate to give a better name if you find one (such as Behavior? or
Tactic?) Trying to give good names to classes and methods is never
over-analysing IMHO.

Hope that help,

Bernard.

.



Relevant Pages

  • Re: Language of a web site in ASP.NET
    ... How do you perform language selection? ... based on the user agent language preference a robot will always see ... URL rewriting allows to expose the same page as both /mysite/fr/ ... site indexers like the ones of Google don't try ...
    (microsoft.public.dotnet.framework.aspnet)
  • Possbile anyone willing to trade multi-lingual word/term dictionary databases?
    ... I am a Windows Automated Robot Script Programmer ... search engine request list of search terms in their ... native language font or characters. ...
    (sci.lang.translation)
  • Anyone willing to trade multi-lingual dictionary databases?
    ... Because some language has position each word completely different from ... I doubt how can nowadays Google foreign language do? ... I am a Windows Automated Robot Script Programmer ... search engine request list of search terms in their ...
    (alt.internet.search-engines)
  • Re: How to Cool a Planet (far fetched ideas)
    ... How is natural language going to assist with software code reuse? ... Software code reuse is based upon open systems where source code sharing ... In space the corresponding question is can a robot do an astronauts ...
    (sci.space.policy)
  • Re: Language of a web site in ASP.NET
    ... How do you perform language selection? ... based on the user agent language preference a robot will always see ... site indexers like the ones of Google don't try ... I've heard of url rewriting, but everytime I try to rewrite a URL, I end up ...
    (microsoft.public.dotnet.framework.aspnet)