Path: csiph.com!news.redatomik.org!aioe.org!.POSTED!not-for-mail From: Kaz Kylheku <686-678-9105@kylheku.com> Newsgroups: comp.programming Subject: Re: Function naming scheme Date: Wed, 19 Apr 2017 19:25:09 +0000 (UTC) Organization: Aioe.org NNTP Server Lines: 24 Message-ID: <20170419121533.114@kylheku.com> References: NNTP-Posting-Host: hlQwqVQo951TVKyinY4JRg.user.gioia.aioe.org X-Complaints-To: abuse@aioe.org User-Agent: slrn/pre1.0.0-18 (Linux) X-Notice: Filtered by postfilter v. 0.8.2 Xref: csiph.com comp.programming:7723 On 2017-04-19, Victor Porton wrote: > I have two sets of similar (for pairings of functions from the different > sets) functions: one for single orders and one for basket orders. How about: an order contains a list of items. When that list is length 1, we call it a single order; when it's two or more, we call it a basket order. Then we don't need a separate type, with repeated boiler-plate code that is almost the same except for handling a list versus one item. > Should I name the functions like ProcessOrder/ProcessOrderBasket or > ProcessOrderSingle/ProcessOrderBasket? I'd use a programming language in which I can have polymorphic function or method called "process", which can work on objects of various types. order.process(); // process the order: any kind of order cheese.process(); // process the cheese; totally different -- TXR Programming Lanuage: http://nongnu.org/txr Music DIY Mailing List: http://www.kylheku.com/diy ADA MP-1 Mailing List: http://www.kylheku.com/mp1