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