The Python Paradox, by Paul Graham 726
GnuVince writes "Paul Graham has posted a new article to his website that he called "The Python Paradox" which refines the statements he made in "Great Hackers" about Python programmers being better hackers than Java programmers. He basically says that since Python is not the kind of language that lands you a job like Java, those who learn it seek more than simply financial benefits, they seek better tools. Very interesting read."
Learning (Score:4, Interesting)
Implementation is important (Score:5, Interesting)
Python made my collegues start writing scripts... (Score:5, Interesting)
Python vs Java (Score:4, Interesting)
When I did have to write something in Java - well, better hope you have the right API. Oh, and what's the difference between the 3587324 different XML parsing packages? Oh and download Java Super Micro PDA Library! Only available for Solaris and Windows!
The promise of "write-once-run-anywhere" was pretty much dead. Not that I was even going for portability - I just wanted it to run on Linux. And I wanted to do it without having to download Beans, Java DynamicManagement, Java Metadata, ad nauseum.
Python, on the other hand, simply works. Sure, it doesn't have a standard GUI toolkit (although wxPython is pretty much the de facto standard now...), but it does everything I need it to do. With a clean, nice syntax, no less.
Oh, and I still don't get how Java doesn't let you write a freakin routine to get the permissions on a file without resorting to writing a C function. Sure, it's not "portable", but just do what Perl and Python have done - on platforms with no permissions, return a sane default value. Don't just NOT include the function at all...
Anyway, forgive my rant. Python - good standard library. Java - tons of confusing frameworks and platforms, etc, etc.
cover all the bases! (Score:2, Interesting)
You can put Java on your resume to get the job, and then use Python to glue components together!
All kidding aside, I am currently working on a pretty complex java project. I've written various small programs as utilities, and these programs would have been better off as scripts accessing some of the java classes I had already written.
The downside of java -- in this circumstance --- was having to deal with classpath and compiling cycles and whatnot. What I really wanted was to write the program/script easily, have it leverage what I had already done, and not bloat the resulting .jar files with little utility programs that would be better off as scripts.
I learned Python a little too late for this project, but you can bet your ass Jython will be embedded in my next.
The way source code looks (Score:5, Interesting)
Google agrees. (Score:1, Interesting)
"[2] When Google advertises Java programming jobs, they cleverly require Python experience."
Even though Paul deleted it, you can still see lots of revfference to it, thanks to Google [google.com]
Java programmer's viewpoint (Score:4, Interesting)
The immense number of system and third party libraries is what keeps most Java developers coding Java. The close second is Java developer's tools. Until there is an IDE for Python that's as extensive, capable and sophisticated as Eclipse I'm going to stay with Java. Most Java development is in the enterprise server side space and the sheer amount of tools that Java offers is just mind boggling.
Also us, enterprise developers tend to work in environments that are much more conservative from the technology standpoint (banking, insurance, brokerage). As far as I'm concerned it's a big win for us that we got Cobol elbowed out with Java. Trying to push the language of the month at those executives will cause us more harm than good.
I know that Python has some very nice features (I read the tutorial) but it's hardly the sort of paradigm shift that merits ditching Java and rewriting everything because of some neat syntax flavoring. Besides Java is hardly a frozen language and we have some exciting stuff coming down the pipe here. JDK 1.5 will introduce shared VM model which may make java compeling on the desktop, more elaborate iterators, annotations (my favourie in 1.5), and generics (although without primitive types support they are kinda lame).
Java is now frequently used in CS research as well. It looks almost certain that the next milestone in CS evolution will come in the form of Aspect Oriented Programming and AspectJ has been the leading implementation.
Sometimes it feels that Paul G. just has an ax to grind into the collective Java community but I wonder how closely did he actually look at Java before dismissing it?
The Java Problem (Score:3, Interesting)
What I don't understand is why I even need Java? Jython let's me do pretty much everything Java can do, in a language that is a lot simpler that "fits in my head", not fits in a huge bookshelf. Sure I still need to know a bit about Java classes and such, but it's a lot less work than my friends who program in Java have to do. I feel sometimes like I'm watching people hike up to the top of a mountain every day, while I just take a 4x4 and get to the same place, but get there faster and with a lot less sweat and effort.
Can anyone who codes both in Python and Java educate me?
Why I like Python (Score:3, Interesting)
I like python because it allows you to modify the behavior of the language constructs. It gives you hooks into what happens when you say 'print myvariable' or what goes on when you retrieve 'mydict[ "something" ]'.
Much like operator overloading in C++, this allows you to write in the language of the problem, rather than the language of the language. So, if you're dealing with dates you can overload the minus operator to calculate the time between two dates when they are subtracted. Or if you are dealing with complex numbers your operators do the right thing when you add a complex and a real.
Similarly, in Python you can create a database search object that behaves like an associative array. So, customer_id_search[ 10 ] goes to the database, retrieves the record for customer_id 10 and returns a DAO to be manipulated.
Iterators and many other constructs help you in writing clear, concise, MAINTAINABLE, extensible and reusable code by allowing you to code clearly in the language of the problem you are trying to solve.
Python Rules, Perl Sucks.
Excellent article (Score:3, Interesting)
By looking at the article I was able to quickly gauge the amount that I need to learn to learn basic Python... needless to say, it will not be a very far stretch. I am sure that I have a lot to learn, but this easily cut weeks of trial and error off of my learning curve. I can't thank him enough. I am excited.
CVB(Neil P. Davis)
Python is great for guys like me.... (Score:5, Interesting)
I guess the point I'm making is that this language has a strong appeal to people like myself who are just looking to use it to solve problems and/or make problem solving tools. I don't know anything about Java, but maybe the reason that the author feels that Python has the better hackers is because Python, by virtue of it's simplicity and no-nonsense syntax, tends to attract your more "problem solver" type person.
Just a thought.
Re:That's all well and good... (Score:1, Interesting)
Apples and apples (Score:5, Interesting)
Both languages have a virtual machine.
Both languages can use JIT compilers for improved efficiency.
Both languages support OO development.
Both languages have large standard libraries.
Both are turing complete.
Even their performance is similar.
Please explain how this is an inappropriate comparison.
Why I like Python (Score:3, Interesting)
I like python because it allows you to modify the behavior of the language constructs. It gives you hooks into what happens when you say 'print myvariable' or what goes on when you retrieve 'mydict[ "something" ]'.
Much like operator overloading in C++, this allows you to write in the language of the problem, rather than the language of the language. So, if you're dealing with dates you can overload the minus operator to calculate the time between two dates when they are subtracted. Or if you are dealing with complex numbers your operators do the right thing when you add a complex and a real.
Similarly, in Python you can create a database search object that behaves like an associative array. So, customer_id_search[ 10 ] goes to the database, retrieves the record for customer_id 10 and returns a DAO to be manipulated.
Iterators and many other constructs help you in writing clear, concise, MAINTAINABLE, extensible and reusable code by allowing you to code clearly in the language of the problem you are trying to solve.
Python Rules, Perl Sucks.
tcA thgirypoC muinnelliM latigiD eht detaloiv tsuj evah uoY
Re:Implementation is important (Score:1, Interesting)
What is this nonsense? "Mysterious" claims about the JVM? Huh? First of all, you're comparing the source code of a language implementation to books. Second of all, The documentation for Java is way better than Python's, Perl's (yes, even considering perldoc), and Ruby's combined. If they gloss over a few things in Java books, it's most likely because they don't want to get into irrelevant, potentially confusing details or cover details that are a part of the implementation and not a part of the language specification.
WHat turns me off Python (Score:3, Interesting)
I consider myself a pretty good programmer. I otherwise fit the criteria he lists in that I do a lot of programming for fun, and like to explore new languages...
but not Python. And you know why? It sounds petty and stupid, but I just hate the whitespace indenting. I have always thought that perfect code readability relied on the felxibility to format certain sections of code differently than others, and the need to have indenting control grouping of statements has always been way too rigid for my tastes.
So there you go, that's why one Java programmer is not into Python at all (not even Jython).
Re:Implementation is important (Score:3, Interesting)
The Java Language specification [sun.com]
and if you are interested in more depth, The VM spec [sun.com]
The specified behavior for synchronization, the memory model & threading are all there in fairly simple terms.
Re:The Java Problem (Score:4, Interesting)
And you know what? I think Python is the best.
I'm more productive, it's more intuitive, it took three months of writing Python for me to dump Perl completely after using it for 12 years.
Re:The way source code looks (Score:2, Interesting)
Regards,
Steve
Re:Java programmer's viewpoint (Score:3, Interesting)
He likes Small Is Better, which isn't Java (Score:5, Interesting)
I think this point is interesting. Paul Graham makes a big deal about why he doesn't think much of Java, and it all seems to go back to the big/small issue. For example, in his essay on how he put together the Yahoo stores using Lisp, he mentioned that interpreted languages (or at least languages that can be both interpreted and compiled like Lisp) are better because they let you do things incrementally, as opposed to languages such as C/Java/etc, which force you to do the whole project all at once(I'm generalizing his statements here, but that seemed to be the gist of it).
My point is this: Graham seems to really like the "small is better" approach, for which interpreted languages really shine. For larger projects, Java/C++/etc. would (might?) be more appropriate, but for Graham's projects and ideas, not really relevant.
Every once in a while, Graham comes out with something that seems to get Java users up in arms, but it's entirely possible he's operating from point-of-view that involves projects that Java wasn't really designed for to begin with.
Just a curiousity I thought I'd note.
Re:Python vs Java (Score:5, Interesting)
In defence of Java, much of its library support is for use with big systems, like enterprise apps that run under J2EE servers. Python is nowhere near this level.
Put simply, Java scales up; Python scales down. I think, however, that in the future, Python could pose a serious challenge to Java if an enterprise-level app framework is ever created for it. But Java has such huge momentum I doubt it will be toppled from the enterprise server throne anytime soon.
Re:Java programmer's viewpoint (Score:5, Interesting)
Nothing like starting your reply with a good ad-hominem attack, eh?
lot of people choose Java, but only a very small number for open source projects
Tell that to the Apache consortium. Most of their new projects are all java. The whole Jakarta, Geronimo all very prominent java efforts. Besides Freshmeat returns 2381 java projects and 956 python projects... hardly the ultimate in testing languages' popularity but it dispells your stupid assertion that only a small fraction of OSS projects are written in Java.
Changing topics: aspects. Aspects are stupid. They make sense in a language like Java that has no metaprogramming capabilities. They are absurd in other languages like Python or Lisp.
Aspects are not macros and macros cannot do everythin that aspects can. Go back and read more on aspects.
Finally, stop acting like an arrogrant asshole. It makes you look very infantile.
Re:Java programmer's viewpoint (Score:2, Interesting)
Saying the two groups are equally intelligent is somewhere on the order of saying business majors and math majors are equally intelligent. Both attending college, but typically one group is after just a degree and the other is pursuing knowledge. The numbers are 100% either way, but there is a much higher percentage of geniuses in math than in business classes. Nobody flunks out of business into math.
Argument, short form:
Java is the choice of consultants, not the choice of scientists.
Ok, for pure brainpower here is the competition I propose: Take a Python programmer and a Java programmer. They tackle the same problem in both Python and Java. I'm betting on the Python guy to present better solutions in both languages.
Most of the complaints about Graham are likely from people who are just barely programmers. Their real skills aren't as programmers but that they happen to know enough of the libraries to get things done. This makes them useful when combined with a certain industry experience, but it doesn't make them good programmers. One of the most common arguments for Java replacing other languages I've seen is that it's easier to find Java programmers and that they are pretty much replaceable. Personally, I no longer aspire to being easily replaceable. I'm now accepting positions that expect me to perform well enough that I would be difficult to replace.
-- Former consultant
Bigotry (Score:3, Interesting)
I embraced Java because I could finally program the OO way in it. C++ was supposedly OO, but didn't work quite right, and Java was an ok (not perfect) mainstream Smalltalk based language. The original team was fairly strict in the sense that it would not allow brain damaged C++ programmers to ruin the language (there was definitely a "purist" language design philosophy involved). Of course, in recent years they seem to have dropped that (see Java 1.5 generics, etc..)
Now Python comes along... and Ruby too... they are nice, because among other things they bring us the Smalltalk philosophy of simplicity with Java lacked for marketing and acceptability reasons.
I say.. what about Smalltalk itself??
The reason I still stick with Java is:
- Huge huge number of libraries
- Good acceptability
- Easier to convince my boss
- etc..
Pragmatic reasons.. not purist ones.
I think a lot of Java programmers are the same.. Python is nice.. hope it catches on, but look we have this very mature platform in the meantime.
Now P. Graham arguing about Perl as a good design vs. Java is just laughable. Sure, Perl is fast, Perl has regular expressions. But Perl has NO orthogonality, Perl is a write only language... it is not a language for people who like to read code.
To me it just seems like Paul Graham is used to using Lisp, to running his code on Unix. Paul Graham probably runs emacs and has the Unix culture in him. He shouldn't confuse his Unix culture preference for scripting and languages similar to scripting, his preference for dynamic typing, his preference for the command line, his preference of being with a rebel as a real reason to bash the mainstream. It's just an illusive preference of his own.
It's laughable for a Perl or C++ programmer to diss a designed language and say theirs is superior.. the only reason we listen to Graham is because of his Lisp background.
Re:Why I like Python (Score:2, Interesting)
Instead of a well defined meta-protocol python just exposes a few pieces of its intenals, a few hooks that let you override the default behaviour. It all seems a bit ad-hoc to me. It seems to make optimisation difficult too. Ref. the creation of the += operator to bypass the (possibly mutating) hooks involved in a = a + b.
Languages like Smalltalk and Common Lisp (with CLOS) properly formalise this and make things more predictable and flexible. Of course, I have written a heap of useful python code but noone has ever paid me to write something useful in CLOS. It's fun to think about stuff like this but python get jobs done
Re:Python vs Java (Score:3, Interesting)
Interestingly, I just started trying to learn Python recently, for just these reasons... but soon gave up in frustration.
My issue is that I live for static typing. Yes, yes, yes, I know it's (apparently) very unfashionable to want the compiler to check for trivial mistakes, but I'm funny that way.
Don't get me wrong: dynamic typing is great. It's a wonderful tool to have available. But more often than not, I know the type that I need, and can make my app more reliable by enforcing those constraints at compile time rather than at runtime.
But the final straw has to be the deliberate omission of variable-declaration statements -- this is like some nightmare out of circa-1982-BASIC. What, it's too hard to declare variables? C'mon, that's not flexibility -- that's laziness.
The idea of an interpreted, dynamically-typed language with a huge standard library is verrry appealing to me, but I refuse to switch unless I can have static type checking built in to the language.
(For that reason, ECMAScript 4, aka JavaScript 2.0, aka ActionScript 2.0, is looking more and more interesting to me: I get all of the dynamically-typed goodness I want, along with flexible compile-time type checking that is "on" by default, but trivially easy to work around. If only there was a way for me to use all the existing Python libraries from there...)
Re:Java programmer's viewpoint (Score:2, Interesting)
Re:Don't pick on Design Patterns by GoF! (Score:3, Interesting)
I recently ran by a paper by Alex Martelli called Five Easy Pieces: Simple Python Non-Patterns" [aleax.it] that goes into more detail on this topic. In it he says, "Python has a knack for making many issues simpler. This, in turn, enables use of simpler conceptual tools, such as an idiom in lieu of a Design Pattern."
I'm sure the same likely holds true for Lisp.
Python will go the way of Perl (Score:5, Interesting)
However, back in the "old days" (late 80s, early 90s), Perl too was a bastion of those who wanted to throw off the shackles of scripting (I hate when that word is mis-used to refer to interpreted languages). Perl was the way to start giving some real structure to all of those tasks like report printing and systems toolsmithing that had traditionally involved totally unmaintainable "scripts" which eventually had to be re-written in a low-level language.
So what happened? Nothing really. Perl developed some nice features, but ultimately LOTS of bad programmers learned it and in a language that makes it easy for people to write programs, you quickly develop a robust collection of REALLY bad code (along with the really good). Just look at C for confirmation of that.
Python is where Perl was in the early 90s now. Lots of folks who know bad code from good are using it, and it looks like the next great island to swim to. It's easy to look back at Perl and say "it was the dollar-signs that FORCED people to be bad coders," or to look at Java and say, "the low-level types are what SEDUCED people into writing crappy code."
In reality it was the popularity and subsequent influx of bad programmers. Python is becoming popular and I guarantee that in about 5 years Python programmers will be listening to, "[Span, Ruby, something else] is so much better than Python... just look at how much cleaner the code is."
I wonder if we'll ever figure out that joe blow who barely understands what programming is will always produce unmaintainable shlock, no matter what language he writes in and no matter what book on abstract modeling he's just read.
Re:That's all well and good... (Score:3, Interesting)
Re:Why I like Python (Score:3, Interesting)
My last large project was a provisioning system for the 3rd largest internet carrier in the world. It provisioned and maintained managed modem service for over 23 million users in the US and overseas. It consisted of about 150,000 lines of python code and is now being quite happily supported by 2 of my friends that are still working there.
Get over yourself.
Re:Java programmer's viewpoint (Score:3, Interesting)
I'm afraid I don't know objective C. Could you elucidate on what this provides that Java lacks?
Secondly, callables a la python. This includes class methods and statics (not merely function pointers like C).
This can be achieved using the java.lang.reflect.Method class. It's ugly, but workable, and a number of my software projects have used it.
The fact that you have to jump through hoops to attach an event handler using a callback model (a la Swing) is inexcusable.
This is an API issue, rather than a language issue. Swing and AWT aren't the only GUI toolkits that are usable with Java, and you are free to write your own, as I have done. I don't have to jump through any hoops to handle events.
Are anonymous classes really a solution? How about in an application with hundreds of event handlers?
Anonymous classes work for me. They're managable because you put them in the code where you want them. I've never written an application with hundreds of them, though.
A programming language should enable the use of different techniques, not restrict them.
Agreed, and I for one would like to see a nicer syntax provided for reflected methods -- at the moment to get one you have to write 'object.getClass().getMethod("methodName",new Class[]{ ParameterType.class })' and handle the exceptions that can be thrown, where the compiler can easily determine that there are no possible exceptions and provide a much simpler way of doing the same thing. This would make the use of this kind of technique much easier.
Additionally, the overhead of object allocation in Java is awful. Simple objects whose only attributes are primitive types should be stack allocated under a certain size.
Stack allocated objects are hard to manage -- the compiler would have to perform checks to ensure that no reference to the object can exist outside of the scope of the function call before allocating it on the stack. An interesting point is that there is nothing stopping VM implementors from doing this anyway, it wouldn't violate the specification. The difficulty of making it work correctly is the only issue.