Уровень 0 · материалов: 2
В кластер входят документы, описывающие недостатки анемичных моделей и нарушение инкапсуляции из-за геттеров, и не входят документы, обосновывающие преимущества выноса логики в сервисы.
Общие признаки: инкапсуляция данных, размещение бизнес-логики, критика использования геттеров и сеттеров, поддерживаемость кода
Группа выше: Доменное моделирование, DDD и CQRS
Смысл: The main idea is that relying on public getters and setters in Symfony entities creates 'anemic domain models,' which breaks encapsulation and leads to fragmented, procedural business logic that is difficult to maintain.
Using ubiquitous getters and setters in Symfony entities destroys encapsulation and encourages a procedural coding style that increases system complexity and bug frequency.
Смысл: The main idea is that getters should be limited to simple data objects; using them in business entities often leads to poor encapsulation and 'anemic' models, whereas following the 'Tell, Don't Ask' principle creates more maintainable code.
Getters are useful for data objects but harmful in business entities as they encourage poor encapsulation and lead to anemic domain models.