On 2012-03-28, at 11:23 AM, David Avendasora wrote:
On Mar 28, 2012, at 3:31 PM, Farrukh Ijaz wrote:
return contentDisposition != null && (contentDisposition.indexOf("inline") > -1 || contentDisposition.indexOf("attachment") > -1);
Seriously, who can read that and make sense of it immediately?!
This is programmers shorthand. They master it with time. If you find these statements somewhere in the code, consider that piece of code been written by an experienced programmer which is less likely to have bugs. This is style is still not difficult than what you can find in a TopCoder algorithm which contains is full of boolean and bit manipulation operators.
I have to _vehemently_ disagree. One way many people learn how to be good coders it by looking at other people's code and being able to see what it does. Not only that, but the assumption that it's less likely to have bugs because it is obtuse?! Are you serious?
You've the freedom agree or disagree but not _vehemently_. Everyone should respect other's opinion and so do I with respectfully. One must learn the language syntax. Why should I use such a verbosity in code when it's already easy to understand.
int max = (x > y) ? x : y;
is much better in readability than:
int max = 0;
if (x > y) {
max = x;
} else {
max = y;
}
This is one of the most elitist things I've heard said on the WO-dev list.
If this is so bad practice then why Project Coin introduces Strings in switches, developer can still do if-elseif-elseif-elseif...else coding. This is in fact elite coding style :) Following is excerpt for String.java
public boolean equalsIgnoreCase(String s)
{
return this != s ? s != null && s.count == count && regionMatches(true, 0, s, 0, count) : true;
}
We really shouldn't go into coding convention domain. I respect everyone's style and we should try to learn the best practices. Trust me verbosity is good for examples but in practice, we should compact our code as much as we can.
Thanks,
Farrukh
Dave
—————————————————————————————
WebObjects - so easy that even Dave Avendasora can do it!™
—————————————————————————————
David Avendasora
Senior Software Abuser
Kaiten, Inc.