CS FundamentalsHardProduct-company design interview
In GRASP terms, an Order aggregates its LineItems and has the data needed to initialise them. Which class should create LineItem objects, and which principle says so?
- A. A separate LineItemFactory, by the Pure Fabrication principle only
- B. Order, by the Creator principle (the container that aggregates and initialises the objects creates them)
- C. The UI controller, by the Controller principle
- D. LineItem itself, by Information Expert
Correct answer: B. Order, by the Creator principle (the container that aggregates and initialises the objects creates them)
Creator assigns creation to a class that contains or aggregates the objects and has their initialising data. Pure Fabrication is used only when no domain class fits well.
Practise more Software Engineering, Git and Cloud Basics questionsSoftware Engineering, Git and Cloud Basics: notes and key points
More Software Engineering, Git and Cloud Basics questions
- Assertion (A): Classes that call a Singleton through its global getInstance() are harder to unit-test. Reason (R): The dependency is…
- In the 2020 Scrum Guide each artifact has a commitment. Which pairing is correct?
- Midway through a sprint, a market change makes the Sprint Goal obsolete. According to the Scrum Guide, who can cancel the sprint?
- At the end of a sprint, one backlog item is coded but its automated tests, required by the Definition of Done, are not written. What does…
- A sprint commitment had stories of 8, 5, 5, 3 and 3 points. At the sprint's end the 8, one 5 and both 3s meet the Definition of Done; the…
- Mid-sprint, the Product Owner asks the Developers to also add a small new item. The Sprint Goal is not at risk. What does Scrum allow?