What are GRASP principles?
Why Interviewers Ask This
Advanced questions like this reveal whether a candidate has internalized OOP Concepts deeply enough to make architectural decisions. Strong answers demonstrate both breadth and depth of experience.
Answer
GRASP (General Responsibility Assignment Software Patterns) are nine principles for assigning responsibilities to classes and objects, defined by Craig Larman: (1) Information Expert: assign responsibility to the class that has the information needed to fulfill it. Order should calculateTotal() because it knows its items; (2) Creator: assign class B to create instances of class A if: B contains A, B records A, B closely uses A, or B has initialization data for A; (3) Controller: assign responsibility for receiving and handling system events to a non-UI class — the "controller" in MVC/MVP; (4) Low Coupling: assign responsibilities to minimize dependencies between classes; (5) High Cohesion: assign responsibilities to keep classes focused and manageable; (6) Polymorphism: use polymorphism when behavior varies by type — avoid type-checking conditions; (7) Pure Fabrication: create a class with no direct real-world counterpart to achieve low coupling/high cohesion (e.g., DatabaseAccessObject, Service, Repository); (8) Indirection: add an intermediate object to mediate between components to reduce coupling (e.g., Controller, Adapter, Facade); (9) Protected Variations: identify points of likely variation, create stable interfaces around them. Most important: Low Coupling + High Cohesion + Information Expert. These guide day-to-day decisions about where to put code — they're more practical than GoF patterns for everyday design.
Pro Tip
Before answering, structure your response: one-line definition → real-world analogy → concrete example from a project. This makes even complex OOP Concepts answers easy to follow.
Previous
What is the Interface Segregation Principle?
Next
What is cohesion vs coupling trade-offs in practice?