Selection

	private String executeSelect(int action, Form mform,
			HttpServletRequest request) {

		switch (action) {
		case 1: {
			return pageChooser(mform, request);
		}
		case 2: {
			return pageChooser(mform, request);
		}
		case 4: {
			return pageChooser(mform, request);
		}
		case 3: {
			return pageChooser(mform, request);
		}
		}
		return pageChooser(mform, request);
	}

There’s a need to comment?

Source can’t be disclosed


4 responses to “Selection

  • nex

    I’m surprised he didn’t put the default case 😀

  • lmc981

    I can bet that he tried!
    But the compiler raised an error at the last return, “code unreachable” 😀

  • Nex

    ahaha you are right 🙂
    I think that these examples would be even more enjoyable if we could follow their mental processes.
    When i find such programing pearls and It is possible to ask to the author: “WHY?” , the explaination is often funniest than the code.

  • lmc981

    I hope to talk right about such arguments, here in comments!
    Things like ‘howintheworld anyone would come at THIS!!’ =)

    With this one, I think, the developer come to this ‘solution’ after a few iteration… the application was intended to do several actions, but after some pruning only one lasts and the code was leaved as it was =)

Leave a reply to lmc981 Cancel reply