---
title: "Resolving Feature Envy in the Domain"
url: https://daily.dev/posts/resolving-feature-envy-in-the-domain-u6xyfbmwy
source_url: https://verraes.net/2014/08/resolving-feature-envy-in-the-domain
type: article
source: "Mathias Verraes"
published: 2026-06-17T11:25:38.359Z
updated: 2026-06-17T11:26:59.478Z
tags: ["general-programming", "php", "domain-driven-design"]
reading_time: 3
upvotes: 0
comments: 0
language: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Resolving Feature Envy in the Domain

**[Mathias Verraes](https://daily.dev/sources/verraes)** · 3 min read · 0 upvotes · 0 comments

## Summary

A response to Benjamin Eberlei's post on the Feature Envy code smell, taking the refactoring one step further using Domain-Driven Design principles. By introducing a ReportingPeriod value object, the calculateReport() function is freed from period calculation responsibilities, adhering to the Single Responsibility Principle. The post demonstrates the Whole Value pattern, showing how grouping DateTime and a days integer into a single value object improves cohesion, reduces duplication, and allows the code to express the Ubiquitous Language of the domain — with explicit factory methods for months, quarters, and years.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://verraes.net/2014/08/resolving-feature-envy-in-the-domain>

## Similar posts on daily.dev

- [When your code speaks Rails instead of the domain](https://daily.dev/posts/when-your-code-speaks-rails-instead-of-the-domain-vndv0arqg) · Ruby Flow · 0 upvotes · 0 comments

---

Tags: [#general-programming](https://daily.dev/tags/general-programming), [#php](https://daily.dev/tags/php), [#domain-driven-design](https://daily.dev/tags/domain-driven-design)

[View this post on daily.dev](https://daily.dev/posts/resolving-feature-envy-in-the-domain-u6xyfbmwy)
