[Biojava-l] Re: Biojava-l digest, Vol 1 #6 - 3 msgs

Juha Muilu muilu@ebi.ac.uk
Tue, 25 Jan 2000 10:24:54 +0000


David Martin wrote:
> 
-- cut ---
>
> > > These are static properties kept in an external class (or a particular
> > > instance of an AminoAcidTable class. So replacing the
> > > this.getCharAt(i).isCharged()
> > > with
> > > AminoAcidTable.isCharged(this.getCharAt(i))
> > > is the only substantive change.
> >
> > What you say is true enough, but it violates encapsulation.  Instead of
> > the amino acid's state being defined internally, you have to use an
> > external table to look it up.
> 
> If each sequence has an instance of AminoAcidTable as a sequence property
> (much like a nucleotide sequence would have a 'Genetic Code' object) then
> encapsulation is not violated.
>

For me the previous suggestion, having external class is better than
coupling interpretation(s) of an attribute(s) into a same object (here
Sequence object) as suggested by Mark

E.g.. charge of an amino acid depends on many cases. (Please correct me
if I am wrong) You may end up rather complicated class if you try 
to take all possible variations into account
(and add new ones when somebody needs/invite those). This can be done by
delegation, but external utility class as David said, is simpler..

I do not think that this violates encapsulation. It do not change
objects internal state. 

Use of utility classes may make sense with other methods as well. 
Like transcribe(), reveresecomplement() etc...

Juha
> >
-- cut--
>
> 
> ..d
> 
> ---------------------------------------------------------------------
> *  Dr. David Martin                  Biotechnology Centre of Oslo   *
> *  Node Manager                      Gaustadalleen 21               *
> *  The Norwegian EMBNet Node         P.O. box 1125 Blindern         *
> *  tel +47 22 95 87 56               N-0317 Oslo                    *
> *  fax +47 22 69 41 30               Norway                         *
> ---------------------------------------------------------------------
> 
> _______________________________________________
> Biojava-l mailing list  -  Biojava-l@biojava.org
> http://biojava.org/mailman/listinfo/biojava-l

-- 
 +--------------------------------------------------------------------+
 |Juha Muilu, Ph.D., EMBL Outstation| Email:  muilu@ebi.ac.uk         |
 |European Bioinformatics Institute | Phone:  +44 (0)1223 494 624     |
 |Wellcome Trust Genome Campus      | Fax:    +44 (0)1223 494 468     |
 |Hinxton, Cambridge CB10 1SD, UK   | http://industry.ebi.ac.uk/~muilu|
 +--------------------------------------------------------------------+