Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > PyWart (Terminolgy): "Class"

Reply
Thread Tools

PyWart (Terminolgy): "Class"

 
 
Rick Johnson
Guest
Posts: n/a
 
      01-14-2013

I have believed for a very long time that "class" was a poor choice of keyword to designate an "object definition".

Firstly, the word /class/ does not transform smoothly into CS from English.NO English definition of "class" comes anywhere close to describing the "structured source code that defines an object". Or even generally as: "something that defines something else". You could try to hammer "classification" into the round hole, but you soon find out it's just a damn square peg!

Secondly, "class" is confusing to newbies. How can someone understand the fundamentals of OOP (which defines objects and interfaces) when they are asked to write classes? (teacher "Okay /class/, we are going to create a new object by writing a class." (student HUH?

Thirdly, once people *DO* understand that a "class" is simply an "object definition", they still go on to say idiotic things like: "Classes are objects"! It is obvious these people are a victim of their own terminology.

================================================== ==========
Other possible terms include:
================================================== ==========

"subclass":
Since every "user defined object" *must* subclass /something/, using this word would infer such a relationship to the reader. HOWEVER, we would then need to differentiate the general usage of "subclass" (as in: an object that is an extension of another object) from a "user defined subclass" (as in: source code). In any event, "subclass" is a good contender. He's going to the 12th round for sure.

"template":
This term is very close, but still lacking a concrete relationship between source code (definition of object) and the resulting "thing" living in memory (object). I think this one is TKO in round 3.

"object":
This is my favorite word however it does suffer a "verbial" disconnection. What are we suggesting? A single word can be very ambiguous as to intent. However, if we couple the word "object" with the word "define" we then inject intent. "define object" on it's face is perfect! We know everything we need to know. 1) We are defining "something" and 2) that *THAT* "something" is an object! YAY!

Now since "methods" and "functions" (PyWart on these terms coming soon!) require defining, the syntax will now be symmetrical (omitting for now that funcs/meths only use "def"!). However we could drop the "def" and use only "object" to save a few keystrokes and a lot of pyparsing.

I am sure the main arguments against such a clear and logical syntax would be that we would confuse "object definitions" with "real live objects" in normal conversation. But i say that is non-sense because we NEED to be more specific when conversing anyway. Choosing a word like "class" just because we don't want to use two words to refer to "source code that defines an object" (in conversation) is ridiculous. This syntax will inject specificity into our communications and convey meaning more appropriately.

Dear language designers: Stop propagating such foolish terminology! End theinfection of "class" in all source code, docs, and daily conversation. Be more consistent and logical. Resist temptation to use poor terminology simply because other languages have done so before you. Grow a pair already!

 
Reply With Quote
 
 
 
 
Chris Angelico
Guest
Posts: n/a
 
      01-14-2013
On Mon, Jan 14, 2013 at 5:46 PM, Rick Johnson
<(E-Mail Removed)> wrote:
> Dear language designers: Stop propagating such foolish terminology! End the infection of "class" in all source code, docs, and daily conversation. Be more consistent and logical. Resist temptation to use poor terminology simply because other languages have done so before you. Grow a pair already!


Absolutely. We should learn from Lars Pensj÷ and start referring to
"blueprint objects" and "clones". Or take the updated version and call
them "programs" and "objects". I'm sure that'll make a huge amount
more sense than using the terms that millions of programmers already
understand.

Alternatively, we could take the Humpty Dumpty approach and assign
meanings to names arbitrarily. But wait till Saturday night when they
come for their wages.

ChrisA
 
Reply With Quote
 
 
 
 
Rick Johnson
Guest
Posts: n/a
 
      01-14-2013
On Monday 1-14-2013 at 12:46 AM, Rick Johnson wrote:
> [...]
> "object":
>
> This is my favorite word however it does suffer a
> "verbial" disconnection. What are we suggesting? A single
> word can be very ambiguous as to intent. However, if we
> couple the word "object" with the word "define" we then
> inject intent. "define object" on it's face is perfect!


I just had an epiphany of sorts.

I really don't like using two words ("define object", or "def obj") and using one single keyword is ambiguous ("object" or "obj"). So the obvious solution is to combine the abbreviated words into one compound keyword that will save keystrokes, save parsing, and all-the-while maintain symmetry. That keyword is "defobj". Coupled with "defmeth" and "deffunc" we now have a symmetrical definition syntax!

deffunc bar():
return

defobj Foo():
defmeth __init__(self, blah):
pass

Extra Credit: Can anyone think of a better solution for defining objects without using keywords at all? Hmm... I'm getting a chubby just thinking about it!
 
Reply With Quote
 
Chris Angelico
Guest
Posts: n/a
 
      01-14-2013
On Mon, Jan 14, 2013 at 6:32 PM, Rick Johnson
<(E-Mail Removed)> wrote:
> I really don't like using two words ("define object", or "def obj") and using one single keyword is ambiguous ("object" or "obj"). So the obvious solution is to combine the abbreviated words into one compound keyword that will save keystrokes, save parsing, and all-the-while maintain symmetry. That keyword is "defobj". Coupled with "defmeth" and "deffunc" we now have a symmetrical definition syntax!
>
> deffunc bar():
> return
>
> defobj Foo():
> defmeth __init__(self, blah):
> pass


Awesome! Now, just one more step to make Python into the World's Most
Awesome Language(tm): Replace those lengthy words with single symbols
found in the Unicode set; compress everything down and enforce perfect
Unicode handling. Also, demand that names be one character long, to
enforce creativity by the Mark Rosewater principle. We will then have
a truly wonderful language; everything will be so utterly readable.

ChrisA
 
Reply With Quote
 
Tim Chase
Guest
Posts: n/a
 
      01-14-2013
On 01/14/13 01:56, Chris Angelico wrote:
> On Mon, Jan 14, 2013 at 6:32 PM, Rick Johnson
> <(E-Mail Removed)> wrote:
>> I really don't like using two words ("define object", or "def obj") and using one single keyword is ambiguous ("object" or "obj"). So the obvious solution is to combine the abbreviated words into one compound keyword that will save keystrokes, save parsing, and all-the-while maintain symmetry. That keyword is "defobj". Coupled with "defmeth" and "deffunc" we now have a symmetrical definition syntax!
>>
>> deffunc bar():
>> return
>>
>> defobj Foo():
>> defmeth __init__(self, blah):
>> pass

>
> Awesome! Now, just one more step to make Python into the World's Most
> Awesome Language(tm): Replace those lengthy words with single symbols
> found in the Unicode set; compress everything down and enforce perfect
> Unicode handling.


APL will rise to linguistic domination! ┬źmaniacal laughter┬╗

-tkc




 
Reply With Quote
 
Steven D'Aprano
Guest
Posts: n/a
 
      01-14-2013
On Sun, 13 Jan 2013 22:46:44 -0800, Rick Johnson wrote:

> I have believed for a very long time that "class" was a poor choice of
> keyword to designate an "object definition".
>
> Firstly, the word /class/ does not transform smoothly into CS from
> English. NO English definition of "class" comes anywhere close to
> describing the "structured source code that defines an object". Or even
> generally as: "something that defines something else".



Your knowledge of English has failed you. Here is the first definition
from Webster's Dictionary (1913 edition):


Class \Class\ (kl[.a]s), n. [F. classe, fr. L. classis class,
collection, fleet; akin to Gr. klh^sis a calling, kalei^n to
call, E. claim, haul.]
1. A group of individuals ranked together as possessing
common characteristics; as, the different classes of
society; the educated class; the lower classes.
[1913 Webster]


And definitions 3 and 4:


3. A comprehensive division of animate or inanimate objects,
grouped together on account of their common
characteristics, in any classification in natural science,
and subdivided into orders, families, tribes, genera, etc.
[1913 Webster]

4. A set; a kind or description, species or variety.
[1913 Webster]


"Class" is an excellent ordinary English word to describe what computer
science calls a "class".



> Thirdly, once people *DO* understand that a "class" is simply an "object
> definition", they still go on to say idiotic things like: "Classes are
> objects"!


Your knowledge of Python has failed you.

Classes are objects in Python, although not in all other languages.

Classes are created at runtime, not compile time. They have an id, like
all instances. They have a __class__ attribute, like all instances. They
have a type, like all instances. They *are* instances.

py> class Spam(object):
.... pass
....
py> id(Spam)
168149924
py> isinstance(Spam, type)
True


> It is obvious these people are a victim of their own terminology.


You're very funny.


> "subclass":
> Since every "user defined object" *must* subclass /something/,


Only in Python 3. In Python 2, some classes are not subclasses.

py> class OldStyleClass:
.... pass
....
py> OldStyleClass.__bases__
()


> "template":
> This term is very close, but still lacking a concrete relationship
> between source code (definition of object) and the resulting "thing"
> living in memory (object). I think this one is TKO in round 3.


A template is certainly not correct for class-based OOP languages like
Python, since it implies *copying*. It might be more appropriate for
prototype-cased OOP languages like Javascript.


[...]
> Now since "methods" and "functions" (PyWart on these terms coming soon!)


Oh I can barely contain my excitement.


--
Steven
 
Reply With Quote
 
Tim Chase
Guest
Posts: n/a
 
      01-14-2013
On 01/14/13 11:26, Steven D'Aprano wrote:
> Your knowledge of English has failed you. Here is the first definition
> from Webster's Dictionary (1913 edition):
>
>
> Class \Class\ (kl[.a]s), n. [F. classe, fr. L. classis class,
> collection, fleet; akin to Gr. klh^sis a calling, kalei^n to
> call, E. claim, haul.]
> 1. A group of individuals ranked together as possessing
> common characteristics; as, the different classes of
> society; the educated class; the lower classes.
> [1913 Webster]



Clearly Python should use a keyword like "Kingdom" or "Phylum"
instead. I guess "Kingdom" should be reserved for metaclasses (or
would they be metaphylums? or metaphyla?)

kingdom Baz:
pass

phylum Foo:
__metaphylum__ = Baz

That is SO much clearer

-tkc




 
Reply With Quote
 
Dennis Lee Bieber
Guest
Posts: n/a
 
      01-14-2013
On Mon, 14 Jan 2013 18:56:08 +1100, Chris Angelico <(E-Mail Removed)>
declaimed the following in gmane.comp.python.general:

> Awesome! Now, just one more step to make Python into the World's Most
> Awesome Language(tm): Replace those lengthy words with single symbols
> found in the Unicode set; compress everything down and enforce perfect
> Unicode handling. Also, demand that names be one character long, to
> enforce creativity by the Mark Rosewater principle. We will then have
> a truly wonderful language; everything will be so utterly readable.
>


<shudder> The offspring of a wild night between LISP and APL?

"World's Most Awesome Language"... World's MAL... "mal" being French
for "sickness"...
--
Wulfraed Dennis Lee Bieber AF6VN
http://www.velocityreviews.com/forums/(E-Mail Removed) HTTP://wlfraed.home.netcom.com/

 
Reply With Quote
 
Peter
Guest
Posts: n/a
 
      01-14-2013
Real mature lot of responses here guys - shows how much you have grown up.

Reading this thread looked more like observing a bunch of 3rd grader - somebody offers an opinion and all you can do is ridicule it?

Real mature - certainly gives Python a good name having followers like this...

But then I guess I will cop flack for this rejoinder too...
 
Reply With Quote
 
Peter
Guest
Posts: n/a
 
      01-14-2013
Real mature lot of responses here guys - shows how much you have grown up.

Reading this thread looked more like observing a bunch of 3rd grader - somebody offers an opinion and all you can do is ridicule it?

Real mature - certainly gives Python a good name having followers like this...

But then I guess I will cop flack for this rejoinder too...
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
PyWart: PEP8: A cauldron of inconsistencies. rantingrick Python 7 07-30-2011 05:04 PM
PyWart: PEP8: a seething cauldron of inconsistencies. rantingrick Python 1 07-29-2011 12:29 AM
[PyWart 1001] Inconsistencies between zipfile and tarfile APIs rantingrick Python 20 07-23-2011 12:31 AM
[PyWart 1001] Inconsistencies between zipfile and tarfile APIs rantingrick Python 0 07-22-2011 03:46 AM



Advertisments