Path: csiph.com!usenet.pasdenom.info!news.redatomik.org!newsfeed.xs4all.nl!newsfeed8.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.038 X-Spam-Evidence: '*H*': 0.92; '*S*': 0.00; 'subject:Python': 0.05; 'failing': 0.05; 'test,': 0.05; 'failure.': 0.09; 'received:mail- wi0-x233.google.com': 0.09; 'regression': 0.09; 'bug': 0.10; 'advance': 0.10; '"right"': 0.16; 'bug,': 0.16; 'fixing,': 0.16; 'imo,': 0.16; 'meanwhile,': 0.16; 'programmers,': 0.16; 'subject:OOP': 0.16; 'threw': 0.16; 'wrote:': 0.16; 'tests.': 0.18; 'tests': 0.18; 'fix': 0.21; 'java': 0.22; 'back.': 0.22; 'driven': 0.22; 'fixing': 0.22; 'code,': 0.23; 'code.': 0.23; 'wrote': 0.23; 'bigger': 0.23; 'header:In-Reply-To:1': 0.24; 'written': 0.24; 'header:User-Agent:1': 0.26; 'least': 0.27; 'factor': 0.29; 'hour.': 0.29; 'itself,': 0.29; 'once.': 0.29; 'branch': 0.31; 'programmers': 0.31; 'waste': 0.31; 'window': 0.31; 'code': 0.31; 'phone:': 0.32; 'point': 0.33; 'class': 0.33; 'problem': 0.33; 'done,': 0.33; 'another': 0.34; 'received:google.com': 0.34; 'could': 0.35; 'to:addr:python-list': 0.35; 'i.e.': 0.35; 'instance': 0.35; 'something': 0.35; 'really': 0.35; 'expected': 0.35; 'sometimes': 0.35; 'but': 0.36; 'possible.': 0.36; 'possible': 0.36; 'should': 0.37; "didn't": 0.37; 'subject:: ': 0.37; 'front': 0.38; 'green': 0.38; 'unit': 0.38; 'doing': 0.38; 'end': 0.39; 'test': 0.39; 'to:addr:python.org': 0.39; 'received:192': 0.39; 'sure': 0.40; 'where': 0.40; 'learn': 0.60; 'even': 0.61; 'behavior': 0.61; 'helps': 0.61; 'email:': 0.61; 'simple': 0.61; 'video': 0.61; 'complete': 0.63; 'minutes': 0.64; 'email addr:gmail.com': 0.64; 'due': 0.65; 'charset:windows-1252': 0.65; 'header:Reply-To:1': 0.67; 'believe': 0.67; 'helping': 0.71; 'reply-to:no real name:2**0': 0.71; 'us,': 0.73; 'miss': 0.74; 'brand': 0.75; 'life.': 0.81; 'exercise,': 0.84; 'priorities,': 0.84; 'subject:Classic': 0.84; 'watched': 0.91; 'taught': 0.97 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:message-id:date:reply-to:user-agent:mime-version:to:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=AhYVvGY7i2kF+HTOLoIxCoRMtaLwpcEa7vLqZr7XDNY=; b=FV9hXqw0JkZ2fdYmK0tTe/yh5khyZCC+YVzdq2V34zCjNexbR7X/FTIlexDvutJO34 KMpmMY6yY5Sfe1NdNvySJ2s6F68mcpLf3sns/0xR5E9ieKbk0rH+b6SRJiV1n+wpem42 vrp8ruRy8KFp5F687xcAXUdHynjHWAFQT2FvlnmH9mIzHNngf3+ewSd92Gvctx/dYjrB MdZul02SqMO5/khnWgZSYXCoeJJRgDWCQY45Ze23PloldCBgVlsO18arZ2IPHzwv67Vk h5bOtP1uLdb2xD8ElZMrBUnXMYZ+u2bxc4nDRwEKevqmRdC0Vcn7utKhHOqWX+y6dkqi xUCQ== X-Received: by 10.180.81.3 with SMTP id v3mr25374927wix.36.1434618060136; Thu, 18 Jun 2015 02:01:00 -0700 (PDT) From: Marco Buttu X-Google-Original-From: Marco Buttu Date: Thu, 18 Jun 2015 11:00:57 +0200 Reply-To: mbuttu@oa-cagliari.inaf.it User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.1.2 MIME-Version: 1.0 To: python-list@python.org Subject: Re: Classic OOP in Python References: <23b2fae3-91d5-486b-9898-78b34bee486f@googlegroups.com> <16dc8c92-50e3-4fc8-ae25-cbc5b13e8971@googlegroups.com> <87eglaqdca.fsf@elektro.pacujo.net> <6944ae86-86eb-4a9b-be05-21d0be7bb206@googlegroups.com> In-Reply-To: <6944ae86-86eb-4a9b-be05-21d0be7bb206@googlegroups.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Mailman-Approved-At: Thu, 18 Jun 2015 11:45:00 +0200 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ 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: 40 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1434620701 news.xs4all.nl 2884 [2001:888:2000:d::a6]:53905 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:92811 On 17/06/2015 23:33, sohcahtoa82@gmail.com wrote: > I had a Java class where we had to learn TDD, and that's the way TDD was taught to us, and I hated it. We watched a video of this guy explaining TDD with a hat that was red on the front and green on the back. It involved writing a simple failing unit test, then write code to fix it, then refactor the tests and/or code. I do not think it is important that the test fails before writing the code, but for sure it is really wise to ensure every test fails at least once. If I wrote a test and it has never failed before, then I always change something in the test itself, in order to have an expected failure. And sometimes the expected failures make me better understand the behavior of the code. > As an in-class exercise, we had to write an implementation of Conway's Game of Life. I threw TDD out the window and just wrote the damn program in under 15 minutes, then another 10 minutes to write unit tests that tested every possible code branch and several invalid inputs. Meanwhile, the people doing TDD the "right" way didn't even have a complete program after over an hour. > > The brand of TTD we were taught would end up multiplying development time by at least a factor of 3, and by the time you were done, at least 75% of the tests you had written will have been removed due to rampant refactoring. > > IMO, that kind of TTD is an utter waste of time. I think TDD helps a lot to design the code to be "testable" as much as possible. I believe good and experienced programmers could think in advance the way to write testable code, without be driven by tests. However, I also think that the bigger part of programmers, as me, do not have this ability. That's the case TDD comes in handy helping us to write testable code. In case of bug fixing, I think also experienced and good programmers that do not believe in TDD should always write the tests in advance, for instance because: * it is really the better way to understand the problem and point to it * chances are that you will not write a test after fixing the bug, i.e. because you may have other priorities, so you will miss a regression test -- Marco Buttu INAF-Osservatorio Astronomico di Cagliari Via della Scienza n. 5, 09047 Selargius (CA) Phone: 070 711 80 217 Email: mbuttu@oa-cagliari.inaf.it