[Dbix-class] Row updates with parameters vs. without

Nathaniel Green nate.green at gmail.com
Wed Apr 7 21:47:49 GMT 2010


Thanks for the response, Caleb. You do make a good point about readability.

The best justification I could come up with was that using the
accessors encapsulates the object better, allowing you to later change
the underlying implementation without having to change update calls.
But that seems a rare case.

Any other thoughts?

Thanks,
Nate


On Wed, Apr 7, 2010 at 3:45 PM, Caleb Cushing <xenoterracide at gmail.com> wrote:
> On Tue, Apr 6, 2010 at 12:46 PM, Nathaniel Green <nate.green at gmail.com> wrote:
>> $row->update({ attr => 'stuff', foo => 'bar', ultimate_answer => 42 });
>>
>
> There may be another reason but the latter is more readable... however
>
> $row->update({
>    attr => 'stuff',
>    foo => 'bar',
>    ultimate_answer => 42,
> });
>
> that isn't less readable and it's as easy as the other to update.
> where your one liner makes it a little bit harder to see changes if
> you change it... and you need to diff the change.
>
> just my 2 cents. probably more justification for the other way elsewhere.
> --
> Caleb Cushing
>
> http://xenoterracide.blogspot.com
>
> _______________________________________________
> List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
> IRC: irc.perl.org#dbix-class
> SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
> Searchable Archive: http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk
>



More information about the DBIx-Class mailing list