Unit SOFTWARE ENGINEERING LAB
- Course
- Programming and management of computer systems
- Study-unit Code
- A003659
- Curriculum
- In all curricula
- Teacher
- Marco Matarazzi
- Teachers
-
- Marco Matarazzi
- Hours
- 36 ore - Marco Matarazzi
- CFU
- 3
- Course Regulation
- Coorte 2023
- Offered
- 2024/25
- Learning activities
- Altro
- Area
- Tirocini formativi e di orientamento
- Sector
- NN
- Type of study-unit
- Obbligatorio (Required)
- Type of learning activities
- Attività formativa monodisciplinare
- Language of instruction
Italian- Contents
The lectures will show the structure of a monolithic web application written using the Symfony framework, with particular focus on the design patterns implemented by the framework and that will be implemented. The students will learn the use of composer; the Model-View-Controller design pattern; the Symfony Router; creating views with Twig; managing models through Doctrine ORM; using Value Objects and Data Transfer Objects; the repository pattern; the Symfony Console and how to add commands; handling user input through Forms and Symfony Validator; interface internationalization; SOLID principles of software design; testing software; using xdebug; managing users and permissions, the application firewall.- Reference texts
Gamma, Helm, Johnson, Vlissides, Design Patterns - Elements of Reusable Object-Oriented Software, 1995 Prentice Hall;
Fabien Potencier, Symfony 6: the fast track, 2024 leanpub.com;
Teaching material provided by the teacher, including bibliographic references.- Educational objectives
The main objective of the course is to enable the student to understand, recognize, and use the main components of an application, using a Symfony-based web application as an example, in order to understand how it functions and to be able to create one or study an existing one, to find and resolve any errors and bugs.
The main knowledge acquired will be: structure and organization of code in an MVC application, SOLID principles (Single Responsibility Principle, Open / Closed Principle, Liskov Substitution Principle, Interface Segregation Principle, Dependency Inversion Principle), structure and utility of the MVC, Value Object, Data Transfer Object, Composite, Repository design patterns. Functioning and utility of a Dependency Injection Container, parameters, and environment variables. Types of tests and their use, code testing metrics
The main skills acquired will be those of modeling domain entities (models) and their constraints through design patterns and object-oriented programming constructs; of managing the lifecycle of entities through an Entity Manager. Ability to organize code into separate and composable units, to use and configure a Dependency Injection Container to obtain services when needed; to configure an application to react to different execution environments;
Ability to connect user requests to controllers and views and render them; to handle user input even when it does not conform to the expected structure and to provide feedback; Ability to verify the identity of users and to validate their requests with the permissions assigned to them; Ability to plan the structure of easily testable classes in isolation and to prepare the necessary unit tests; Ability to architect and implement testable classes in integration and to write the related integration tests; Ability to write functional tests. Ability to use a debugger for the analysis of code execution.- Prerequisites
Familiarity with the concepts and syntax of object-oriented programming is required, preferably the PHP 8+ language: classes, method and property visibility, inheritance, polymorphism, encapsulation, closures, exceptions, and control flow with try / catch / finally.
Knowledge of HTML, CSS, or JavaScript is not required.- Teaching methods
Hands-on laboratory lessons.- Other information
The teacher is available to deliver lectures, exercises, and exam sessions in English. The teacher is available to conduct the exam in English.- Learning verification modality
Individual laboratory project of a Symfony 6.4 web application similar to what was shown in class.- Extended program
Composer as a tool for dependency management and as an autoloader.
Directory structure of a Symfony-based project, configuration files, and execution environments.
Installation and configuration of PHPStan and PHP-cs-fixer for static analysis and source code linting.
Model-View-Controller Pattern: Controllers, routes, parameters, route matching.
Model-View-Controller Pattern: Views. Twig, template inheritance and inclusion. {{ }}, {% %}, {# #}, if, and for syntax. Translation and the trans filter. Traditional three-layer structure for templates.
Model-View-Controller Pattern: Models. Creation of models as Plain Old PHP Objects (POPOs), required and optional properties, constructor method and instantiation of "valid" entities. Installation and configuration of Doctrine, adding Doctrine attributes (Entity, Table, Id, GeneratedValue, Column) to models. Direct and inverse relationships (OneToOne, OneToMany, ManyToOne, ManyToMany, JoinColumn attributes). Management of migrations. Generation of test data with fixtures. Use of Value Objects to enforce data consistency. Use of the Repository pattern for abstracting database access. Default repositories and magic methods. Custom repositories and QueryBuilder for parametric query construction. Query pagination. Use of EntityManagerInterface for entity management, the N+1 query problem.
The Symfony console: definition of commands, arguments, and options, input and output management.
Receiving input from users: definition of forms and the Composite pattern. Constraints and validators, application of validation rules. The Data Transfer Object pattern.
SOLID principles, the dependency injection container, definition of services, parameters, and environment variables.
Software testing: the test pyramid. PHPUnit and unit tests. Test double objects and mocking. Integration and functional tests. Management of the database and external dependencies. Test coverage.
Authentication and authorization: the firewall, permissions and user management.