--Apple-Mail=_CD44FB60-8AA2-40CC-B6F6-807EC8BF4CA9
Content-Type: multipart/alternative;
	boundary="Apple-Mail=_BFAFC6C9-8A3F-4BE6-8806-0B74D6FC4D66"


--Apple-Mail=_BFAFC6C9-8A3F-4BE6-8806-0B74D6FC4D66
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=windows-1252

On Aug 31, 2014, at 22:43, Arup Rakshit <aruprakshit / rocketmail.com> =
wrote:

> The problem is the author of the post said, that, whenever you will =
try to=20
> change the attribute of a value object, you should create a new value =
object.=20
> Otherwise you will break the rule of _value object_ . But we know in =
Ruby, the=20
> _setter_ method always return the value it sets.

I=92d refrain from putting setters on immutable value objects. With the =
Money object that has both a currency and amount, don=92t modify the =
amount, instead add a Numeric or Money instance to it to get a new Money =
object.

m =3D Money.new 100, =91USD=92

m + 50 #=3D> #<Money 150 USD>

m + Money.new(90, =91USD=92) #=3D> #<Money 190 USD>

m + Money.new(100, =91CND=92) # raises Money::NonMatchingCurrencyError

--Apple-Mail=_BFAFC6C9-8A3F-4BE6-8806-0B74D6FC4D66
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html;
	charset=windows-1252

<html><head><meta http-equiv=3D"Content-Type" content=3D"text/html =
charset=3Dwindows-1252"></head><body style=3D"word-wrap: break-word; =
-webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">On Aug =
31, 2014, at 22:43, Arup Rakshit &lt;<a =
href=3D"mailto:aruprakshit / rocketmail.com">aruprakshit / rocketmail.com</a>&=
gt; wrote:<br><div><br class=3D"Apple-interchange-newline"><blockquote =
type=3D"cite"><span style=3D"font-family: Helvetica; font-size: 14px; =
font-style: normal; font-variant: normal; font-weight: normal; =
letter-spacing: normal; line-height: normal; orphans: auto; text-align: =
start; text-indent: 0px; text-transform: none; white-space: normal; =
widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: =
none; display: inline !important;">The problem is the author of the post =
said, that, whenever you will try to<span =
class=3D"Apple-converted-space">&nbsp;</span></span><br =
style=3D"font-family: Helvetica; font-size: 14px; font-style: normal; =
font-variant: normal; font-weight: normal; letter-spacing: normal; =
line-height: normal; orphans: auto; text-align: start; text-indent: 0px; =
text-transform: none; white-space: normal; widows: auto; word-spacing: =
0px; -webkit-text-stroke-width: 0px;"><span style=3D"font-family: =
Helvetica; font-size: 14px; font-style: normal; font-variant: normal; =
font-weight: normal; letter-spacing: normal; line-height: normal; =
orphans: auto; text-align: start; text-indent: 0px; text-transform: =
none; white-space: normal; widows: auto; word-spacing: 0px; =
-webkit-text-stroke-width: 0px; float: none; display: inline =
!important;">change the attribute of a value object, you should create a =
new value object.<span =
class=3D"Apple-converted-space">&nbsp;</span></span><br =
style=3D"font-family: Helvetica; font-size: 14px; font-style: normal; =
font-variant: normal; font-weight: normal; letter-spacing: normal; =
line-height: normal; orphans: auto; text-align: start; text-indent: 0px; =
text-transform: none; white-space: normal; widows: auto; word-spacing: =
0px; -webkit-text-stroke-width: 0px;"><span style=3D"font-family: =
Helvetica; font-size: 14px; font-style: normal; font-variant: normal; =
font-weight: normal; letter-spacing: normal; line-height: normal; =
orphans: auto; text-align: start; text-indent: 0px; text-transform: =
none; white-space: normal; widows: auto; word-spacing: 0px; =
-webkit-text-stroke-width: 0px; float: none; display: inline =
!important;">Otherwise you will break the rule of _value object_ . But =
we know in Ruby, the<span =
class=3D"Apple-converted-space">&nbsp;</span></span><br =
style=3D"font-family: Helvetica; font-size: 14px; font-style: normal; =
font-variant: normal; font-weight: normal; letter-spacing: normal; =
line-height: normal; orphans: auto; text-align: start; text-indent: 0px; =
text-transform: none; white-space: normal; widows: auto; word-spacing: =
0px; -webkit-text-stroke-width: 0px;"><span style=3D"font-family: =
Helvetica; font-size: 14px; font-style: normal; font-variant: normal; =
font-weight: normal; letter-spacing: normal; line-height: normal; =
orphans: auto; text-align: start; text-indent: 0px; text-transform: =
none; white-space: normal; widows: auto; word-spacing: 0px; =
-webkit-text-stroke-width: 0px; float: none; display: inline =
!important;">_setter_ method always return the value it =
sets.</span></blockquote></div><br><div>I=92d refrain from putting =
setters on immutable value objects. With the Money object that has both =
a currency and amount, don=92t modify the amount, instead add a Numeric =
or Money instance to it to get a new Money =
object.</div><div><br></div><div>m =3D Money.new 100, =
=91USD=92</div><div><br></div><div>m + 50 #=3D&gt; #&lt;Money 150 =
USD&gt;</div><div><br></div><div>m + Money.new(90, =91USD=92) #=3D&gt; =
#&lt;Money 190 USD&gt;</div><div><br></div><div>m + Money.new(100, =
=91CND=92) # raises Money::NonMatchingCurrencyError</div></body></html>=

--Apple-Mail=_BFAFC6C9-8A3F-4BE6-8806-0B74D6FC4D66--

--Apple-Mail=_CD44FB60-8AA2-40CC-B6F6-807EC8BF4CA9
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename=signature.asc
Content-Type: application/pgp-signature;
	name=signature.asc
Content-Description: Message signed with OpenPGP using GPGMail

-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - http://gpgtools.org

iQIcBAEBAgAGBQJUA+8gAAoJEPq9+oWeY4VQk7EP/jXCaQinNgMzmdOxyZtOhplV
ToApC1DWWD3F4OEPaKOFD5ja1RNejRFWdIEhTgPEO700BzTuoM9c98Sz1TxgcPcx
QInK/GDHupTFrKYv4VAsQQ5zL1g2/Pb1Ewo+ZpiccMpwcfvTgBnEUidfIKUQmOpg
h567Tr6K9tdaqgrrQtPhDjMnY2efjx6x6/WbtIWuSsh11IY6Sf+lOeeWuUxke4A+
Zm6YB1XKK4emogqiLhWfjF4MMgjhYt/CetI3uxmVtFIlPjP6plnqVyVepU6ZNLVY
3EV+MypWpsdzE8D7zix7yhOYGJK82PsqVZxzGgl83c6CH1+EyMAmCfJoex/c2SHX
nQA44lSRK20u8GhDntyMINC+u7KFcGWacsC8bgSv+A0qp6wF0w+iQTEH6w21rpc4
7nBsv2V9ds9mItMmH4Qp79ZWo+MLIxDXSAmfhl/76gshao46mriV1/UUxPlOjRB8
eEBwzvIUzMzqIMthwe4JFDAW5yIa0C2yYetA3g72J5PbKTbeytazudKcYSBSToYm
I5xFeLTw8rYoui5eiE3kH4LQ/8lQUngAXAIb8JDUO91YlrzsZz9uFrL8csv3r8E2
1JSyoJxV0iuZvXT318z72vFELzzh/2qmcI0Yf9Gfvqt/CXZY0jflwnR/G8LezUNQ
IDOTBh+0jeJiXu3MqRo4
=lVRy
-----END PGP SIGNATURE-----

--Apple-Mail=_CD44FB60-8AA2-40CC-B6F6-807EC8BF4CA9--