Grokking Design Patterns for Engineers and Managers
Vote

0% completed

Visitor Pattern

The Visitor Pattern adds a new operation to a set of classes without editing any of them.

An infrastructure plan holds a few kinds of resource: servers, databases, load balancers. The set of kinds changes rarely. What people ask you to compute over them changes constantly: the monthly cost, then a security audit, then a tagging report, then a diagram export.

There are two obvious places to put each of those, and both are wrong.

Putting the operation inside the resource classes means Server ends up holding pricing, security rules, tagging rules and drawing code

.....

.....

.....

Like the course? Get enrolled and start learning!

Reading Progress

0%


Vote for new content