[Tutor] Why do I not get an error when I mistakenly type "humdrum.sigh_strenght" instead of the correct "humdrum.sigh_strength"?

boB Stepp robertvstepp at gmail.com
Sat Jan 23 22:07:17 EST 2016


On Sat, Jan 23, 2016 at 7:20 PM, Alan Gauld <alan.gauld at btinternet.com> wrote:
> On 23/01/16 09:30, Cameron Simpson wrote:
>
>> Alan will take you up on doing purer OO practices in Python.
>
> In pure OO objects should only expose methods and the data
> attributes should only be there to support the methods.
> As such, nobody outside the object has any need to know
> anything about it...

Apparently what OOP knowledge I started out with agrees strongly with
what you say here.  But this level of *purity* appears to be
non-Pythonic in actual practice.  So, in your opinion, how far should
I go towards emulating pure OO objects?

> One of the features of OO programming is that large
> monolithic algorithms/functions often get split into small
> chunks distributed over several classes.

With functions, the ideal is that each function executes a single,
specific purpose.  With large classes, what should I use as a guide as
to when to split them into smaller ones?  My initial thought would be
whenever a portion of the larger class models nicely into its own
class, perhaps one that looks to be useful on its own in other
programming scenarios.  Am I close to hitting the nail on the head
here?

Thanks, Alan!


-- 
boB


More information about the Tutor mailing list