Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

Formatting tweaks on encapsulation discussion

A bunch of module and class names weren't code-escaped, and the code
sample to demonstrate the anchor pattern wasn't being picked up by

Oh, and a typo correction.
  • Loading branch information...
1 parent 48874fd commit 753d3e8708d450106e963b4f09aba8ed301be349 @fatbusinessman fatbusinessman committed
Showing with 8 additions and 6 deletions.
  1. +8 −6
@@ -13,21 +13,23 @@
- *Never* use `<-` or `<~`. (Lint will stop you, anyway.)
- Don't break encapsulation. In particular, a resource within one module
not create a dependency (require or notify) to a resource deep within
- another. For example, File[/etc/nginx/sites-available/foo] from module
- foo should *not* directly notify Service[nginx] in module nginx.
+ another. For example, `File[/etc/nginx/sites-available/foo]` from module
+ `foo` should *not* directly notify `Service[nginx]` in module `nginx`.
Instead consider these options:
- use the anchor pattern to ensure dependencies are passed up and down
- the include hierarchy correctly, and specifiy the dependency at the
+ the include hierarchy correctly, and specify the dependency at the
top level. In our example, this means we would have:
- class {'foo': notify => Class['nginx']}
- class {'nginx':}
+ ```
+ class {'foo': notify => Class['nginx']}
+ class {'nginx':}
+ ```
- create a defined type within one module which other modules can use
which will set up the correct dependencies. See `nginx::config::site`
for an example -- this is a defined type which allows other modules
to create an nginx configuration and will make sure it happens after
- nginx::package and before nginx::service, without the other module
+ `nginx::package` and before `nginx::service`, without the other module
even knowing the existence of these classes.
- When a class includes or instantiates another class, consider
whether you need to use the anchor pattern (see below). In

0 comments on commit 753d3e8

Please sign in to comment.
Something went wrong with that request. Please try again.