News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Mathias Verraes:
DRY is about Knowledge
August 04, 2014 @ 10:51:50

In this new post to his site Mathias Verraes approaches the concept of the DRY principle (Don't Repeat Yourself) as being more about knowledge. He includes two "real world" examples where the business rules can change around you.

"Don't Repeat Yourself" was never about code. It's about knowledge. It's about cohesion. If two pieces of code represent the exact same knowledge, they will always change together. Having to change them both is risky: you might forget one of them. On the other hand, if two identical pieces of code represent different knowledge, they will change independently. De-duplicating them introduces risk, because changing the knowledge for one object, might accidentally change it for the other object.

In his examples, he shows how hard-coded rules (like "a product container can only contain 3 products") could just be around certain needs, not the entire range of requests. He covers some of the principles of Domain-Driven Design and how they apply here, pointing out that changing rules in one part of the application can have an effect on other parts depending on it.

0 comments voice your opinion now!
dry dontrepeatyourself principle knowledge domaindriven design business goal

Link: http://verraes.net/2014/08/dry-is-about-knowledge/

blog comments powered by Disqus

Similar Posts

Stefan Koopmanschap's Blog: Why should I attend PHP TestFest?

Gonzalo Ayuso: Talk about SOLID and Symfony at the deSymfony 2014 conference.

Pádraic Brady: PHP Security, Authorative Knowledge and Combining Forces

SitePoint PHP Blog: Can Great Apps Be Written in PHP - An Interview Series

Padraic Brady's Blog: ZF Blog App - Part 4: Design with Blueprint CSS & Zend_Layout


Community Events





Don't see your event here?
Let us know!


composer symfony opinion artisanfiles library security series tool conference release interview podcast voicesoftheelephpant list language framework introduction laravel community version

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework