abdera-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James M Snell <jasn...@gmail.com>
Subject Re: Coding/Language Standards
Date Thu, 28 Sep 2006 15:58:18 GMT
The wierdness stems from the way Axiom works under the covers and the
incremental parsing model.  Essentially, the List returned by the
methods is backed by an Iterator that may not be in an appropriate state
to modify the underlying infoset.

- James

Harris Boyce III wrote:
> OK, so why would I do that?  Why would I make the list returned from
> List<?> getEntries() immutable and provide mutator methods when the
> List<?> type supports them implicitly?
> 
> Again, sorry if this seems like a college-level discussion, but I do
> struggle with this bit of encapsulation.
> 
> Thanks again,
> 
> H
> 
> On 9/28/06, James M Snell <jasnell@gmail.com> wrote:
>> The List<?> methods exist mainly to support easy iteration and getting
>> of the entries.  They are unmodifiable lists, meaning that calling any
>> of the add/remove operations will result in an unsupported operation
>> exception.
>>
>> - James
>>
>> Harris Boyce III wrote:
>> > 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 <rooneg@electricjellyfish.net> wrote:
>> >> On 9/28/06, Harris Boyce III <harris.r.boyce.iii@gmail.com> 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
>> >>
>> >
>>
> 

Mime
View raw message