<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">2013/12/24 Chris Muller <span dir="ltr"><<a href="mailto:ma.chris.m@gmail.com" target="_blank">ma.chris.m@gmail.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">> The reason I keep dissing them as setters is because they only set<br>
> _some_ state.<br>
<br>
</div>My goodness Frank. After all this you still are saying that?! Please<br>
forgive me for correcting you one last time with emphasis.<br>
<br>
*** CPM's set ALL STATE required for a well-formed, functional object ***.<br>
<br>
That's also why I committed Environments-cmm.38 as a multi-variable example.<br>
<br>
Setters set one variable. **Constructor Parameter Methods set ALL<br>
variables passed from a constructor**. A Constructor is, by<br>
definition, a method capable of "constructing" a well-formed instance.<br>
<div class="im"><br>
> Now, granted, some like Point >> #setX:setY: happen to<br>
> fully initialize an instance, but the name does not make this<br>
> responsibility clear.<br>
<br>
</div>The name makes clear *what it does*. If it's #initializeWith: -- you<br>
better look at the method to know what it does besides set state..<br>
Plus, a constructor can't ONLY set state, it implies some sort of full<br>
"initialization".<br>
<br>
But, I'm repeating myself from 3 days ago.. :)<br>
<div class="im"><br>
> But (the nonexistent) Point >><br>
> #initializeWithX:y: tells you loudly and clearly that the method<br>
> initialises the instance. That "#initializeWithX:y" is ugly to look at<br>
> and painful to type is just gravy: you shouldn't be calling that<br>
> method anyway.<br>
<br>
</div>Not any more than you should call setX:y:. Seriously, have you ever<br>
had the urge to call that? I always check the protocol of methods I'm<br>
unsure about, and if it's correctly categorized, then you're relying<br>
on an ugly selector name, initializeWith: to "fix" something that<br>
isn't broken.<br>
<br></blockquote><div><br></div><div>It's a bit late for changing that now, but it could as well be named initializeX:x y:y to carry the exact intention.<br>Not every body knows that you should set once, more people know that you should initialize once and only once.<br>
</div><div>So you could have just change With:, it would have been less controversial.<br><br></div><div>The other point being whether to invoke new or basicNew is more germane, but not invoking new is a way to tell my instances are not created like that. We could push it further and redefine new ^self error as you suggested, but it's quite heavy...<br>
</div><div> <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
But I'm sounding like a broken record so... later. :)<br>
<br>
</blockquote></div><br></div></div>