Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #26702
| From | Ben Finney <ben+python@benfinney.id.au> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | Re: [newbie] Looking for a good introduction to object oriented programming with Python |
| References | (1 earlier) <sqednRxYjp0OUIPNnZ2dnUVZ8rednZ2d@bt.com> <501f0e4a$0$29867$c3e8da3$5496439d@news.astraweb.com> <IeCdnX3jusXgG4LNnZ2dnUVZ8hWdnZ2d@bt.com> <5020a544$0$29867$c3e8da3$5496439d@news.astraweb.com> <6-GdneHMxPM-QL3NnZ2dnUVZ8nSdnZ2d@bt.com> |
| Date | 2012-08-07 23:12 +1000 |
| Message-ID | <87y5lqj16c.fsf@benfinney.id.au> (permalink) |
| Organization | Unlimited download news at news.astraweb.com |
lipska the kat <lipskathekat@yahoo.co.uk> writes: > >>>> The ONLY concept that you should never try to encapsulate is/are > >>>> human beings or their aliases. You stated this in absolute, dogmatic terms. I thought at first you were being hyperbolic for effect, but the situation that you present to support this dogma is one where I can't see anyone rationally concluding the dogma applies. > Well now this is a personal thing born of bitter experience. In my > experience, when you have an entity called 'Person' or some such in > your Class model it soon becomes what we 'in the trade' call a 'God > Object' The name should be self explanatory but hold tight, here comes > some more jargon. God objects are a code smell (another term of art, meaning a symptom in the code that tends to indicate poor design or some other fundamental flaw). But what you're describing below doesn't fit. > Objects can have a 'has a' relationship with other Objects or an 'is a' > relationship with other objects > > The 'has a' relationship means that an Object 'owns' another object, > the is a' relationship means that an Object 'is of a particular type' > Of course in an 'Object Oriented' language such as Java an Object > reference can have a different type at runtime than it does at compile > time. In Python too. > > Anyway, this Person thing soon ends up with a 'has a' relationship > with everything in sight. a Person 'has a[n]' Address, a Person 'has > a[n]' account, a Person 'has a' Doughnut etc etc etc > > Also, inevitably a Person 'is a' Customer, a Person 'is a' Contact, a > Person 'is a' security risk, well you get the idea. This accurately reflects the reality that “person” is a real-world entity very frequently involved in just about anything a typical system needs to model. > Of course this is a problem with the actual design process itself What problem? If the real-world entity really exists and the “has-a” and “is-a” relationships really exist, then it's *good* design to model whatever ones of those are significant to the operation of the program. Indeed, it would be *bad* design to avoid modelling the real world merely because of dogma against modelling persons and their relationships to other entities. If there were entities or relationships that were needlessly cumbersome – if indeed the object was trying to encapsulate the majority of the whole world in itself – then those should be removed from the object, and perhaps even from the design. But that's not what you describe. A Person entity in inheritance or composition relationships with other classes and objects is not a god object, since it is sensibly delegating specific jobs to places other than itself. That's very good, modular design. And when the real domain to be modelled almost certainly has people as a central entity in complex interactions, removing Person from the design entirely is poor work grounded in irrationality. -- \ “I am amazed, O Wall, that you have not collapsed and fallen, | `\ since you must bear the tedious stupidities of so many | _o__) scrawlers.” —anonymous graffiti, Pompeii, 79 CE | Ben Finney
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[newbie] Looking for a good introduction to object oriented programming with Python Jean Dubois <jeandubois314@gmail.com> - 2012-08-04 08:49 -0700
Re: [newbie] Looking for a good introduction to object oriented programming with Python shearichard@gmail.com - 2012-08-04 17:11 -0700
Re: Looking for a good introduction to object oriented programming with Python Jean Dubois <jeandubois314@gmail.com> - 2012-08-05 05:38 -0700
Re: Looking for a good introduction to object oriented programming with Python Jean Dubois <jeandubois314@gmail.com> - 2012-08-05 11:04 -0700
Re: Looking for a good introduction to object oriented programming with Python Mark Lawrence <breamoreboy@yahoo.co.uk> - 2012-08-05 19:28 +0100
Re: Looking for a good introduction to object oriented programming with Python Jean Dubois <jeandubois314@gmail.com> - 2012-08-06 07:56 -0700
Re: Looking for a good introduction to object oriented programming with Python Mark Lawrence <breamoreboy@yahoo.co.uk> - 2012-08-06 17:17 +0100
Re: Looking for a good introduction to object oriented programming with Python Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-08-07 01:12 +0000
Re: Looking for a good introduction to object oriented programming with Python Ben Finney <ben+python@benfinney.id.au> - 2012-08-07 11:23 +1000
Re: Looking for a good introduction to object oriented programming with Python Mark Lawrence <breamoreboy@yahoo.co.uk> - 2012-08-07 08:49 +0100
Re: Looking for a good introduction to object oriented programming with Python Roy Smith <roy@panix.com> - 2012-08-05 14:39 -0400
Re: Looking for a good introduction to object oriented programming with Python Mark Lawrence <breamoreboy@yahoo.co.uk> - 2012-08-05 19:53 +0100
Re: Looking for a good introduction to object oriented programming with Python Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-08-05 18:45 -0400
Re: Looking for a good introduction to object oriented programming with Python Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-08-05 22:51 +0000
Re: Looking for a good introduction to object oriented programming with Python Roy Smith <roy@panix.com> - 2012-08-05 19:12 -0400
Re: Looking for a good introduction to object oriented programming with Python Mark Lawrence <breamoreboy@yahoo.co.uk> - 2012-08-06 00:30 +0100
Re: Looking for a good introduction to object oriented programming with Python Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-08-06 00:27 +0000
Re: Looking for a good introduction to object oriented programming with Python Dan Sommers <dan@tombstonezero.net> - 2012-08-05 17:50 -0700
Re: Looking for a good introduction to object oriented programming with Python lipska the kat <lipskathekat@yahoo.co.uk> - 2012-08-06 08:48 +0100
Re: Looking for a good introduction to object oriented programming with Python DJC <djc@news.invalid> - 2012-08-06 11:20 +0200
Re: Looking for a good introduction to object oriented programming with Python Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-08-05 20:57 -0400
Re: Looking for a good introduction to object oriented programming with Python lipska the kat <lipskathekat@yahoo.co.uk> - 2012-08-06 08:43 +0100
Re: Looking for a good introduction to object oriented programming with Python Roy Smith <roy@panix.com> - 2012-08-06 09:16 -0400
Re: Looking for a good introduction to object oriented programming with Python Wolfgang Strobl <news4@mystrobl.de> - 2012-08-06 08:18 +0200
Re: [newbie] Looking for a good introduction to object oriented programming with Python dncarac@gmail.com - 2012-08-05 11:59 -0700
Re: [newbie] Looking for a good introduction to object oriented programming with Python lipska the kat <lipskathekat@yahoo.co.uk> - 2012-08-05 20:46 +0100
Re: [newbie] Looking for a good introduction to object oriented programming with Python Mark Lawrence <breamoreboy@yahoo.co.uk> - 2012-08-05 23:11 +0100
Re: [newbie] Looking for a good introduction to object oriented programming with Python Roy Smith <roy@panix.com> - 2012-08-05 18:53 -0400
Re: [newbie] Looking for a good introduction to object oriented programming with Python Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-08-06 00:22 +0000
Re: [newbie] Looking for a good introduction to object oriented programming with Python Mark Lawrence <breamoreboy@yahoo.co.uk> - 2012-08-06 02:02 +0100
Re: [newbie] Looking for a good introduction to object oriented programming with Python Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-08-05 21:14 -0400
Re: [newbie] Looking for a good introduction to object oriented programming with Python Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-08-06 06:08 +0000
Re: [newbie] Looking for a good introduction to object oriented programming with Python Paul Rubin <no.email@nospam.invalid> - 2012-08-06 00:25 -0700
Re: Looking for a good introduction to object oriented programming with Python alex23 <wuwei23@gmail.com> - 2012-08-05 19:44 -0700
Re: Looking for a good introduction to object oriented programming with Python Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-08-07 19:02 +0000
Re: Looking for a good introduction to object oriented programming with Python Terry Reedy <tjreedy@udel.edu> - 2012-08-07 18:37 -0400
Re: Looking for a good introduction to object oriented programming with Python alex23 <wuwei23@gmail.com> - 2012-08-07 17:07 -0700
Re: Looking for a good introduction to object oriented programming with Python Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-08-08 02:14 +0000
Re: Looking for a good introduction to object oriented programming with Python Chris Angelico <rosuav@gmail.com> - 2012-08-08 12:24 +1000
Re: Looking for a good introduction to object oriented programming with Python alex23 <wuwei23@gmail.com> - 2012-08-07 20:20 -0700
Re: [newbie] Looking for a good introduction to object oriented programming with Python lipska the kat <lipskathekat@yahoo.co.uk> - 2012-08-06 09:55 +0100
Re: [newbie] Looking for a good introduction to object oriented programming with Python lipska the kat <lipskathekat@yahoo.co.uk> - 2012-08-06 10:24 +0100
Re: [newbie] Looking for a good introduction to object oriented programming with Python Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-08-07 05:35 +0000
Re: [newbie] Looking for a good introduction to object oriented programming with Python lipska the kat <lipskathekat@yahoo.co.uk> - 2012-08-07 09:16 +0100
Re: [newbie] Looking for a good introduction to object oriented programming with Python Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-08-07 05:19 +0000
Re: [newbie] Looking for a good introduction to object oriented programming with Python lipska the kat <lipskathekat@yahoo.co.uk> - 2012-08-07 10:19 +0100
Re: [newbie] Looking for a good introduction to object oriented programming with Python Ben Finney <ben+python@benfinney.id.au> - 2012-08-07 23:12 +1000
Re: [newbie] Looking for a good introduction to object oriented programming with Python lipska the kat <lipskathekat@yahoo.co.uk> - 2012-08-07 15:13 +0100
Re: [newbie] Looking for a good introduction to object oriented programming with Python Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-08-07 14:14 +0000
Re: [newbie] Looking for a good introduction to object oriented programming with Python lipska the kat <lipskathekat@yahoo.co.uk> - 2012-08-07 15:34 +0100
Re: Looking for a good introduction to object oriented programming with Python rusi <rustompmody@gmail.com> - 2012-08-07 08:04 -0700
Re: Looking for a good introduction to object oriented programming with Python lipska the kat <lipskathekat@yahoo.co.uk> - 2012-08-07 18:00 +0100
Re: Looking for a good introduction to object oriented programming with Python Chris Angelico <rosuav@gmail.com> - 2012-08-08 07:57 +1000
Re: Looking for a good introduction to object oriented programming with Python lipska the kat <lipskathekat@yahoo.co.uk> - 2012-08-08 10:51 +0100
Re: Looking for a good introduction to object oriented programming with Python rusi <rustompmody@gmail.com> - 2012-08-08 09:27 -0700
Re: Looking for a good introduction to object oriented programming with Python Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-08-08 17:28 +0000
Re: Looking for a good introduction to object oriented programming with Python Chris Angelico <rosuav@gmail.com> - 2012-08-09 11:32 +1000
Re: Looking for a good introduction to object oriented programming with Python Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-08-08 12:42 -0400
Re: Looking for a good introduction to object oriented programming with Python lipska the kat <lipskathekat@yahoo.co.uk> - 2012-08-08 20:31 +0100
Re: Looking for a good introduction to object oriented programming with Python Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-08-08 22:59 -0400
Re: Looking for a good introduction to object oriented programming with Python lipska the kat <lipskathekat@yahoo.co.uk> - 2012-08-09 08:29 +0100
Geneology Packages -- WAS: Looking for a good introduction to object oriented programming with Python Simon Cropper <simoncropper@fossworkflowguides.com> - 2012-08-09 13:51 +1000
Re: Geneology Packages Ben Finney <ben+python@benfinney.id.au> - 2012-08-09 14:00 +1000
Re: Looking for a good introduction to object oriented programming with Python rusi <rustompmody@gmail.com> - 2012-08-06 05:19 -0700
Re: Looking for a good introduction to object oriented programming with Python lipska the kat <lipskathekat@yahoo.co.uk> - 2012-08-06 15:27 +0100
Re: Looking for a good introduction to object oriented programming with Python rusi <rustompmody@gmail.com> - 2012-08-06 09:34 -0700
Re: Looking for a good introduction to object oriented programming with Python Chris Angelico <rosuav@gmail.com> - 2012-08-07 08:44 +1000
OT probably but still relevant (was Re: Looking for a good introduction to object oriented programming with Python) lipska the kat <lipskathekat@yahoo.co.uk> - 2012-08-06 17:23 +0100
Re: OT probably but still relevant (was Re: Looking for a good introduction to object oriented programming with Python) Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-08-07 09:44 +0000
Re: OT probably but still relevant (was Re: Looking for a good introduction to object oriented programming with Python) lipska the kat <lipskathekat@yahoo.co.uk> - 2012-08-07 11:23 +0100
csiph-web