Help coderanch get a
new server
by contributing to the fundraiser
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
  • Mikalai Zaikin

multiple class iteractions

Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm re-writing a game and basically I have 3 big classes: the net, the players and the physic.
they have to exchange some message, and the response may vary depending if and how the message is valid and has been processed.

My actual implementation is a set of Action object for Player, Physic and Net; they have a RUN method that take as input Player or Physic or Net(we can say it's container) and modify it: for example I read from the net an Action, this Action has a run method that want in input the Net, modify something (if necessary), then create an Action that take as input in his run a Payer obj and it will be send to Player... again run, a new Action for physic and so on...

A friend of mine suggest a that the Action class only have to contain the parameter and a flag to the function to use, so the "run" code is directly in the Player, Physic and Net class.......

well the idea are more complicated, but hope you get the point.

What you think this is the best way? And why? do you suggest another way?
pleeese help and contribute, i'll love you very much
Forget Steve. Look at this tiny ad:
We need your help - Coderanch server fundraiser
    Bookmark Topic Watch Topic
  • New Topic