View All num of num See all Photos MapQuest This employer has taken extra steps to respond to reviews and provide job seekers with accurate company information, photos, and reviews. Interested for your company?Learn More. www.mapquest.com www.mapquest.com Work in HR? Unlock Free Profile Overview Reviews Salaries Interviews Jobs Photos Benefits 33 Reviews 27 Salaries 7 Interviews Follow Add Review or Salary Follow Add Review or Salary MapQuest 33 Interview Question Senior Software Engineer Interview Denver, CO MapQuest Explain the reasoning behind the OO practice of favoring composition over inheritance. When would you use one or the other? Tags: design, software, object oriented See more , See less 8 Answer Add Tags Flag as Inappropriate Thank you! Your feedback has been sent to the team and we'll look into it. Oops! We're sorry but your feedback didn't make it to the team. Your input is valuable to us — would you mind trying again? Send Answer Interview Answer 1 Answer ▲ 0 ▼ Composition means that an object's behaviors are specified by other objects it contains. For instance, a Dragon class might contain a Movement object that specifies flight. Inheritance, as is usually used in OO, means that behavior is specified by an object's position in a class heirarchy. A Dragon would inherit from a FlyingObject class, for instance, and flight behavior would be coded there.Inheritance makes refactoring behavior tricky, because changing a behavior (e.g. a dragon that can fly in SPACE) implies changing that behavior for all objects that inherit from a superclass. With a design based on composition, the space dragon is as simple as creating a new Movement object that details how to move through space. Interview Candidate on Sep 14, 2012 Flag as Inappropriate Thank you! Your feedback has been sent to the team and we'll look into it. Oops! We're sorry but your feedback didn't make it to the team. Your input is valuable to us — would you mind trying again? Send Add Answers or Comments To comment on this, Sign In or Sign Up.