Article View: comp.lang.java
Article #379Re: Refactoring book + one to many implementation
From: abulka
Date: Sat, 13 Nov 1999 00:00
Date: Sat, 13 Nov 1999 00:00
26 lines
1848 bytes
1848 bytes
Mark Fussell <mark.fussell@chimu.com> wrote:
> actually you should be able to do the above with:
>
> void removeOrder( Order order ) {
> order.setCustomer(null);
> }
>
> which would keep all the association-controlling logic in the
> 'setCustomer' method.
I don't think this would work because the Order class / controlling
side is not being told WHICH customer to no longer point to. The hash
set _orders that lives in Customer needs to be updated, somehow.
Which was exactly my point, the Customer side needs to be:
void removeOrder( Order order ) {
_orders.remove( order ) // this line is inelegant, but needed.
order.setCustomer(null); // this line is ok, calls controlling side
}
-Andy
Sent via Deja.com http://www.deja.com/
Before you buy.
Technical Details
Message-ID:
<80iicf$od1$1@nnrp1.deja.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<80hvjs$1pqi$1@otis.netspace.net.au> <382C8CEE.39347C17@chimu.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f5d71,da48a4987570047e X-Google-Attributes: gidf5d71,public X-Google-Thread: 10d6db,da48a4987570047e X-Google-Attributes: gid10d6db,public X-Google-Thread: 114809,da48a4987570047e X-Google-Attributes: gid114809,public X-Google-Thread: fbe9c,da48a4987570047e X-Google-Attributes: gidfbe9c,public From: abulka@my-deja.com Subject: Re: Refactoring book + one to many implementation Date: 1999/11/13 Message-ID: <80iicf$od1$1@nnrp1.deja.com> X-Deja-AN: 547976138 References: <80hvjs$1pqi$1@otis.netspace.net.au> <382C8CEE.39347C17@chimu.com> X-Http-Proxy: 1.0 proxy4.netspace.net.au:8080 (Squid/2.2.STABLE5), 1.0 x31.deja.com:80 (Squid/1.1.22) for client 210.15.250.42, 203.23.72.1 Organization: Deja.com - Before you buy. X-Article-Creation-Date: Sat Nov 13 02:28:35 1999 GMT X-MyDeja-Info: XMYDJUIDabulka Newsgroups: comp.lang.java,aus.computers.java,borland.public.jbuilder.java,comp.lang.smalltalk X-Http-User-Agent: Mozilla/4.0 (compatible; MSIE 5.0; Windows NT)