Re: Should I coerce a DBIC schema from HashRef?

[email protected] (Jesse Luehrs)
Newsgroups perl.moose
Message-ID <[email protected]>
On Tue, Sep 04, 2012 at 11:22:21AM -0700, John Napiorkowski wrote:
> Bill,
> 
> I've done this a lot in the past, as well as a few other approaches.
>  In the end I've come to the conclusion that although off the top it
> seems like a nice interface, it doesn't grow old well and can be
> confusing to people trying to read your code.  I now tend to think
> that a consuming class should only build its objects when and if it
> needs some way to influence how they are built.  Otherwise over the
> long term you end up with a confusing interface with a lot of stuff
> completely unrelated to the actual functioning of the class.  And it
> harder to test correctly.

Agreed.

> I'm not sure what a better approach could be, but lately I've been
> taking the idea of having dedicated builder classes.  I know that
> sounds heavy handed, but at least it has the upside that my concerns
> are more carefully separated.

The "better approach" that I typically use is Bread::Board(:

-doy
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.