A couple of times a year the discussion about whether to use continue, break and multiple return methods (in a single method) lights up. Every programmer has his own opinion about this it seems. To gain insight into this matter we started, as part of a course, a survey to see what people think about it. The survey consist of 2 parts, what you think about the usage of the statements and code fragments of which you need to find the outcome.
We would really appreciate it if you would fill in this survey. It won't take that long. Of course the results will be announced here. Maybe we can finally conclude this discussion...
Thank you very much,
"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.
Oh... will you publish the results for all who took.. or only top scorers i am eager to see the marks... but only can see you publish all the results... perhaps from bottom to top might be even more easier
I think the point was to show that with some of the constructions, it is hard to understand and/or read the code.
I copied the different questions and had a discussion yesterday with some colleagues. Some of the code-examples are doing the exact same thing. Only that where you use continue, break and multiple returns, most of the gang got the result wrong.
I will use some variants of the code examples in my classes to show how to write and how to not. Thanks Stephan Wouter for the excellent survey.
Stephan van Hulst
Joined: Sep 20, 2010
Hang on hang on, as much as I would like to take the credit, it's Wouter's survey. I have absolutely nothing to do with it
The survey was anonymous so you won't get your individual scores back. The results will probably be published after the weekend. A small teaser: one question was answered incorrectly by 60% of the respondents.
James Sabre wrote:I abandoned the survey when it seemed to be more about remembering the detail of auto-boxing and less about "continue, break and multiple return statements".
The survey only has one question where an Integer is compared to an int. In the other cases the comparison is int vs. int. Only in the case of a comparison between an Integer and and Integer, which the survey didn't contain, must the details of auto-boxing be known (i.e. the auto-boxing caches).
Joined: May 31, 2011
A small teaser: one question was answered incorrectly by 60% of the respondents.
I'm sorry. There are some problems with entering our grade into the schools gradingsystem (read: the system that doesn't work all the time, if it works it works partially, students hate it, teachers hate it). Therefore you'll have to wait a little longer. I do hope and think that the problems will be solved quickly.