mailRe: how to parallelise model_free minimise


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by Edward d'Auvergne on March 29, 2007 - 18:01:
On 3/30/07, Gary S. Thompson <garyt@xxxxxxxxxxxxxxx> wrote:
Edward d'Auvergne wrote:

> You have found some more ancient relax legacies.  There is a lot of
> perfectly functional legacy code in there!

I suspected so ;-)

> These counters should
> probably not be placed into 'self'.  They are re-initialised to zero
> at the start of each iteration of the main model-free minimise() loop.
> The only place these are now accessed from is the minimise()
> function.  The placement into 'self' is not always for storing state,
> it has been used so that other functions can access the data without
> having to pass arguments between the instance methods (which
> technically is state anyway :).


I would definitley call that an anti pattern It confuses the design of the program in nasty ways (I spent ages trying to work out what all the apparent state of model_free was when there was virtually none). Another way to look at this is why do we have functions: they are interfaces between one piece of code and another and are designed to make code flow clearer. Storing non-state in an objects fields or a s a way to pass state from one function to another is somewhat equivalent to how some people use common block in fortran in some situations and we all know how tractable that is ;-)

anyway rant off

I know. I used to be lazy back in the early days of relax, back when it used to be called 'mf' and even earlier to 'modelfree'. I'm cleaning up many of these things with the redesign. Don't hold your breath for the redesign to be completed soon though, that is a lot of work and I'm flat out with other things at the moment.

Edward



Related Messages


Powered by MHonArc, Updated Sun Apr 01 00:05:54 2007