Return-Path: X-Original-To: apmail-incubator-flex-dev-archive@minotaur.apache.org Delivered-To: apmail-incubator-flex-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 6D5DE99B2 for ; Wed, 8 Feb 2012 15:33:58 +0000 (UTC) Received: (qmail 69064 invoked by uid 500); 8 Feb 2012 15:33:56 -0000 Delivered-To: apmail-incubator-flex-dev-archive@incubator.apache.org Received: (qmail 68565 invoked by uid 500); 8 Feb 2012 15:33:55 -0000 Mailing-List: contact flex-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: flex-dev@incubator.apache.org Delivered-To: mailing list flex-dev@incubator.apache.org Received: (qmail 68557 invoked by uid 99); 8 Feb 2012 15:33:55 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 08 Feb 2012 15:33:55 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [80.237.132.80] (HELO wp073.webpack.hosteurope.de) (80.237.132.80) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 08 Feb 2012 15:33:46 +0000 Received: from p4aa831.osaknt01.ap.so-net.ne.jp ([120.74.168.49] helo=[192.168.1.21]); authenticated by wp073.webpack.hosteurope.de running ExIM with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) id 1Rv9WP-0003Am-LX; Wed, 08 Feb 2012 16:33:25 +0100 Message-ID: <4F3295BD.5080503@leichtgewicht.at> Date: Thu, 09 Feb 2012 00:33:17 +0900 From: Martin Heidegger User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:10.0) Gecko/20120129 Thunderbird/10.0 MIME-Version: 1.0 To: flex-dev@incubator.apache.org Subject: Re: [RT] From Singletons to Unit-testable code References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-bounce-key: webpack.hosteurope.de;mh@leichtgewicht.at;1328715226;b9ddaa45; X-Virus-Checked: Checked by ClamAV on apache.org On 08/02/2012 23:45, Alex Harui wrote: > My simple mind just can't understand why we need a sophisticated multi-step > plan or full dependency injection. Why can't a simpler substitution pattern > do the job? The complexity always comes with the detail. I assume one could summarize it with: Move the static constructs to a service locator to implement unit tests and replace it step by step to get a injectable source code. I broke the refactoring up in many steps to illustrate that this way will be constantly tested from step 2. Michaels approach as well as your approach will most likely be more complex in reality than summarized. For example: Modifying the compiler, creating an AOP mechanism and then changing all code to follow that pattern is a huge project. where each part has to be tested. I am curious about the "simpler substitution": How would you do that in detail? yours Martin.