Path: csiph.com!usenet.pasdenom.info!news.albasani.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.014 X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; '21,': 0.07; 'computed': 0.07; 'nicely': 0.07; 'counting': 0.09; 'oh,': 0.09; 'cc:addr :python-list': 0.10; 'def': 0.10; 'contrived': 0.16; 'mathematics.': 0.16; 'wed,': 0.16; 'wrote:': 0.17; 'cheap': 0.17; '>>>': 0.18; 'translate': 0.20; 'cc:2**0': 0.23; 'statement': 0.23; 'this:': 0.23; 'cc:no real name:2**0': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'i.e.': 0.27; 'message-id:@mail.gmail.com': 0.27; "doesn't": 0.28; 'chris': 0.28; 'agreed.': 0.29; "d'aprano": 0.29; 'peer': 0.29; 'steven': 0.29; "i'm": 0.29; 'code': 0.31; 'not.': 0.32; 'received:209.85.160.46': 0.32; 'received:google.com': 0.34; 'project': 0.34; 'nov': 0.35; 'pm,': 0.35; 'received:209.85': 0.35; 'but': 0.36; 'rather': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'science': 0.38; 'instead': 0.39; 'easily': 0.39; 'header:Received:5': 0.40; 'skip:u 10': 0.60; 'of:': 0.65; 'quality': 0.69; 'score': 0.75; '10:43': 0.84; 'borrow': 0.84; 'complexity': 0.84; 'glad': 0.86; 'audit': 0.93 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=FS4Mq2cmMfpYegHoQMFom8gp8T+rfb4uAZmKDiDH2Es=; b=VbU1B5jyZZPQ7fukZ2SwQuuMtXMpW2agVeOL7OXNdQ+9NqrS6G0+iyJh4e5+1qp1Hz VZJ1TWiLkoRWZ6Afv45r+U/GL09wiigr51tSW3G3S2s68Rhy9cMM1ZJATs2WzPgYYes0 pciX2fMcetDGUm/DpiGdj1zyC9TQ6kSkKmTMHthdIe61d8Pw2DzKq6loQCVWLwrzIomf tGJ9avOYMUXWT1I9EFTIJFXTMiqJ71WRa7uHapKw6Lm9Y6oUJlbhWoIpcTgmgNCPuJCK 148ZDM0M70Pc5/pr+sIsWm5Sk/kY75eJgojrUK8W2yyEqqsOWGYGc5rIZISF2Gpb8jLb kSDQ== MIME-Version: 1.0 In-Reply-To: References: <50ac31dd$0$29987$c3e8da3$5496439d@news.astraweb.com> <67gun9-kk8.ln1@satorlaser.homedns.org> <50acbe4e$0$29987$c3e8da3$5496439d@news.astraweb.com> Date: Wed, 21 Nov 2012 22:22:54 -0700 Subject: Re: Web Frameworks Excessive Complexity From: Modulok To: Chris Angelico Content-Type: text/plain; charset=ISO-8859-1 Cc: python-list@python.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 36 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1353561778 news.xs4all.nl 6858 [2001:888:2000:d::a6]:54645 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:33786 > On Wed, Nov 21, 2012 at 10:43 PM, Steven D'Aprano > 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-