Object Relational Mappers are evil (a meditation)

Steven D'Aprano steve at REMOVE-THIS-cybersource.com.au
Wed Dec 23 17:04:38 EST 2009


On Wed, 23 Dec 2009 10:55:19 -0500, J Kenneth King wrote:

> Steven D'Aprano <steve at REMOVE-THIS-cybersource.com.au> writes:
> 
>> On Mon, 21 Dec 2009 11:44:29 -0500, J Kenneth King wrote:
>>
>>> A programmer that
>>> lacks critical thinking is a bad programmer.  The language they use
>>> has no bearing on such human facilities.
>>
>> That's nonsense, and I can demonstrate it by reference to a single
>> programming language, namely Python.
>>
>> For many years, Python had no ternary if operator:

[...]

> But did the lack of ternary encourage Raymond to become a bad
> programmer?

No, but Raymond started off in a position of being an excellent 
programmer. A single buggy idiom lead him to be slightly-less excellent 
than he otherwise would have been. How many buggy idioms would it take to 
lead him to become a mediocre coder, if he was unable to change languages?

Because Python is generally an excellent language, the harm done by one 
or two misfeatures is minor. But less excellent languages encourage 
coding styles, techniques and idioms that encourage the programmer to 
write poor code: either complicated, baroque, unreadable code; or slow 
inefficient code; or buggy code. To avoid starting a flame war, I will 
avoid mentioning PHP. *cough*

Sometimes you know what you need to do to write non-buggy code, but 
because covering all the corners are just Too Damn Hard in a certain 
language, you simply lower your expectations. Error checking is tedious 
and hard to get right in some languages, like C and Pascal, and hence 
even good programmers can miss some errors.

Different languages encourage different mind-sets in the programmer: C 
encourages the coder to think at the low level of pointers and addresses, 
and primarily about machine efficiency; Java encourages the use of big 
object hierarchies and design patterns (it's hard to write lightweight 
code in Java, so everything turns into heavyweight code); Perl encourages 
cleverness and code-golf (writing a program in as few lines or characters 
as possible); Haskell and Lisp encourage a heavily abstract approach that 
often requires an elite coder to follow; Forth encourages you to think 
like Yoda.


[...]
> Good tools make all the difference in the world, I'm not arguing that.

You appear to be arguing against that.

> Just that the tools don't use us; we use them.

Nobody said that tools use us.


> Programming in Python
> doesn't instantly make me a better programmer.

No, not instantly, but I would argue that after many years of coding in 
Python you will be a better programmer than after the same number of 
years of coding in PHP or Basic.

It also depends on what you mean by "better programmer". Some languages 
value cleverness above all else. Python is not a language for writing 
amazing, awe-inspiring hacks that work where nobody but the author can 
work out why. This is why there is an Obfuscated C contest and an 
Obfuscated Perl contest but no Obfuscated Python contest -- it wouldn't 
be anywhere near as awe-inspiring.

So one might argue that the best C and Perl coders are better than the 
best Python coders, but the average Python coder is better than the 
average C and Perl coder. 

(I suggest this as a hypothetical, and do not wish to defend it 
scientifically.)


-- 
Steven



More information about the Python-list mailing list