Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Ben Finney Newsgroups: comp.lang.python Subject: Refactoring in a large code base (was: importing: what does "from" do?) Date: Fri, 22 Jan 2016 18:54:14 +1100 Lines: 42 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: news.uni-berlin.de UVEXaoE+FNqueLVMjf0QYQZ+Zn1+OpKiU+bT5vEK6FhA== Cancel-Lock: sha1:05b5UZo92Gym/IWOf01pq6Ung1Q= Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.041 X-Spam-Evidence: '*H*': 0.92; '*S*': 0.00; 'incompatible': 0.07; 'modifying': 0.07; 'puts': 0.07; 'subject:code': 0.07; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'url:github': 0.09; 'codebase': 0.16; 'discussed.': 0.16; 'instead"': 0.16; 'received:80.91.229.3': 0.16; 'received:io': 0.16; 'received:plane.gmane.org': 0.16; 'received:psf.io': 0.16; 'refactoring': 0.16; 'relevant.': 0.16; 'subject:?)': 0.16; 'trade-offs': 0.16; 'programmer': 0.18; 'fix': 0.21; 'errors': 0.23; 'header:User-Agent:1': 0.26; 'header:X-Complaints-To:1': 0.26; 'sense': 0.26; 'points': 0.27; 'it\xe2\x80\x99s': 0.29; 'subject:what': 0.29; 'code': 0.30; 'instead,': 0.33; 'lets': 0.33; 'ones': 0.35; 'text': 0.35; 'knowledge': 0.35; 'quite': 0.35; 'but': 0.36; 'too': 0.36; 'should': 0.36; 'there': 0.36; 'subject:" ': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'two': 0.37; 'received:org': 0.37; 'things': 0.38; 'no,': 0.38; 'times.': 0.38; 'building': 0.38; 'files': 0.38; 'subject:from': 0.39; 'enough': 0.39; 'to:addr:python.org': 0.40; 'avoid': 0.61; 'further': 0.62; 'making': 0.62; 'more': 0.63; 'complete': 0.63; 'times': 0.63; 'our': 0.64; "they're": 0.66; 'direct': 0.68; 'strategy': 0.69; 'presented': 0.72; '_o__)': 0.84; 'feedback,': 0.84; 'pursuit': 0.84; 'received:125': 0.84; 'subject:base': 0.84; 'absolutely': 0.88; 'procedure,': 0.91; 'religion': 0.91; 'technique': 0.93; 'serious': 0.97 X-Injected-Via-Gmane: http://gmane.org/ X-Gmane-NNTP-Posting-Host: jigong.madmonks.org X-Public-Key-ID: 0xAC128405 X-Public-Key-Fingerprint: 517C F14B B2F3 98B0 CB35 4855 B8B2 4C06 AC12 8405 X-Public-Key-URL: http://www.benfinney.id.au/contact/bfinney-pubkey.asc X-Post-From: Ben Finney User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux) 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: , Xref: csiph.com comp.lang.python:101995 Rustom Mody writes: > You may find this strategy useful: > https://pchiusano.github.io/2015-04-23/unison-update7.html > > particularly the section "Limitations of refactoring via modifying > text files in place, and what to do instead" A direct link to that section is . The author points out there are times when a code base is large and complex enough that refactoring puts the programmer in a state of not knowing whether they're making progress, because until the whole refactoring is complete the errors just cascade and it's hard to tell which ones are relevant. That’s bad for two reasons. Without this feedback, you may be writing code that is making things worse, not better, building further on faulty assumptions. But more than the technical difficulties, working in this state is demoralizing, and it kills focus and productivity. All right, so what do we do instead? Should we just avoid even considering any codebase transformations that are intractable with the “edit and fix errors” approach? No, that’s too conservative. Instead, we just have to *avoid modifying our program in place*. This lets us make absolutely any codebase transformation while keeping the codebase compiling at all times. Here’s a procedure, it’s quite simple […] The technique is not presented as flawless, and interesting trade-offs are discussed. Quite an interesting article. -- \ “Science and religion are incompatible in the same sense that | `\ the serious pursuit of knowledge of reality is incompatible | _o__) with bullshit.” —Paul Z. Myers, 2010-03-14 | Ben Finney