Right and I think this is where the rub lies. I've been "brought-up"
that, unless the data is read-only, you just generally implement
read/write properties so I can easily implement it as:
List<Entry> Entries {
get;
}
But even with that, nothing prevents the user accessing the feed from
calling theFeed.Entries.Add(someEntry); Now, the implementation could
return a read-only List and then any modifying operations would
generate exceptions. But...why would I do that?
Does that make any sense? I'm hoping that this doesn't seem like an
immature conversation, but it's one that I struggle with when I study
Java. Why wouldn't I just use those conveience methods to modify the
list if and when I need to do so?
Thanks again for the discussion! I'm learning lots!
H
On 9/28/06, Garrett Rooney <[EMAIL PROTECTED]> wrote:
On 9/28/06, Harris Boyce III <[EMAIL PROTECTED]> wrote:
> Garrett -
>
> Yeah, shoulda done that to begin with, sorry...OK, from package
> org.apache.abdera.model, interface Feed defines these methods:
>
> List<Entry> getEntries();
> void addEntry(Entry entry);
> ...
> Entry getEntry(String id);
>
> In .NET, I could define these as properties like this:
>
> List<Entry> Entries {
> get;
> set;
> }
>
> And then, normally, I would use the methods exposed by List<Entry> to
> perform operations on the Entries (add, remove, etc.). Now, granted,
> I would have to implement a method to retrieve the entry by ID just as
> done above. But I guess my question may be centered around the
> encapsulation standards across the languages? Maybe?
>
> Does that clarify any? If not, let me know.
Well, you'd definately want the getter for the entries, but setting an
entire list of entries is kind of weird IMO... Perhaps other people
have optinions.
-garrett