Web Frameworks Excessive Complexity

Andriy Kornatskyy andriy.kornatskyy at live.com
Wed Nov 21 12:45:48 CET 2012


The focus of development team is controlled by setting a metric threshold or just excluding some. So you do not have an overhead for the development team from the point it set forward, assuming them team committed to adherence it.

Your strategy for perfection may vary. You can start with 8 for CC in new project, or with a higher level of 15 in an existing project. Where you end up / the team agrees upon, depends on team commitment to the goal you set. There is no gold median, there is just recommendation, how you fluctuate from it and what reason you face with depends on team.



> Date: Wed, 21 Nov 2012 22:21:23 +1100
> Subject: Re: Web Frameworks Excessive Complexity
> From: rosuav at gmail.com
> To: python-list at python.org
> On Wed, Nov 21, 2012 at 10:09 PM, Andriy Kornatskyy
> <andriy.kornatskyy at live.com> wrote:
> > We choose Python for its readability. This is essential principal of language and thousands around reading the open source code. Things like PEP8, CC, LoC are all to serve you one purpose: bring your attention, teach you make your code better.
> But too much focus on metrics results in those metrics improving
> without any material benefit to the code. If there's a number that you
> can watch going up or down, nobody's going to want to be the one that
> pushes that number the wrong direction. So what happens when the right
> thing to do happens to conflict with the given metric? And yes, it
> WILL happen, guaranteed. No metric is perfect.
> Counting lines of code teaches you to make dense code. That's not a
> good thing nor a bad thing; you'll end up with list comprehensions
> rather than short loops, regardless of which is easier to actually
> read.
> Counting complexity by giving a score to every statement encourages
> code like this:
> def bletch(x,y):
> return x + {"foo":y*2,"bar":x*3+y,"quux":math.sin(y)}.get(mode,0)
> instead of:
> def bletch(x,y):
> if mode=="foo": return x+y*2
> if mode=="bar": return x*4+y
> if mode=="quux": return x+math.sin(y)
> return x
> Okay, this is a stupid contrived example, but tell me which of those
> you'd rather work with, and then tell me a plausible metric that would
> agree with you.
> ChrisA
> --
> http://mail.python.org/mailman/listinfo/python-list

More information about the Python-list mailing list