RE: Web Frameworks Excessive Complexity

Discussion in 'Python' started by Andriy Kornatskyy, Nov 21, 2012.

  1. Chris,

    The focus of development team is controlled by setting a metric thresholdor just excluding some. So you do not have an overhead for the developmentteam 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 newproject, 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 youset. There is no gold median, there is just recommendation, how you fluctuate from it and what reason you face with depends on team.

    Thanks.

    Andriy


    ----------------------------------------
    > Date: Wed, 21 Nov 2012 22:21:23 +1100
    > Subject: Re: Web Frameworks Excessive Complexity
    > From:
    > To:
    >
    > On Wed, Nov 21, 2012 at 10:09 PM, Andriy Kornatskyy
    > <> 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
     
    Andriy Kornatskyy, Nov 21, 2012
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Robert Kern

    Re: Web Frameworks Excessive Complexity

    Robert Kern, Nov 20, 2012, in forum: Python
    Replies:
    0
    Views:
    134
    Robert Kern
    Nov 20, 2012
  2. Andriy Kornatskyy

    RE: Web Frameworks Excessive Complexity

    Andriy Kornatskyy, Nov 20, 2012, in forum: Python
    Replies:
    0
    Views:
    141
    Andriy Kornatskyy
    Nov 20, 2012
  3. Robert Kern

    Re: Web Frameworks Excessive Complexity

    Robert Kern, Nov 20, 2012, in forum: Python
    Replies:
    7
    Views:
    149
    Modulok
    Nov 22, 2012
  4. Andriy Kornatskyy

    RE: Web Frameworks Excessive Complexity

    Andriy Kornatskyy, Nov 20, 2012, in forum: Python
    Replies:
    0
    Views:
    137
    Andriy Kornatskyy
    Nov 20, 2012
  5. Robert Kern

    Re: Web Frameworks Excessive Complexity

    Robert Kern, Nov 20, 2012, in forum: Python
    Replies:
    0
    Views:
    140
    Robert Kern
    Nov 20, 2012
Loading...

Share This Page