[Biojava-dev] AbstractSequence private access

PATERSON Trevor trevor.paterson at roslin.ed.ac.uk
Wed Oct 13 11:35:13 UTC 2010


That would be an ideal solution for me :)

Ps my mails to the list get bounced cos of a bad header 
- I have no idea what it is 
- if the moderator can tell me what it is I can sort it.. 


Trevor Paterson PhD
new email trevor.paterson at roslin.ed.ac.uk

Bioinformatics 
The Roslin Institute
The Royal (Dick) School of Veterinary Studies
University of Edinburgh
Scotland EH25 9PS
phone +44 (0)131 5274197
http://bioinformatics.roslin.ed.ac.uk/

Please consider the environment before printing this e-mail

The University of Edinburgh is a charitable body, registered in Scotland with registration number SC005336
Disclaimer:This e-mail and any attachments are confidential and intended solely for the use of the recipient(s) to whom they are addressed. If you have received it in error, please destroy all copies and inform the sender. 



-- 
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.


-----Original Message-----
From: Richard Holland [mailto:holland at eaglegenomics.com] 
Sent: 13 October 2010 12:26
To: PATERSON Trevor
Cc: 'biojava-dev at lists.open-bio.org'
Subject: Re: [Biojava-dev] AbstractSequence private access

I'd be happier with a set/get method pair rather than exposing the field itself, but generally I don't see a problem with allowing it to be mutable.

The reason for the set/get approach is there may (in some implementations) be other fields or caches internally to the object that need to know if the sequenceStorage has changed and therefore need to reset themselves. By using a set/get we can allow people to detect that change by overriding the set method, and the get method allows transparent wraps/unwraps/caching/lazyloading etc. as necessary. Generally its good programming practice to use a set/get pair anyway.


On 13 Oct 2010, at 11:42, PATERSON Trevor wrote:

> Hi
> 
> you may recall that many months ago I was attempting to use BioJava3 
> objects in our Java EnsemblAPI project 
> http://jensembl.sourceforge.net/
> 
> I have just been looking at how your recent code updates affect our 
> demo
> 
> our original basic problem was that
> 
> 1. we need to subclass DNASequence (which subclasses Abstract 
> Sequence) 2. we need to be able to set the ProxySequenceReader 
> ***after*** we have made a subclassed DNASequence Object
> 
> there are various very clunky workarounds we could do for this - 
> either by using reflection to set the ProxySequenceReader or replacing 
> existing DNASequence Objects with  a new DNASequence Object 
> constructed with a ProxySequenceReader  as we need to
> 
> however the clean fix I hacked into a previous version of your code 
> was to change the modifier in AbsractSequence from
> 
> private SequenceReader<C> sequenceStorage;
> 
> to
> 
> protected SequenceReader<C> sequenceStorage;
> 
> so that I could then use Subclasses as a bean rather than immutable 
> object
> 
> I don't think that our use case is particularly unreasonable - because 
> I can easily imagine scenarios where you might want to change the Datasource for a DNASequence object on the fly - which could be done by resetting its reader.
> 
> Is there any reason why the sequenceStorage field must be private rather than protected?
> 
> (And without any in depth knowledge of BioJava, is this design pattern 
> widespread, because it has implications for any occasion where Objects 
> are populated by lazy load from datasources)
> 
> 
> cheers
> 
> trevor
> 
> ps good to see that biojava3 is coming to fruition after all your hard 
> work
> 
> 
> 
> 
> Trevor Paterson PhD
> new email 
> trevor.paterson at roslin.ed.ac.uk<mailto:trevor.paterson at roslin.ed.ac.uk
> >
> 
> Bioinformatics
> The Roslin Institute
> The Royal (Dick) School of Veterinary Studies University of Edinburgh 
> Scotland EH25 9PS phone +44 (0)131 5274197 
> http://bioinformatics.roslin.ed.ac.uk/
> 
> Please consider the environment before printing this e-mail
> 
> The University of Edinburgh is a charitable body, registered in 
> Scotland with registration number SC005336 Disclaimer:This e-mail and any attachments are confidential and intended solely for the use of the recipient(s) to whom they are addressed. If you have received it in error, please destroy all copies and inform the sender.
> 
> 
> The University of Edinburgh is a charitable body, registered in 
> Scotland, with registration number SC005336.
> _______________________________________________
> biojava-dev mailing list
> biojava-dev at lists.open-bio.org
> http://lists.open-bio.org/mailman/listinfo/biojava-dev

--
Richard Holland, BSc MBCS
Operations and Delivery Director, Eagle Genomics Ltd
T: +44 (0)1223 654481 ext 3 | E: holland at eaglegenomics.com http://www.eaglegenomics.com/





More information about the biojava-dev mailing list