Note that there are some explanatory texts on larger screens.

plurals
  1. POHow should you model objects that change with the passage of time
    primarykey
    data
    text
    <p>I'm trying to develop a data/object model for passengers who take trips on planes.<br> In words: </p> <pre><code>we have customers who make reservations to take trips. </code></pre> <p>I'm having difficulty determining if I should have two objects/models: Customer and Trip or three: Customer, Reservation and Trip. </p> <p>I believe my confusion stems from the fact that as time passes a reservation morphs into a trip. This fact leads me to think it would be best to have just two models: Customer and Trip. Under this scenario the Trip would belong to customer, and would have the following sample attributes: customer_id, reservation_number, destination, travel_date, etc. </p> <p>The problem I have with this approach is that reservation change and are cancelled and I'm a bit reluctant to muddle the Trip model with a lot of changes in travel date, destinations or cancellations.</p> <p>Update: Here's a little more on Trip (Flight) Items of interest: number of passengers, depart time, landing time, duration of flight, number of cancellations, destination, miles traveled, cost of a ticket, on-time arrival flag, weather conditions. trip/flight can be cancelled by the airline, weather and reservations can be cancelled by customer right up to trip/flight time.</p> <p>Perhaps what I am missing is a forth model that transitions a reservation to a trip (ticket?).</p> <p>So my question(s).</p> <ol> <li><p>Is the problem that I describe a particular class of data model with a preferred design pattern, if so, what is the pattern and solution. </p></li> <li><p>How have others with more experienced than me solved this problem. </p></li> </ol> <p>I happen to be using ruby on rails / activerecord for development, but the question applies to any development framework. </p> <p>Thanks for your input. </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload