On Jul 6, 2007, at 2:42 PM, barsalou wrote:
> Luke,
>
> I thought about what you said about nouns, but having trouble
> coming up
> with an example of what you mean.
>
> Would you be willing to rework my example into the words your
> talking about?
>
> I''m not asking for a solution here...this is more about how to
think
> about the problem being solved.
Well, your example had "add" and "remove" in multiple
places, and
"rule" was usually being acted upon by these verbs. So, your pseudo-
code looked like:
define task ( firewall:
add rule add rule
delete rule
}
You''ve changed the verb here in your pseudo-code but used the same
noun each time, meaning that you''re more focused on the action,
rather than what it''s acting on.
The noun in this situation is the "rule", and you should have some
idea of what differentiates the different nouns you''re thinking
about. So, my own pseudo-code might look like:
define rule($allow = false, $deny = $false, $port, ensure = present) {
file { "/etc/iptables.d/$name": content => "...",
ensure => $ensure }
}
rule { http: port => 80, allow => ''*.madstop.com }
rule { rsh: deny => all, port => 222 }
Here you can see that I''m focused on the rules we''re talking
about,
not so much what''s happening with them. Yes, I''ve got
''ensure'' as a
way to say whether the rule should be present or absent, but you
don''t know if that''s going to do anything -- if the
rule''s already
there and configured correctly, nothing at all happens.
If you instead focus on verbs, then you''re going to need to think
about conditionals, too -- "if the thing is in state X, perform
action Y". Otherwise your configurations won''t be idempotent,
which
means that you''ll get different behaviour on different runs.
--
The most overlooked advantage to owning a computer is that if they
foul
up there''s no law against wacking them around a little. -- Joe
Martin
---------------------------------------------------------------------
Luke Kanies | http://reductivelabs.com | http://madstop.com