Return-Path: X-Original-To: apmail-commons-dev-archive@www.apache.org Delivered-To: apmail-commons-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 14639951F for ; Fri, 16 Mar 2012 14:53:57 +0000 (UTC) Received: (qmail 18719 invoked by uid 500); 16 Mar 2012 14:53:56 -0000 Delivered-To: apmail-commons-dev-archive@commons.apache.org Received: (qmail 18617 invoked by uid 500); 16 Mar 2012 14:53:56 -0000 Mailing-List: contact dev-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Commons Developers List" Delivered-To: mailing list dev@commons.apache.org Received: (qmail 18609 invoked by uid 99); 16 Mar 2012 14:53:56 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 16 Mar 2012 14:53:56 +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: domain of gudnabrsam@gmail.com designates 209.85.161.171 as permitted sender) Received: from [209.85.161.171] (HELO mail-gx0-f171.google.com) (209.85.161.171) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 16 Mar 2012 14:53:50 +0000 Received: by ggcs5 with SMTP id s5so5210546ggc.30 for ; Fri, 16 Mar 2012 07:53:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:reply-to:in-reply-to:references:date:message-id :subject:from:to:content-type:content-transfer-encoding; bh=FopGqRJq+mde5/CH7+/NBoUPvQ43qUrYPYSKbe5qR8U=; b=XQA+R/J7J4oRagpf2LakfOZNlDJlDPfVbCit1cNEce7BiUQ17izF2qSIIVFnaEOiqj kDmpi09rK4XSJ9LZkWsNiArhW9LKXdFZGgrHVsMf8i+AdfPrIcmyJPd9WiqjAnjS/B0g xiLtd38WydesAR7Xy+4wPAQZF68U71RP7P1usvTEnW0MNs7kTEzrbS2pY12Yldql6GmP 1UWx9Ea31SvAIQHF5NVN8pNEJDr92dJI5xNn+6pGQ3MEbkoWMMdfaffaMszMXjqh6Ev1 m857ZtHwSyI+D1ms9qE9tV/YleMrKT6UdLYe1gCzM5m7jaxOe0QgUZ7J9Cd4ZCnvOWzM K4KQ== MIME-Version: 1.0 Received: by 10.68.201.135 with SMTP id ka7mr15215504pbc.145.1331909609135; Fri, 16 Mar 2012 07:53:29 -0700 (PDT) Received: by 10.68.74.129 with HTTP; Fri, 16 Mar 2012 07:53:29 -0700 (PDT) Reply-To: gudnabrsam@gmail.com In-Reply-To: References: <4F61077E.3010003@apache.org> <4F610E94.4060609@apache.org> <4F624F10.3070406@apache.org> Date: Fri, 16 Mar 2012 09:53:29 -0500 Message-ID: Subject: Re: [csv] Why does CSVFormat provide a validate() method instead of validating parameters passed to its constructor? From: Matt Benson To: Commons Developers List Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org The votes show that several of us in the Commons community are leaning more and more toward fluent APIs these days. But rather than wasting time going back and forth arguing about it, why not build the fluent API separately from the rest of the package and leave the choice up to the user? I don't think I'm incorrect to say that this is more or less what [digester]3 does. Matt On Fri, Mar 16, 2012 at 7:34 AM, James Carman wrote: > +1 for builder pattern and fluent API > On Mar 16, 2012 4:24 AM, "Benedikt Ritter" > wrote: > >> Am 15. M=E4rz 2012 21:20 schrieb Emmanuel Bourg : >> > Le 15/03/2012 20:26, Benedikt Ritter a =E9crit : >> > >> > >> >> How about you Emmanuel? Could sebb convince you? ;-) How about this: >> >> I'll create a patch and attach it to JIRA. Then we'll have a better >> >> basis for discussion. >> > >> > >> > Sorry but I'm not convinced. I see exactly where this leads. >> > >> >> Hey Emmanuel, >> >> I accept that, and I respect your decision. I don't want to argue with >> you on this, I just want to understand your decision. From Effective >> Java, I learned "if you are facing a constructor with lots of optional >> arguments, consider using the builder pattern". Can you explain, why >> you think it is not appropriate in this case? You said it is too >> verbose, but it's just one additional call, compared with what we have >> now. >> >> The advantage of the builder (sorry now I'm arguing :) is, that nobody >> has to remember to validate the format. Even if validation is >> something that is package private, that could lead to the point where >> someone forgets to add that line. Now you could say we have unit tests >> for that. But isn't it the responsibility of an object to verify that >> it is being instantiated into a valid state? >> Also we don't know yet, if there always will be only one package in >> the library. What if, we add another package (o.a.c.csv.beanmapping or >> what ever) and we want to use CSVFormat there. Then we would have to >> make validate public, exposing it to the outside world. >> >> > If you have some free time and want to do something fun you can try >> > reimplementing the parser with less array copies. Commons CSV is still >> > behind the other APIs on the performance side. >> > >> >> I'll have a look at that, and at what Ted suggested on the other thread. >> >> TIA for taking your time to explain!! >> Benedikt >> >> > Emmanuel Bourg >> > >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org >> For additional commands, e-mail: dev-help@commons.apache.org >> >> --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org For additional commands, e-mail: dev-help@commons.apache.org