develooper Front page | perl.moose | Postings from November 2011

Re: hash of objects inside an instance

Thread Previous | Thread Next
From:
Erik Colson
Date:
November 28, 2011 16:30
Subject:
Re: hash of objects inside an instance
Message ID:
8F34432F-F00D-4057-83F7-74EF71294697@ecocode.net

On 28 Nov 2011, at 17:46, Lars Balker Rasmussen wrote:

> No, what you want is an abstraction.
> 
> Basically you're trying to hack in something that's actually business-information connecting several objects.
> 
> In relational databases, you know it'd be wrong to do something like this in the employee table; the principle is much the same here.

yep

> Maybe add an extra class WorksFor[1] containing the cost and department, and have a list of WorksFor in employee. (Warning, very little thought went into this and all my brain-blood is occupied around full stomach, but it solves the basic problem :) )

that's what I was afraid for. This creates a lot of overhead by creating all the necessary objects.
I implemented it using a EmployeeDepartment class as would be the case when using RDBS. It works well, but I hope the app won't get too slow because of this...

I just hoped Moose would have some kind of magic allowing to have objects as hash keys...

best and thank you all for the help!

--
erik

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About