[dgplug-users] [OT] Object Calisthenics in Python

Elijah thyarmageddon at gmail.com
Thu Jun 12 03:21:09 PDT 2014


On Jun 12, 2014, at 3:56 AM, Arnau Orriols <arnauorriolsmiro at gmail.com> wrote:

> Hi mates!
> 
> Yesterday, I somehow ended up attending a round table of a Software
> Craftsmanship meetup group. All of them where Java and .NET
> programmers, a lovely crowd (I asume most of you reading are Python
> developers, right?). Among many topics discussed, one in particular
> caught my attention. Object Calisthenics.
> 
> What is it about? In short, it is 9 rules that some guy named Jeff Bay
> proposed in an essay [1] published in the ThoughtWorks Anthology [2]
> for writting better Object Oriented code, and helping programmers to
> apply to the SOLID principles.
> 
> The thing is, as an annoying noob I enjoy being, I started questioning
> whether this rules would apply to all "Object Oriented" languages,
> (even those more more dynamic, like Python), besides the obvious
> languages this essay seems to be aimed.
> 
> I did not get the feedback I was kind of expecting, but it seemed to
> me like they didn't gave it too much thought (I don't blame them, they
> have enough to think about :). But I wonder whether any of you have
> any opinion on this matter? Should we constraint our OO Python code to
> all of these rules, some, none? Should we care at all? Can some of
> these rules have any side-effects in the readability of our code?
> 
> Just something to get you guys thinking. And for those just starting
> the summer code, happy learning! You'll get to answer this mail at the
> end of the summer :)
> 
> [1] http://www.cs.helsinki.fi/u/luontola/tdd-2009/ext/ObjectCalisthenics.pdf
> [2] http://pragprog.com/book/twa/thoughtworks-anthology
> 
> Arnau Orriols (AKA Josep Caselles)
> _______________________________________________
> Users mailing list
> Users at lists.dgplug.org
> http://lists.dgplug.org/listinfo.cgi/users-dgplug.org


The big difference between Java and .Net and scripting languages like Python and Ruby or Perl is that the first are usually compiled while the second are usually interpreted. Scripting languages have more restraints logistically and practically. That’s why I would actually agree with Kushal as PEP8 offers the best guidelines for python development. It is not always spot on, you can break a few rules here and there, but it is still the best guideline for python specifically. It, PEP8, is also integrated in a lot of scripts and whatnot making it the best for use, I already have it as a plugin for vim for example and it tells me when I do something outside the guidelines which sometimes makes me change the snippet or other times simply ignore it because I know better (kidding but sometimes you can’t follow it even if you want to).

Elijah


More information about the Users mailing list