أسئلة القسم
تدرب على أسئلة المقابلات في هذا القسم. اكتب إجابتك، قم بتقييمها، أو اضغط على "عرض الإجابة" بعد التفكير.
What is CQRS, and in which scenarios may it be beneficial? صعب
CQRS = Command Query Responsibility Segregation. Separate write (commands) from read (queries) models.
Benefits:
- Scalability (read and write can scale independently).
- Clearer design when business rules differ between reads/writes.
Scenarios:
- Complex domains with heavy read/write asymmetry.
- Event sourcing or high performance read models.
What is the difference between an event and a command (like in CQRS)? صعب
Aspect | Command | Event |
---|---|---|
Intent | Ask to do something (imperative). | Notification something happened (past tense). |
Responsibility | Has a handler; expects action. | May have multiple subscribers; no action guaranteed. |
Timing | Future action | Already occurred |
What is the Saga pattern? صعب
Orchestration for long-running or distributed transactions. Breaks a business process into a series of steps (local transactions) coordinated via messages. Handles compensating actions if a step fails.
What is Clean Architecture in .NET Core? صعب
An approach where business logic is independent of frameworks and UI.
Layers:
- Domain (entities, core logic)
- Application (use cases, interfaces)
- Infrastructure (EF Core, external services)
- Presentation (Web API, UI)
Dependency rule: outer layers depend inward.
Explain Monolithic vs Microservices architecture. صعب
Aspect | Monolith | Microservices |
---|---|---|
Deployment | Single unit | Independent services |
Scaling | Entire app scales | Scale each service individually |
Boundaries | Shared database/code | Each service has own DB, clear boundaries |
Complexity | Simple to start | Higher operational complexity |
When to choose:
- Monolith for simple apps, low team size.
- Microservices for large apps needing independent scaling/deployment.