Why do people hate programming?

stormbind

Retenta personam!
Joined
Feb 1, 2003
Messages
14,081
Location
London
return (c != t) ? (c = (a != b) ? c+1 : c-1) : c;
 
If anyone wrote something like that in a program I was responsible for, they would get to re-write and/or explain very clearly in comments what they were doing and *WHY* they had to do it in such a non-obvious manner.

Yes, I can understand exactly what it is doing, but I can't think of a good reason to do it that way. 25 years ago, there was reason to write that way. I did similar things, myself, then. Today, memory is cheap, and there is no reason to not write clear, understandable code.
 
I'm pretty sure if anyone actually programs that way they should be tarred and feathered.

the reason programing languages exist are to make it easy for programmers to read and write. needlessly complicating the process with unclear variable names and unnecessarily long lines without breaks or comments is considered bad form.
 
If anyone wrote something like that in a program I was responsible for, they would get to re-write and/or explain very clearly in comments what they were doing and *WHY* they had to do it in such a non-obvious manner.

Yes, I can understand exactly what it is doing, but I can't think of a good reason to do it that way. 25 years ago, there was reason to write that way. I did similar things, myself, then. Today, memory is cheap, and there is no reason to not write clear, understandable code.

You should see the old MS Access applications where I work (written before I started) with the similar lines of code like that. :mischief: (Granted, it's more like iif(<expr>,true,false) than <expr> ? true : false). I guess some people like being cryptic, too.

return (c != t) ? (c = (a != b) ? c+1 : c-1) : c;

I think that was in a textbook of mine, too.

Then there's the multiple IF and AND statements...

if (a == b) && (c != getSomeVal()) && (...) !! ( ( (x > y) && (z < p) ) !! (d != e) ) .......

:)
 
Top Bottom