Ultrashock Forums > Blogs > House of Code
articles
Member Blogs
 
articles

Encapsulate what varies Part 3/3 - helicopter view

Old Posted 2007-12-16 at 07:02 by Codemonkey
Updated 2007-12-17 at 12:12 by Codemonkey
In the previous parts we saw what encapsulation and encapsulate what varies means. This last part takes a helicopter view of encapsulation and how it is central to a lot of problems in our daily code.

I was going to write about how various design patterns are designed to solve common problems when I ran into an excellent article by Tom Lauren, over at his weblog www.tomlauren.com. In the article posted below, he writes about design patterns in general, but quickly advances to an overview...
Codemonkey's Avatar
Super Moderator
Posted in articles
Comments 0 Codemonkey is offline

Encapsulate what varies Part 2/3 - complete workout

Old Posted 2007-12-10 at 10:25 by Codemonkey
Updated 2007-12-17 at 12:09 by Codemonkey
In part 1 - Basic encapsulation we discussed what encapsulation means and why it is an important concept that promotes readable, flexible and maintainable code. In this part we'll see where we can apply that concept; the 'varies' part of 'encapsulate what varies'.

Technically, Encapsulating what varies really means:
Replacing conditional logic and clauses by an interface and then vary the implementation with concrete classes

If that's not entirely clear, don't...
Codemonkey's Avatar
Super Moderator
Posted in articles
Comments 1 Codemonkey is offline

Encapsulate what varies Part 1/3 - basic encapsulation

Old Posted 2007-12-06 at 12:19 by Codemonkey
Updated 2007-12-16 at 06:59 by Codemonkey
An extremely important and useful concept is that of encapsulation; it has direct impact on cohesion, decoupling, integrity, reusability and results in better readable and maintainable code. Exactly what is it, why do you need it and how can you achieve this? Read this three-part article series.

Encapsulation basically means nothing more than restricting access to a class's methods and properties. The power however lies in the intention:

With encapsulation, your are
...
Codemonkey's Avatar
Super Moderator
Posted in articles
Comments 0 Codemonkey is offline