Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / September 2007

Tip: Looking for answers? Try searching our database.

OOD questions

Thread view: 
Todd - 05 Sep 2007 17:40 GMT
Hello all,

I hope that this topic is considered valid in this group.  If not,
could you (kindly) point me to where I should post it?

I am having a bit of trouble deciding where to place objects within my
design.  I have been following the "has a" "is a" guidelines so far.
I now have an "is acted upon by" and an "is constrained by" which I
don't know how to resolve.

I am designing some orbital analysis software (I am sure I am
reinventing a wheel, however ... ).  I have one vehicle which can
travel many trajectories, i.e., standard orbit (trajectory) -> thrust
trajectory -> elliptical parking orbit -> thrust trajectory -> sling-
shot orbit, etc.  With this thought, I created a parent trajectory
class from which I create (via extension) the various trajectories I
need.

Here is my problem statement:
Within each trajectory the vehicle is acted upon by several
perturbations (gravity, solar wind, etc.) and is constrained to
perform actions when in view of a ground station.

While the vehicle is the object experiencing the perturbations and
constraints, the perturbations and constraints can be different for
each trajectory, so I thought that I should add the perturbations and
constraints to the Trajectory class, but this feels wrong since:

a vehicle has a trajectory
the vehicle is acted upon by perturbations
the vehicle is constrainted by various things

which makes me think that these all belong in the vehicle class.

So, do I fish or cut bait?
Todd
Eric Sosman - 05 Sep 2007 19:06 GMT
Todd wrote On 09/05/07 12:40,:
> Hello all,
>
[quoted text clipped - 29 lines]
>
> which makes me think that these all belong in the vehicle class.

   It's not clear to me just how you intend to model
all these interactions and constraints, but one way to
approach them might be for each Vehicle object to have
a collection of Perturbers and Constrainers.  Or dually,
each Perturber or Constrainer could have a collection of
the Vehicles it influences.  Or you could use a separate
Interaction object to represent the influence of a
particular Perturber/Constrainer on a particular Vehicle.

   This is not meant to be an exhaustive list ...

Signature

Eric.Sosman@sun.com

Daniel Pitts - 05 Sep 2007 21:16 GMT
> Hello all,
>
[quoted text clipped - 32 lines]
> So, do I fish or cut bait?
> Todd

Or, perhaps you're missing something here... The Simulator class.  The
simulator keeps track of what is where.

Think of it this way? What does a glass of water on a table, and a
heat lamp above it have in common?  They all exist in universe.

The heat lamp doesn't have water or a table, yet it affects them. The
water doesn't have a table or a heat lamp, and yet is affected by
them.

You might say the table "has a" glass which "has a" water in it.

class Universe {
    HeatLamp lamp;
    Table table;

    public void unpdate() {
       lamp.heat(table);
    }
}

class HeatLamp implements Positionable {
  public void heat(Heatable heatable) {

heatable.absorbeHeat(getHeatValue().dissipate(getDistanceTo(heatable)));
  }
}

public Table implements Heatable {
  Glass glass;
  public void absorbeHeat(HeatValue heatValue) {
     surfaceTemp.adjust(heatValue);
     glass.absorbeHeat(heatValue);
  }
}

Hope this example helps.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.