The Artima Developer Community
Sponsored Link

Weblogs Forum
The departure of the hyper-enthusiasts

262 replies on 18 pages. Most recent reply: Dec 20, 2006 11:11 AM by Carlos Neves

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 262 replies on 18 pages [ « | 1 2 3 4 5 6 7 8 9 ... 18  | » ]
Kay Schluehr

Posts: 302
Nickname: schluehk
Registered: Jan, 2005

Re: The departure of the hyper-enthusiasts Posted: Dec 19, 2005 9:37 PM
Reply to this message Reply
Advertisement
> Here is a quick question to make the case that Python is
> not really OO, then: why do I need to pass "this" (sorry,
> "self") to each method?

http://zephyrfalcon.org/weblog/arch_d7_2003_07_12.html#e283

the metapundit

Posts: 3
Nickname: metapundit
Registered: Dec, 2005

Re: The departure of the hyper-enthusiasts Posted: Dec 19, 2005 11:25 PM
Reply to this message Reply
> > Here is a quick question to make the case that Python
> is
> > not really OO, then: why do I need to pass "this"
> (sorry,
> > "self") to each method?

Fair disclosure: I'm not a pythonista or rubyist yet. Most of my work is in PHP and I'm eyeing both/either languages as possible upgrades. Currently python feels more *natural* to me, although I realise that this is an aesthetic preference that may be purely personal...

That said, I was struck early on by the oddness of accepting self in method declarations (you don't have to pass it; it is declared only in the def, not in the argument list of a method call) and python rightly passes self automatically when you call an object member function. Coming from oop via C++ I didn't understand why this wasn't just automatically available and googled for a reason. Very reasonably, somebody on a mailing list (see http://www.python.org/tim_one/000152.html) explains that methods of classes in python are just functions (that could be dynamically added) and so self is not a reserved word but just the convention that the first argument to a method is a reference to the instance. Methods are not any different than functions and this allows for easily adding functions to an object...

Brian Takita

Posts: 1
Nickname: btakita
Registered: Sep, 2003

Re: The departure of the hyper-enthusiasts Posted: Dec 19, 2005 11:30 PM
Reply to this message Reply
I tried Python before I tried Ruby. The syntax just wasn't clear. It seemed like Object Orientation was hacked onto a procedural language.

When I first tried Ruby, I was amazed by how elegant the syntax was and how Ruby's Object Orientation seems to be built in from the ground up.

Kay Schluehr

Posts: 302
Nickname: schluehk
Registered: Jan, 2005

Re: The departure of the hyper-enthusiasts Posted: Dec 19, 2005 11:42 PM
Reply to this message Reply
> I highly recommend skimming thru these short resources to
> get a much more in depth feel for what ruby is like, if
> you are already familiar with java or python like myself.
> I did recently and I am finally "getting" ruby much
> h better (the perl-isms turned me off from seriously
> looking at it earlier, just like it took me a year to get
> over python's indenting)

Does that mean you will not polute the Python newsgroup with boo announcements in future but spent your time trying proselyte Rubys?

That's really good news - at least for Pythonistas. Now only Xah Lee has to follow. On the other hand programming language cranks can be entertaining sometimes...

hannes häyrinen

Posts: 1
Nickname: hannes2
Registered: Dec, 2005

Re: The departure of the hyper-enthusiasts Posted: Dec 20, 2005 12:06 AM
Reply to this message Reply
> > Maybe for you Python is cleaner, but to me Python is
> > harder than Ruby when I try to read the code. Ruby has
> a
> > nice convention of "CamelCase", "methods_names",
> > "AClass.new", etc, that make the code easier to read
> than
> > a similar Python code, because in Python you don't
> have a
> > good convention for that
.
>
> Either you don't like the conventions set by PEP 8 (
> http://www.python.org/peps/pep-0008.html ) and PEP 257 (
> http://www.python.org/peps/pep-0257.html ), or you didn't
> even bother looking for python style guidelines before
> bashing Python on this.
>
> Which one is it?

Maybe that applies to those who develop Python standard library as well.

E.g. "Like modules, Python packages should have short, all-lowercase names, without underscores."
What about "StringIO", "cStringIO", "ConfigParser"?

Or "Almost without exception, class names use the CapWords convention."
But then we have classes "datetime" (and other classes in datetime package), "shlex", "zipimporter".. "True" and "False" are objects of type "bool", now that is completely backwards.

What's the use of guidelines if they're not followed? I'm not a Ruby programmer but I believe it enforces the CapWords syntax for classes. Maybe other conventions are also more enforced in Ruby camp. I consider that a good thing.

And then I just dislike a lot of Python's letswritesentenceasasinglewordconvention. "toordinal", "utcfromtimestamp", etc. Yuck.

Peter Booth

Posts: 62
Nickname: alohashirt
Registered: Aug, 2004

Re: The departure of the hyper-enthusiasts Posted: Dec 20, 2005 4:59 AM
Reply to this message Reply
Pulling the discussion back from the languages onto the people. I have respect and gratitude for both Bruce and Bruce. Years ago when I was struggling through Stroustrup Eckel's Thinking in C++ crystallized the conccrete "how do I get this done in C++" lessons for me, and it's logical, straightfroward presentation allowed me to clarify that my challenge wasn't that C++ books sucked but that I simply didn't like the language. Years later as a Java bigot I was puzzled by the number of Java projects I kept seeing that had all the ingredients of success yet produced enormous, verbose spaghetti applications that were hampered by multithreading excessive String operations and plain old bloat. I couldn't grok why smart people used this powerful technoilogy to write such crap applications. Tate's "Bitter Java" crystallized a bunch of my concerns and came at just teh right time. Bruce is correct that we need the earlty adopters, the pragmatists, the skeptics, and the rest.

leouser leouser

Posts: 9
Nickname: leouser
Registered: Dec, 2005

Re: The departure of the hyper-enthusiasts Posted: Dec 20, 2005 6:20 AM
Reply to this message Reply
I don't get why people think Python doesn't have OO suport. I write classes in it and I subclass in it. So where does that fall short? You mean 'self' ruins it? Though not as silly as enforced whitespace ruins the language, it seems somewhat silly.

leouser

Kay Schluehr

Posts: 302
Nickname: schluehk
Registered: Jan, 2005

Re: The departure of the hyper-enthusiasts Posted: Dec 20, 2005 7:10 AM
Reply to this message Reply
> I don't get why people think Python doesn't have OO
> suport. I write classes in it and I subclass in it. So
> where does that fall short? You mean 'self' ruins it?
> Though not as silly as enforced whitespace ruins the
> e language, it seems somewhat silly.
>
> leouser

It's an anachronism. Until Python 2.2 introduced "new style classes" it has not been possible to inherit from builtin types like int, float, str, dict, tuple and list. Those were "types" not classes. The distinction has become obsolete since then [1]. Before Python 2.2. wrapper classes had to be used. They are still available in the stdlib and you can identify them looking for UserDict, UserList etc.

[1] http://www.python.org/2.2.3/descrintro.html

Mike Pence

Posts: 2
Nickname: mikepence
Registered: Dec, 2005

Re: The departure of the hyper-enthusiasts Posted: Dec 20, 2005 9:15 AM
Reply to this message Reply
Bruce,

I have enjoyed your books and sessions at the Borland conferences and argued strenuously as a member of the Delphi community for some of the functional programming constructs that make other languages so powerful to find their way into Object Pascal. (Some of this has actually come to fruition in Chrome, but that is another story.) I've done my share of Java, Visual Basic (eye roll) and Lingo, and started with FoxPro in the early 90's.

My point is that I have been doing this -- developing professionally in various languages -- for over 15 years. Frankly, I had become sick of it, but Ruby and Rails showed me that programmatic logic can be succinct, even elegant. I am more a writer at heart than a programmer, so expressiveness is very important to me. That ability to be elegant, more than anything else, has rekindled my enthusiasm for programming. I just finished my first Rails app, and am beginning my second. I even started a project to marry OpenLaszlo and Rails, to create truly rich net apps. I haven't been this excited about development since I first read Booch and really *got* OOP, or discovered Delphi. Or maybe since those first plaintive strokes on the big grey keyboard of that TRS-80 when was I was 11.

So, come on in. The water is fine. We may seem to be playing with a bit too much enthusiasm, but it is all good. Even us old guys are in on the fun. Write yourself a Rails app or two and get out of your denial. We may be misfits, we enthusiasts, but we are also the agents of change.

Alex Bunardzic

Posts: 546
Nickname: alexbunard
Registered: Oct, 2005

Re: The departure of the hyper-enthusiasts Posted: Dec 20, 2005 9:56 AM
Reply to this message Reply
"On the other hand, I'll bet that list was one of the first library classes that Matz wrote. You can find plenty of methods and classes in Java 1.0 that appear to be amateurish additions, as well."

Looks to me like the jist of the disconnect lies in Bruce's use of the word amateurish. We're now staring at a chasm that is gaping wide between the professional developers and the amateur developers.

It is a huge, unbridgeable chasm. Bruce seems proud to count himself among the professional crowd. We, the Rubyists, are proud to be partaking in the amateurish camp. Will the twain never meet?

What's the difference between a professional and an amateur? A professional is someone who professes certain way of doing things (usually, it's a prescribed way of doing something). What that means is that there usually is one, and only one proper way of doing something. This ensures consistency and predictability, so that everyone can sleep soundly at night.

An amateur, on the other hand, is someone who loves what they are doing. And once you love the thing you are doing, naturally there will be countless ways to do it. Making love would not be attractive at all if there was one, and only one proper way of doing it.

So we see that the bureaucratic approach to software development despises amateurism, because bureaucrats are extremely uncomfortable with the notion that there could be more than one way of doing something. Java was embraced by the huge bureaucracies precisely because it was anti-amateurish. Java is all about prescribed ways of doing things, and that is the pure essence of bureaucratic mindset.

Now, my thesis is that it is impossible to love bureaucracy. Yes, we can resign to it, view it as a necessary evil, but I've never met a person who is really, truly in love with bureaucracy. They may be in love with something bureaucracy may propose to bring to the fore, like control, power, security. But the actual bureaucratic mechanism that enables the control, the power, is impossible to love.

That's why I'm truly sceptical whenever someone tells me that they love Java. I suspect that it is the control, the power and the security that Java proposes to bring into their lives that they fall for. But the rigid, one-and-only-one way of doing things properly, that is the essence of Java, C#, and all the other corporate sweetheart languages, offer nothing to be in love with.

Anyone who is capable of overcoming the fear of losing control, losing security, and who then tries the amateurish things, such as Ruby, invariably falls in love with it. I'm not talking hot air here -- witness the huge crowds of Ruby converts (just peruse this thread to see some heart warming confessions of the former bureaucrats who discovered Ruby). All these people have only emotion-drenched words of amazement for Ruby.

This is not an accident -- people really and truly want to be able to enjoy what they do eight hours a day.

Cedric Beust

Posts: 140
Nickname: cbeust
Registered: Feb, 2004

Re: The departure of the hyper-enthusiasts Posted: Dec 20, 2005 10:14 AM
Reply to this message Reply
> > Here is a quick question to make the case that Python
> is
> > not really OO, then: why do I need to pass "this"
> (sorry,
> > "self") to each method?
>
> http://zephyrfalcon.org/weblog/arch_d7_2003_07_12.html#e283

That answer is missing the point. The correct way to solve it is to write "this.x = 42", which you can do in any real OO language since they all define "this" implicitly.

Of course, you can't do that in Python and you need to declare it explicitly (you can even choose whatever name you want to call it, which makes things worse).

Even worse: in Python you declare your methods with, for example, three parameters (self being the first one), but you only invoke them with two arguments.

Sorry, that's not OO to me and very confusing.

And don't get me started on all these weird __ reserved methods, public/private visibility, static methods, etc...

--
Cedric

leouser leouser

Posts: 9
Nickname: leouser
Registered: Dec, 2005

Re: The departure of the hyper-enthusiasts Posted: Dec 20, 2005 10:51 AM
Reply to this message Reply
OO is about classes and objects, inheritence, polymorphism

'self' does not disqualify Python as a OO language. Find another reason to say its not OO please. :D

On the other hand 'self' can be annoying, but then again with functions and methods it certainly clarifies what beast your working with when reading it. Hmm... this isolate piece of code says 'self', its a method. Though the user could just have put 'self' into it....

leouser

Kay Schluehr

Posts: 302
Nickname: schluehk
Registered: Jan, 2005

Re: The departure of the hyper-enthusiasts Posted: Dec 20, 2005 10:58 AM
Reply to this message Reply
> > > Here is a quick question to make the case that Python
> > is
> > > not really OO, then: why do I need to pass "this"
> > (sorry,
> > > "self") to each method?
> >
> >
> http://zephyrfalcon.org/weblog/arch_d7_2003_07_12.html#e283
>
>
> That answer is missing the point. The correct way to
> solve it is to write "this.x = 42", which you can do in
> any real OO language since they all define "this"
> implicitly.
>
> Of course, you can't do that in Python and you need to
> declare it explicitly (you can even choose whatever name
> you want to call it, which makes things worse).

Ah, you ask for explicit passing of self as a first parameter not it's usage in method bodies. Sorry for misrepresenting your question.

So why does Python not have a mandatory implicit self/this for all class level functions i.e. methods?

Well, functions and methods are not that different in Python. It's simple to make a function a method but the function needs a method protocol. In order to achieve coupling of a function to an object the object is passed as a first parameter into the function.

Example:

class A:
def __init__(self):
self._x = 5

>>> add5 = lambda self, y: self._x+y
>>> A.add5 = add5
>>> a = A()
>>> a.add5(6)
11


Note that add5 will not be transformed in any way. There is no mysterios process of "methodization". It is just an attribute of class A, put into A's __dict__.

> Even worse: in Python you declare your methods with, for
> example, three parameters (self being the first one), but
> you only invoke them with two arguments.
>
> Sorry, that's not OO to me and very confusing.

In the example add5 is still an attribute of A. So you would expect that calling add5 with A needs passing the object a. This is indeed the case:

>>> A.f(a,6)
11


The convenient method call a.add5(6) is just a shortcut for the bounded expression:

a.add5(x) => a.__class__.add5(a,x)

I don't see anything illogical here. On the contrary the semantics can be expressed using Python notations only. No wizard behind the curtain is needed.

Regards
Kay

Bruce Eckel

Posts: 875
Nickname: beckel
Registered: Jun, 2003

Re: The departure of the hyper-enthusiasts Posted: Dec 20, 2005 11:08 AM
Reply to this message Reply
Note also that the post before it:
http://zephyrfalcon.org/weblog/arch_d7_2003_07_12.html#e284
Shows how Python was designed as an OO language from the beginning. Version 1.0 supported classes, virtually the same as they appear today.

I go back and forth about "self." C++ and Java also pass in "this," but it's implicit. So the question is whether an implicit this pointer is a good idea or not. Making it implicit is certainly convenient, but it also adds complexity, because an unqualified reference can then be ambiguous. That is, with an implicit this pointer, x could mean a member x or a local x, but with an explicit this pointer x can only be a local (well, or a global). Despite that, I would probably prefer the apparent simplicity of an implicit this pointer.

Bruce Eckel

Posts: 875
Nickname: beckel
Registered: Jun, 2003

Re: The departure of the hyper-enthusiasts Posted: Dec 20, 2005 11:11 AM
Reply to this message Reply
> "On the other hand, I'll bet that list was one of the
> first library classes that Matz wrote. You can find plenty
> of methods and classes in Java 1.0 that appear to be
> amateurish additions, as well."

>
> ...
>
> This is not an accident -- people really and truly want to
> be able to enjoy what they do eight hours a day.

I'm a happy amateur in lots of things. I was using the word in the sense of "not-well-thought-out." Perhaps there's a better term, but the point is that there are things in the list class and in Java 1.0 libraries that don't appear to be very well thought out.

Flat View: This topic has 262 replies on 18 pages [ « | 1  2  3  4  5  6  7  8  9 | » ]
Topic: The departure of the hyper-enthusiasts Previous Topic   Next Topic Topic: Java Applets + Ajax = ?

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use