Sobes.tech
Junior

What types of web application architectures do you know?

sobes.tech AI

Answer from AI

  • Model-View-Controller (MVC)
  • Model-View-ViewModel (MVVM)
  • Client-Server
  • Service-Oriented Architecture (SOA)
  • Microservices
  • Event-Driven Architecture (EDA)
  • Monolithic
<?php
// Example of MVC structure
// Model - business logic and data handling
// View - data presentation to the user
// Controller - request processing and interaction between Model and View

// Example Controller
class UserController {
    private $userModel;
    private $userView;

    public function __construct(UserModel $model, UserView $view) {
        $this->userModel = $model;
        $this->userView = $view;
    }

    public function showUser($id) {
        $user = $this->userModel->getUserById($id);
        $this->userView->renderUser($user);
    }
}