Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #43465

Re: Functional vs. Object oriented API

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <chess@us.ibm.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.013
X-Spam-Evidence '*H*': 0.97; '*S*': 0.00; 'python.': 0.02; 'patterns': 0.04; 'static': 0.04; 'class,': 0.07; 'variables': 0.07; 'coding,': 0.09; 'python': 0.11; 'mostly': 0.14; 'data)': 0.16; 'hint': 0.16; 'received:9': 0.16; 'received:ibm.com': 0.16; 'roy': 0.16; 'screen,': 0.16; 'subject:API': 0.16; 'subject:Object': 0.16; 'subject:oriented': 0.16; 'written.': 0.16; 'do.': 0.18; 'trying': 0.19; 'passing': 0.19; 'later': 0.20; 'coding': 0.22; 'either.': 0.24; 'skip:l 30': 0.24; 'header:Received:8': 0.24; 'initial': 0.24; 'java': 0.24; 'looks': 0.24; 'question': 0.24; "i've": 0.25; '&gt;': 0.26; 'class.': 0.26; 'header:In-Reply-To:1': 0.27; 'said,': 0.30; 'code': 0.31; 'bunch': 0.31; 'hacker': 0.31; 'class': 0.32; 'probably': 0.32; '(i.e.': 0.33; 'style': 0.33; 'noticed': 0.34; 'maybe': 0.34; 'could': 0.34; 'classes': 0.35; 'but': 0.35; 'really': 0.36; 'bought': 0.36; 'c++': 0.36; 'data,': 0.36; 'done,': 0.36; 'method': 0.36; 'charset:us-ascii': 0.36; 'being': 0.38; 'problems': 0.38; 'initially': 0.38; 'somebody': 0.38; 'to:addr :python-list': 0.38; 'to:addr:python.org': 0.39; 'even': 0.60; 'around.': 0.60; 'wonderful': 0.60; 'interview': 0.61; "you're": 0.61; 'real': 0.63; 'our': 0.64; 'more': 0.64; 'worth': 0.66; 'here': 0.66; 'subject:. ': 0.67; 'smith': 0.68; 'behavior': 0.77; 'yourself': 0.78; 'applicants': 0.83; 'functions)': 0.84; 'giveaway': 0.84; 'investment.': 0.84; 'lately,': 0.84; 'now...': 0.84; 'regret': 0.91
In-Reply-To <roy-E3B2B9.10194712042013@news.panix.com>
References <mailman.429.1365635789.3114.python-list@python.org> <51678b94$0$29977$c3e8da3$5496439d@news.astraweb.com> <roy-E3B2B9.10194712042013@news.panix.com>
To python-list@python.org
MIME-Version 1.0
Subject Re: Functional vs. Object oriented API
X-KeepSent B257D553:80BBC057-85257B4B:00557AED; type=4; name=$KeepSent
X-Mailer Lotus Notes Release 8.0.2 HF623 January 16, 2009
From David M Chess <chess@us.ibm.com>
Date Fri, 12 Apr 2013 11:37:28 -0400
X-MIMETrack Serialize by Router on D01ML605/01/M/IBM(Release 9.0|February 24, 2013) at 04/12/2013 11:37:30 AM, Serialize complete at 04/12/2013 11:37:30 AM
Content-Type multipart/alternative; boundary="=_alternative 0055D40785257B4B_="
X-TM-AS-MML No
X-Content-Scanned Fidelis XPS MAILER
x-cbid 13041215-7182-0000-0000-000006366931
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.527.1365781666.3114.python-list@python.org> (permalink)
Lines 108
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1365781667 news.xs4all.nl 2664 [2001:888:2000:d::a6]:42620
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:43465

Show key headers only | View raw


[Multipart message — attachments visible in raw view] - view raw

> Roy Smith <roy@panix.com> 

> As part of our initial interview screen, we give applicants some small 
> coding problems to do.  One of the things we see a lot is what you could 

> call "Java code smell".  This is our clue that the person is really a 
> Java hacker at heart who just dabbles in Python but isn't really fluent. 
 
> ...
> It's not just LongVerboseFunctionNamesInCamelCase().  Nor is it code 
> that looks like somebody bought the Gang of Four patterns book and is 
> trying to get their money's worth out of the investment.  The real dead 
> giveaway is when they write classes which contain a single static method 

> and nothing else.

I may have some lingering Java smell myself, although I've been working 
mostly in Python lately, but my reaction here is that's really I don't 
know "BASIC smell" or something; a class that contains a single static 
method and nothing else isn't wonderful Java design style either.

> That being said, I've noticed in my own coding, it's far more often that 

> I start out writing some functions and later regret not having initially 

> made it a class, than the other way around.  That's as true in my C++ 
> code as it is in my Python.

Definitely.

> Once you start having state (i.e. data) and behavior (i.e. functions) in 

> the same thought, then you need a class.  If you find yourself passing 
> the same bunch of variables around to multiple functions, that's a hint 
> that maybe there's a class struggling to be written.

And I think equally to the point, even if you have only data, or only 
functions, right now, if the thing in question has that thing-like feel to 
it :) you will probably find yourself with both before you're done, so you 
might as well make it a class now...

DC

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Functional vs. Object oriented API Max Bucknell <mpwb500@york.ac.uk> - 2013-04-11 00:16 +0100
  Re: Functional vs. Object oriented API Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-04-12 04:20 +0000
    Re: Functional vs. Object oriented API Roy Smith <roy@panix.com> - 2013-04-12 10:19 -0400
      Re: Functional vs. Object oriented API Mitya Sirenef <msirenef@lightbird.net> - 2013-04-12 10:29 -0400
      Re: Functional vs. Object oriented API David M Chess <chess@us.ibm.com> - 2013-04-12 11:37 -0400
        Re: Functional vs. Object oriented API 88888 Dihedral <dihedral88888@googlemail.com> - 2013-04-12 22:25 -0700
        Re: Functional vs. Object oriented API 88888 Dihedral <dihedral88888@googlemail.com> - 2013-04-12 22:25 -0700
  Re: Functional vs. Object oriented API Rui Maciel <rui.maciel@gmail.com> - 2013-04-13 09:51 +0100

csiph-web