Design Patterns and Code Quality Flashcards
In a REST API how would you structure the project.
Start with SOLID.
Define solid.
Persistence base, and specific implementation.
Service Layer as an abstraction layer between other application logic and the client logic.
client layer which controls the HTTP type logic…
https://java-design-patterns.com/patterns/service-layer/
How would you approach error handling in an web application?
I would start with the different classes of errors 400, 500 etc…
Then you might want a class or library for specific types of errors. Server unavailable or service internals often means clients can retry and you just want them to bubble up.
Other client errors you would want to be more specific about.
You can catch specific classes of errors in your application and decide how you want to handle them…
Define and write a factory pattern?
Define and write singleton pattern?
What is depdendency injection and why use it?
How does dependency injection differ from a singleton?
What is the lifetime of objects in an application created by dependency injection?