[Spambayes] proposed changes to hammie & co.

Rob Hooft rob@hooft.net
Fri Nov 22 21:40:19 2002

T. Alexander Popiel wrote:
> In message:  <3DDDF19E.3000305@hooft.net>
>              Rob Hooft <rob@hooft.net> writes:
>>I definitely wouldn't move the calculation into the wordinfo class. It 
>>is a different task, so it "should" (design) be a separate class....
> I moderately agree, but OOP folks tend to have an aversion
> to pure data classes (as I think WordInfo should be). ;-)

It doesn't have to be a pure data class. If you want to do pure OOP, 
indeed the WordInfo class should hide its implementation detail:

class WordInfo:
     def __init__(self,probcalc,...):

     def spamprob(self):
          return self.probcalc(self.hamcount,self.spamcount)

class CachingProbCalc(ProbCalc):
     # The caching calculator
     def __call__(self,hamcount,spamcount):

class Bayes:

I like object composition (as you can see as well from CostCounter.py).

Rob W.W. Hooft  ||  rob@hooft.net  ||  http://www.hooft.net/people/rob/

More information about the Spambayes mailing list