Moved here to not distract from original thread's conversation.
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.
Er… um… yeah. Sorry about that. This is something that I am very frustrated by whenever I dig into the Wonder code. It always just feels like the developer that wrote it is saying "Ha, ha, Dave! I'm better than you! I made something work that will take you hours to figure out how I did it! Why don't you just give up now and go back to being a business analyst."
But, that's my own issue. I know developers aren't saying that. Well, most aren't. Okay, Chuck is, but nobody besides him. (It huts me, Chuck. My therapist told me to be honest with you.)
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;
}
See, that's the thing, I find the second form much easier to read and to be sure that I know exactly what is happening. Now in such a simple example the first's syntax isn't all that hard (even for me) to read either, but I do need to stop and basically translate it into the second in my head. That's just the way I am.
I'm not saying that all code should be in the second's form, I'm just saying that there should be a middle ground somewhere.
I'm not a human compiler. I wish I were. There is some amazing features in Wonder written by people who can think in code, but I just don't. After almost 8 years using Wonder, I still have a hard very hard time understanding what many parts of Wonder do.
I guess my issue isn't really about verbose vs compact, but clear vs cryptic.
This is one of the most elitist things I've heard said on the WO-dev list.
If this is so bad practice
Let me be clear, I'm not saying it is always a bad practice. I just think it is disingenuous to say "Everyone should contribute to Wonder. Look at the code for examples of how to do things." and then say "Sorry you don't understand what we elite coders write, once you are better you'll work it out."
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.
Why? Please explain to me the benefits of being compact to the point that a new developer, or an old one like myself, will find it cryptic.
Refills of braces, tabs, spaces and carriage returns for the eclipse text editor are very inexpensive, and only a few baby platypuses are killed to make them these days, so I know it can't be concern about using too many. :-)