On Apr 10, 2:56 pm, Jeremy Evans <[email protected]> wrote:

>
> You can think of the class level flags as setting defaults for all
> instances, which I don't consider an antipattern.  The instance level
> flags aren't very often used, and while they are sort of an
> antipattern, they allow per level object customization that many
> libraries don't.  For example, I don't believe AR allows you to change
> how save works, and I consider returning false for invalid saves a
> poor default (Sequel raises an exception by default, though lets you
> have the AR behavior as an option).

My own feelings about this is that instead of Class methods that alter
Class behaviour one should instead subclass the desired options.
Then, when people read the code they know exactly what they are
dealing with, instead of having to run it to find out what options are
set on a class when a problem happens.

>
> A different approach is to add additional options to the save method,
> which currently accepts :changed, :transaction,
> and :validate.  :transaction overrides the use_transactions flag if
> present, but there isn't a option to override the
> raise_on_save_failure flag (one could be added, but nobody has
> requested it).

I strongly agree.  If one needs override default behaviour at the
instance level then those parameters should be passed in the method
calls that require the overrides and not squirreled away in some
obscure corner of the code base.

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sequel-talk?hl=en.

Reply via email to