Student Name:

 

Assume that the following code snippet describes how an online retailer might fulfill a customer order.

void process_customer_order( ordered_item, credit_card, mailing_address ) 
{
  // Place a soft reservation on the customer's credit card for the item
  // they ordered
  reservation = credit_card.create_reservation( ordered_item.get_price() )

  // Determine which warehouse will fulfill this order, based on the
  // customer's location and the availability of that item.  Then ship 
  // the item
  warehouse = determine_warehouse( mailing_address, ordered_item )
  warehouse.ship_item( ordered_item, mailing_address )

  // After the item has shipped, release the reservation and actually 
  // charge the credit card
  if( reservation.release() )
      credit_card.charge_funds( ordered_item.get_price() )
  }
}

  1. Draw the data dependancy graph for the above code snippet.
















  2. Are there any operations may be combined? Which ones?













  3. Draw the reduced data dependancy graph which you described in question 2.