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

Advertisements

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

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s