From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Yuri Khan Newsgroups: gmane.emacs.help Subject: Re: Seeking Advice about refactoring and advice snippet Date: Fri, 10 Feb 2017 20:08:19 +0700 Message-ID: References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1486735816 29779 195.159.176.226 (10 Feb 2017 14:10:16 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 10 Feb 2017 14:10:16 +0000 (UTC) Cc: Help Gnu Emacs mailing list To: Filipe Silva Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Feb 10 15:10:13 2017 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ccBtr-0007Iz-GT for geh-help-gnu-emacs@m.gmane.org; Fri, 10 Feb 2017 15:10:11 +0100 Original-Received: from localhost ([::1]:44047 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ccBtx-0002z9-3y for geh-help-gnu-emacs@m.gmane.org; Fri, 10 Feb 2017 09:10:17 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:46375) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ccAwN-0005UU-Mr for help-gnu-emacs@gnu.org; Fri, 10 Feb 2017 08:08:44 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ccAwM-0007lk-LZ for help-gnu-emacs@gnu.org; Fri, 10 Feb 2017 08:08:43 -0500 Original-Received: from mail-wr0-x230.google.com ([2a00:1450:400c:c0c::230]:34907) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ccAwM-0007kc-Eu for help-gnu-emacs@gnu.org; Fri, 10 Feb 2017 08:08:42 -0500 Original-Received: by mail-wr0-x230.google.com with SMTP id 89so107532966wrr.2 for ; Fri, 10 Feb 2017 05:08:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-transfer-encoding; bh=uleIk9ATuNtbg9RSCAuAt+cGaBtjPEsVE+Bg+Yx3sEU=; b=Ba53PCya/r0zNVNztrVlwoqbaJ82UpTyUtK7K8oKORKh+hI3J296UCt9YLOn33xX8x oliByZx9aL87T3jGNQV5VPQHz8zejby9cl4qWjTRHJ3wRtAS/fL1c5pMa6ilTGIl1Z9+ +Jwf+00JdCc6kB2ByWnvwLPhK5h4h3Tr3d12ey6SFqkoXMIuLhk97vNvrBZce3zTZikk 0aYaie6uG9sm5FMkLj7q4oVtYEEDDG9RsDi+ctPHY3cinkwak7hQhOm59ss7Qdfx4aOp jI1dg0vTTHk4zrA1hqMIIIDM0q88C/ViGeqnHcmeGXpsh8bslyoI2HwXQc+uAzm2dPuq 8VWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc:content-transfer-encoding; bh=uleIk9ATuNtbg9RSCAuAt+cGaBtjPEsVE+Bg+Yx3sEU=; b=qRg47qCJStOUkHe0EdhBjEId7PbrxNoPxekT9ZxOOCykQSZFkHKogKhP0/1b06ExQX Wjt+Lv0hNygu/imsU9+Y+r7wvBckcErQjzA5P/0Gzdepu6pDEassVKPl5p7AYDptx4Fj OF/QdDHhIxPIxo8j490IfuZZTj1SjLgMZVbwWGdvgR+uMnTEWcdAb42ACGMkdO0clq4x 2GcBTllsPCIf1GW3Qse3182jwUnxYnGr+I0nLNO+Ckzra4oOVxLvmR9z8+YkXDC3hOlC jeZKA9TJ18/4yHJx3QyxH9GrsWExZFWDTzI4lBvtpuEdau61FVOo0h3tbNZu5Jr0PoWO Tz6A== X-Gm-Message-State: AMke39muDbuouxXlfljZ9t0VirJxXgJ1eFCRT3CrKvSwsdBoiFSEzS8T9O1NqDOx640KlGY2brRU2yGzfLlGRw== X-Received: by 10.223.136.155 with SMTP id f27mr7484837wrf.98.1486732119801; Fri, 10 Feb 2017 05:08:39 -0800 (PST) Original-Received: by 10.223.142.230 with HTTP; Fri, 10 Feb 2017 05:08:19 -0800 (PST) In-Reply-To: X-Google-Sender-Auth: qxaxZRZt2ZM99BVpTyIIGleuEY8 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c0c::230 X-Mailman-Approved-At: Fri, 10 Feb 2017 09:09:24 -0500 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:112290 Archived-At: On Fri, Feb 10, 2017 at 6:43 PM, Filipe Silva wrot= e: > The problem is that these lines: > > (message "DENIED! don't kill my precious *scratch*!!") > (apply buffer-assassin arguments)))) > > Are repeated in both functions, so I thought that I could apply the DRY > principle I cannot say anything useful regarding your approach, but I can=E2=80=99t h= elp noticing that you are trying to reduce duplication of two lines in two functions. This is not likely to help maintainability significantly. In Extreme Programming circles, there is a principle called Three Strikes And You Refactor, which says that you only have enough data for a meaningful refactoring when you see three instances of the same pattern. Until you encounter that third instance, you could follow the WET principle instead: Write Everything Twice :)