• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Survey about continue, break and multiple return statements

 
Wouter Oet
Saloon Keeper
Posts: 2700
IntelliJ IDE Opera
  • Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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...

The survey

Thank you very much,
Wouter
 
Wouter Oet
Saloon Keeper
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The survey has been closed. Thank you for participating. We are now gathering the results and will publish them soon.
 
Stephan van Hulst
Bartender
Pie
Posts: 5594
55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm looking forward to hearing the results
 
John Jai
Rancher
Posts: 1776
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Stephan van Hulst
Bartender
Pie
Posts: 5594
55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't think that's the point of the survey :P
 
John Jai
Rancher
Posts: 1776
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
oh ... we wont know how our marks for the test?
 
Matthew Brown
Bartender
Posts: 4566
8
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Since the survey was anonymous, it seems unlikely.
 
James Sabre
Ranch Hand
Posts: 781
Java Netbeans IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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".
 
Ove Lindström
Ranch Hand
Posts: 326
Android Firefox Browser Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Bartender
Pie
Posts: 5594
55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Wouter Oet
Saloon Keeper
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

And thank you Stephan
 
Wouter Oet
Saloon Keeper
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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).
 
John Jai
Rancher
Posts: 1776
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A small teaser: one question was answered incorrectly by 60% of the respondents.


Which question was that?
 
Megha kharde
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
for(;;){
continue;
break;
return 0 ;
}
 
John Jai
Rancher
Posts: 1776
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I missed to answer this particular question sir
 
Rob Spoor
Sheriff
Pie
Posts: 20512
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That code won't even compile to due to unreachable statements.
 
Megha kharde
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
try this

for(;;){
System.out.println(" ");
if(true) continue;
else if(true)break;
else return 0 ;
}
 
John Jai
Rancher
Posts: 1776
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Wouter Oet wrote:The results will probably be published after the weekend.

hi was the results announced?
 
Wouter Oet
Saloon Keeper
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic