From: Daniel Yokomizo <daniel.yokom...@gmail.com>
Date: Tue, 24 Apr 2012 12:36:32 -0300
Local: Tues, Apr 24 2012 11:36 am
Subject: Re: [GOOS] Re: Encapsulating java collections
Another option is using static method names that are similar to the
class name, like these posts advocate: http://codemonkeyism.com/never-never-never-use-string-in-java-or-at-l...
I'm trying the combo with(Name)/name() instead of
2012/4/24 Chuck Krutsinger <chuck.krutsin...@gmail.com>:
> I agree. That does read much better!
> On Apr 24, 8:56 am, James Richardson <ja...@time4tea.net> wrote:
>> Rather than new Age(10) etc, see what you think about Age.of(10)
>> James
>> > I can see an advantage to the latter case when programming in Java,
>> > public class Person {
>> > because when you make calls to the Person constructor or one of its
>> > Person chuck = new Person(new Name("Chuck Krutsinger"), new Age(51),
>> > vs.
>> > Person chuck = new Person("Chuck Krutsinger", 51, 20000);
>> > Because in the latter case you have multiple integer args that are not
>> > On Apr 23, 11:29 pm, Michał Piotrkowski
>> > > public class Person {
>> > > Or
>> > > ublic class Person {
>> > > Which one is better???
>> > > I can't imagine any reasonable behavior that could be attached to Name.
>> > > When to use Integer age and when Age age?
>> > > > Wouldn't "Children" be more appropriate for a class in this case then
>> > > > --
>> > > > W dniu 22 kwietnia 2012 16:24 użytkownik Michał Piotrkowski
>> > > > > public class Person {
>> > > > > private List<Person> children = new ArrayList<Person>();
>> > > > > // ...
>> > > > > public Collection<Person> getChildren (){
>> > > > > public void addChild(Person child){
>> > > > > // ...
>> > > > > I like this because it its very simple. It is default solution for
>> > > > > When (after a while) I spot a lot of collection handling code in
>> > > > > 22-04-2012 14:38, "Kevin Rutherford" <ke...@rutherford-software.com>
>> > > > >> Hi Chuck,
>> > > > >> On Sat, Apr 21, 2012 at 11:06 PM, Chuck Krutsinger
>> > > > >> > "Encapsulate Collections - We've developed a habit of packaging up
>> > > > >> I use a couple of rules to help steer me in the right direction:
>> > > > >> 1. Never pass a collection as a method parameter or return value
>> > > > >> These aren't hard guidelines, but they do push me towards wrapping
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||