Web Application Architecture Flashcards
What external system do you know?
An external system is something that lives outside your application, like a database, some remote web service, the system’s clock, the file system, and so on.
What are the differences between infrastructure and core code?
Infrastructure code - it’s all external system and low-level system things.
Core code - It’s a domain logic ( just business requirements)
How to avoid direct interaction with database?
We can create a separated class/method which will encapsulate DB interaction and we can use this method instead (send us dependency). ( Something like Command in our project)
What main rules we need to use to build a clean web application?
1) Core code doesn’t directly depend on external systems
2) Core code doesn’t need a specific environment to run in ( can be run in console/api/admin)
What is Table Data Gateway?
Table Data Gateway is a design pattern in which an object acts as a gateway to a database table. It hides the SQL statements and other implementation details behind a single interface per database table. (It’s like class for one table with methods which can wrap your SQL statement get/insert/update)
What is Repository?
“Object savers” are usually called repositories. Repository is the name of a design pattern which provides a solution to a common problem: the need to save a domain object, and later reconstitute it.
What is Data Mapper pattern?
DataMapper “moves data between objects and a database while keeping them independent of each other and the mapper itself” ( send params -> save records to DB). DataMappers to serve their main function, mapping domain objects to the database and vice versa.
What is service locator pattern?
Class which contains all depency that we need to run the service.
class Sample Service service = ServiceLocator.getService("ServiceOne"); service.execute();
service = ServiceLocator.getService("ServiceTwo"); service.execute(); service = ServiceLocator.getService("ServiceOne"); service.execute(); service = ServiceLocator.getService("ServiceTwo"); service.execute(); end
What main layers ( folders ) we can use?
- Entity
- Repository
- Domain Event
- Event Subscriber
- Service
- Input object (form, parameter object)