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


Groups > comp.lang.python > #33715

RE: Web Frameworks Excessive Complexity

From Andriy Kornatskyy <andriy.kornatskyy@live.com>
Subject RE: Web Frameworks Excessive Complexity
Date 2012-11-21 14:09 +0300
References <67gun9-kk8.ln1@satorlaser.homedns.org>
Newsgroups comp.lang.python
Message-ID <mailman.139.1353496246.29569.python-list@python.org> (permalink)

Show all headers | View raw


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.

Thanks.

Andriy


----------------------------------------
> From: ulrich.eckhardt@dominolaser.com
> Subject: Re: Web Frameworks Excessive Complexity
> Date: Wed, 21 Nov 2012 09:33:09 +0100
> To: python-list@python.org
>
> Am 21.11.2012 02:43, schrieb Steven D'Aprano:
> > On Tue, 20 Nov 2012 20:07:54 +0000, Robert Kern wrote:
> >> The source of bugs is not excessive complexity in a method, just
> >> excessive lines of code.
> >
> > Taken literally, that cannot possibly the case.
> >
> > def method(self, a, b, c):
> > do_this(a)
> > do_that(b)
> > do_something_else(c)
> >
> >
> > def method(self, a, b, c):
> > do_this(a); do_that(b); do_something_else(c)
> >
> >
> > It *simply isn't credible* that version 1 is statistically likely to have
> > twice as many bugs as version 2. Over-reliance on LOC is easily gamed,
> > especially in semicolon languages.
>
> "Don't indent deeper than 4 levels!" "OK, not indenting at all, $LANG
> doesn't need it anyway." Sorry, but if code isn't even structured
> halfway reasonably it is unmaintainable, regardless of what CC or LOC say.
>
>
> > Besides, I think you have the cause and effect backwards. I would rather
> > say:
> >
> > The source of bugs is not lines of code in a method, but excessive
> > complexity. It merely happens that counting complexity is hard, counting
> > lines of code is easy, and the two are strongly correlated, so why count
> > complexity when you can just count lines of code?
>
> I agree here, and I'd go even further: Measuring complexity is not just
> hard, it requires a metric that you need to agree on first. With LOC you
> only need to agree on not semicolon-chaining lines and how to treat
> comments and empty lines. With CC, you effectively agree that an if
> statement has complexity of one (or 2?) while a switch statement has a
> complexity according to its number of cases, while it is way easier to
> read and comprehend than a similar number produced by if statement.
> Also, CC doesn't even consider new-fashioned stuff like exceptions that
> introduce yet another control flow path.
>
>
> >> LoC is much simpler, easier to understand, and
> >> easier to correct than CC.
> >
> > Well, sure, but do you really think Perl one-liners are the paragon of
> > bug-free code we ought to be aiming for? *wink*
>
> Hehehe... ;)
>
> Uli
>
>
> --
> http://mail.python.org/mailman/listinfo/python-list
 		 	   		  

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