[Tutor] Python scripts: to use class or not — what is the best practice?
David L Neil
PyTutor at DancesWithMice.info
Tue Mar 17 00:27:19 EDT 2020
On 17/03/20 1:44 PM, Alan Gauld via Tutor wrote:
> On 16/03/2020 22:41, DL Neil via Tutor wrote:
>
>> More recently Grady Booch's view of Object-Oriented Programming (OOP)
>> talked of "encapsulation" - I'm a little wary of quoting his ideas
>> (which are nevertheless valid) because their implementation is an
>> anathema to Python and the pythonic way of thinking,
>
> I'm not sure I'd agree with that. Grady's ideas were expressed in
> his OOD book from 1991 - 29 years ago - and were in line with
> common thinking about OOP at the time.
>
> Grady was (and is) a big fan of information hiding (which is
> separate to, but often confused with, ecapsulation), an
> important feature of creating robust systems. But he is not a
> big fan of getters/setters. Rather he follows the idioms of
> the languages he uses. So, in his second edition he primarily
> used Java and so included getters/setters but in both his 1st
> and 3rd editions (both multi-lingual) he uses the conventions
> of the language, often without getter/setter methods.
>
> But that nit-pick aside, I agree with what you wrote... :-)
awww, and there was I thinking this might be an opportunity for you to
'pick me up' on my view of classes...
To clarify (just in case): the "More recently" was comparative to the
ideas of "modular programming" (which long preceded main-stream
programming - early users of 'unusual languages' such as Algol being
possible exceptions). I'd suggest 'modular' was a feature of the ?late
seventies? Regardless, I did not mean "more recently", as (perhaps) the
twenty-teens decade!
I can't recall when I last read Grady Booch. Do any of his later works
cite Python examples as their second language?
The 'culture' within IT has been changing along with the more noticeable
'rise' and 'fall' of programming languages. Many of the old 'compulsory
reading' texts seem so out-of-step with Pythonic thinking.
(sadly - but IMHO putting-in the time to read such 'classics' is still a
worthwhile investment!)
--
Regards =dn
More information about the Tutor
mailing list