Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #33786

Re: Web Frameworks Excessive Complexity

References (5 earlier) <67gun9-kk8.ln1@satorlaser.homedns.org> <DUB117-W33D7E1124EE9D7B659E50991540@phx.gbl> <mailman.140.1353496885.29569.python-list@python.org> <50acbe4e$0$29987$c3e8da3$5496439d@news.astraweb.com> <CAPTjJmqymF7ucE9ptjCVxu9hwsTVCDVXNX+QHyNk18W4qvSp7w@mail.gmail.com>
Date 2012-11-21 22:22 -0700
Subject Re: Web Frameworks Excessive Complexity
From Modulok <modulok@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.193.1353561778.29569.python-list@python.org> (permalink)

Show all headers | View raw


> On Wed, Nov 21, 2012 at 10:43 PM, Steven D'Aprano
> <steve+comp.lang.python@pearwood.info> wrote:
>> On Wed, 21 Nov 2012 22:21:23 +1100, Chris Angelico wrote:
>>
>>> 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
>>
>>

> Oh, I'm *so* glad I work in a small company.

Agreed. Do we rate a contractor's quality of workmanship and efficiency by the
number of nails he drives?

Of course not. That would be ridiculous.

A better metric of code quality and complexity would be to borrow from science
and mathematics. i.e. a peer review or audit by others working on the project
or in the same field of study. Unfortunately this isn't cheap or easily
computed and doesn't translate nicely to a bar graph.

Such is reality.
-Modulok-

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: Web Frameworks Excessive Complexity Robert Kern <robert.kern@gmail.com> - 2012-11-20 20:07 +0000
  Re: Web Frameworks Excessive Complexity Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-11-21 01:43 +0000
    Re: Web Frameworks Excessive Complexity Ulrich Eckhardt <ulrich.eckhardt@dominolaser.com> - 2012-11-21 09:33 +0100
      RE: Web Frameworks Excessive Complexity Andriy Kornatskyy <andriy.kornatskyy@live.com> - 2012-11-21 14:09 +0300
      Re: Web Frameworks Excessive Complexity Chris Angelico <rosuav@gmail.com> - 2012-11-21 22:21 +1100
        Re: Web Frameworks Excessive Complexity Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-11-21 11:43 +0000
          RE: Web Frameworks Excessive Complexity Andriy Kornatskyy <andriy.kornatskyy@live.com> - 2012-11-21 14:47 +0300
          Re: Web Frameworks Excessive Complexity Chris Angelico <rosuav@gmail.com> - 2012-11-22 09:12 +1100
          Re: Web Frameworks Excessive Complexity Modulok <modulok@gmail.com> - 2012-11-21 22:22 -0700
      RE: Web Frameworks Excessive Complexity Andriy Kornatskyy <andriy.kornatskyy@live.com> - 2012-11-21 14:45 +0300
    Re: Web Frameworks Excessive Complexity Robert Kern <robert.kern@gmail.com> - 2012-11-21 11:47 +0000

csiph-web