[rudder-dev] Best Practises for writing techniques

Michael Gliwinski Michael.Gliwinski at henderson-group.com
Fri Mar 15 00:06:33 CET 2013


Hmm, it appears my reply never got to the list.  In the meantime I got 
kidnapped for another project ;)  so I never noticed, sorry, re-sending now :)


On Thursday 28 Feb 2013 18:42:44 Jonathan Clarke wrote:
> On 28/02/13 18:31, Nicolas Charles wrote:
> > On 28/02/2013 12:31, Michael Gliwinski wrote:
> >> 1. prefixing variables with "rudder_" or "rudder_<technique_name>_";
> > 
> > That's a good point, maybe we've been overzealous on this convention.
> > I think we could use only rudder_ to prevent overly long variable names
> 
> Why use any prefix for variable names? Their scope is local to each
> bundle, so there is no risk of name collision. We can just called
> variables "thing", and since the bundles are all named
> "rudder_<technique_name>_*", the fully qualified variable name will
> contain rudder_, like "rudder_<technique_name>_*.thing".
> 
> Dropping the requirement to prefix variable names seems altogether more
> lightweight to me, making code easier to read, and not bringing any real
> risks.

+1 :)

> >> 3. config.st:
> >> 
> >> 3a. is the idea to aggregate various variables used within different
> >> bundles
> >> in a technique in one place?  (sounds neat)
> > 
> > Variables defined by Rudder must only go in this file, so yes, the
> > idea is to have all variables there
> 
> All *StringTemplate* variables from Rudder that is. However, any "pure"
> CFEngine variables should not be in this bundle, but in the main bundle
> that does stuff.
> 
> The intention behind this is to separate files so that some files
> contain *only* CFEngine code, with no Rudder specificities, in order
> that they could one day be reusable by simply calling the bundle via a
> CFEngine methods promises (think one Technique depending on another...).
> So this way, we put all Rudder specific stuff (String Template variables
> and reporting) in separate bundles.
> 
> This should also encourage code sharing with pure-CFEngine users.

That sounds great!

Would you oppose to calling it with some more descriptive name then?  Like 
rudder_main or technique_main, etc.?  Just thinking something more intuitive 
would be useful given that it is actually an entry point for Rudder, and not 
only configuration.

> Thanks for your comments Michael, it's great to see your interest and
> have some feedback on this! By the way, if you like, we can give you
> write access to the wiki page, so you can clarify some of these points
> if you'd like?

Sure, I think I've got a better grasp on things now, so I can make some edits 
and let you know so you can review.

Thanks!

**********************************************************************************************
The information in this email is confidential and may be legally privileged.  It is intended solely for the addressee and access to the email by anyone else is unauthorised.
If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is prohibited and may be unlawful.
When addressed to our clients, any opinions or advice contained in this e-mail are subject to the terms and conditions expressed  in the governing client engagement leter or contract.
If you have received this email in error please notify support at henderson-group.com

John Henderson (Holdings) Ltd
Registered office: 9 Hightown Avenue, Mallusk, County Antrim, Northern Ireland, BT36 4RT.
Registered in Northern Ireland
Registration Number NI010588
Vat No.: 814 6399 12
*********************************************************************************



More information about the rudder-dev mailing list