Python/dynamically type languages redux

Posted by Thomas Tue, 17 Oct 2006 01:41:47 +0000

I still don’t understand Python and its zealots. I find myself all too often in little altercations over the choice of languages and platforms with guys at work, specifically with my great disdain for Python.

I think that if you are an advocate of a dynamically typed language, then you are lazy. You don’t need to be programming if you can’t plan ahead for what variable types you are going to need. If you have a problems thinking that far ahead, then you really do have problems. I think it’s the lazy man’s way out. You can’t be encoumbered by declaring the type of your variables. It hinders your process and bogs you down. You can’t be saddled with such things. If you can’t figure it out, then you shouldn’t be programming. I add a type to a variable without thinking, just like I add a semi-colon to the end of every line. Just like I add a period at the end of every sentence.

I cut my adult programming teeth on C and Java, which are both strongly typed, and probably have permanently influenced the way that I approach solving problems in code and the length of code I consider acceptable for even the simplest of programs. I don’t even see the “boilerplate” any more and I don’t see people’s problems. Importing classes in java is a necessity to me, and I know and understand that, yet when I see imports in python, I always perceive them as the author’s attempt to be cooler than he really is. I don’t know why that is… But what I try to myself realize (and may or may not really reach a decent level of zen in) is that neither I nor you, Mr. Zealot, have the right answer. If there really was one best language then we would all be using it, and no one would be writing new ones, as I am sure someone came up with one just today. Don’t be a zealot and say that your language is better, and force it down my throat. Because it is not the one true language for all of the world and for every application.

I try not to be a zealot for Java, but it’s especially hard for me when other zealots rear their heads and plead their case. I try my best not to force my opinions down other people’s throats, and I appreciate it when others due the same. Don’t waste your breath trying to convince me that your way is better, show me your way is better and I will immediately fall in line. But, if you show me, and you don’t convince me, then you’d better go back to the drawing board and try again.

In my quest for answers, I ran across this.

Let’s face it: your average commercial application isn’t burning CPU cycles solving NP-complete problems. We typically write code that moves chunks of data about and adds up a couple of numbers. In these scenarios, is it worth worrying about the relative performance of the language used to do the moving and adding? Not in my book.

Most of the time the computer waits on you, just like in Mother Russia, and not being stupid and choosing a decent algorithm is key. And I, too, do not care what language it was written in as long as it does its job currectly and in a timely manner. I, in fact, like many other things, do not care for a very, very long time, but then care immensely about how well it will do its job. But then he quotes this:

Justin Ghetland experienced this recently on a Rails project. Having coded the same application twice, once in Java and once using Ruby on Rails, he was surprised to discover that the Rails application outperformed the Java one. Why? Justin believes it’s because Rails does smarter caching.

He compares Java to Ruby on Rails. How can you do that? How can you compare a language to a platform. Of course Java will loose if you’re running it against some other platform that caches the result. Are you stupid? A 2 year old could tell you that. I digress as he does into why Ruby is cool because you don’t have to write sql or some such blather.

Python was derived from ABC and I have as of yet to hear the true reason why he chose as he did. Are the perceived benefits of implicit declaration, statement nesting by indentation, and smaller size === more readable in fact true? Is the benefit perceivable or even quantifiable? Isn’t readability in the eye of the beholder, or more precisely in the eye of the maintainer?

I have not been one for trying to fix some else’s code in quite some time. Ever since that first time or two, I realized that the probability of me finding your error in your non-trivial code was very slim. And in the several minutes that I would be trying to orient myself with the code, the author would figure it out.

Plus all of my other gripes:

the language should not enforce style guidelines
the correctness of a program should not be dependant on indentation
how easy to comment out a code block and not affect the surrounding code
how easy to temporarily copy and paste new code into a block
how easy to determine the end of the code block
“it forces correct coding style” — indentation is only one of many factors of proper coding style, which of itself is debatable; would you want to enforce CamelCase or Hungarian notation at the language level?
“I dislike using braces because I have to indicate my intentions twice: once for the compiler and once for humans.” — couldn’t repetition be considered good for readability?

“When you get to the bottom of it, however, I write programs in Lisp for the same reason I write prose in English—not because it’s the best language, but because it’s the language I know best.”

Well, that last statement really is true and the crux of the whole thing. I know C and Java, and Python isn’t like them in more than a few ways. I ignore certain things about my prefered languages, and the other zealots do the same. I really don’t care what language something is written in. Do I care what language Firefox, Gaim, or xterm is written in? Surely not. I only care that they do their job and they do their job well. If they don’t then I find something else. This is how it should be. Survival of the fittest; a capitalist chosing of software.

I guess what irks me the most is when the zealots proclaim that Python is the best, one, and only, and then their apps suck. Don’t come to me proclaiming the wonders of a language, the ease with which this allows one to code, the brevity, the veritable snake oil-wonder language, and then your apps still suck. I shudder to think how much they would suck if they chose a “harder” and more verbose language.

And why does WordPress have a stupid little draggable ui, yet no autosave or type-as-you-go spell check. Get your priorities straight! Features first, eye-candy later. Function before form.

Posted in Technology | Comments Off

Comments

No comments yet.

RSS feed for comments on this post.

Sorry, the comment form is closed at this time.