different styles when coding #1

every person has its own taste in music, fashion or cars. developers can also have different taste in programming languages, operating systems or code styles. like people argue that their taste in music is the best, so do programmers try to convince others in their way of thinking. in the next few post i want to point out some of the most frequently discussed style issues with my coworkers and mates.


style 1:

public String doSomethingStyle1(final String... parameters) {
    final String result;

    try {
        result = doSomethingInternal(parameters);
    } catch (final Exception exception) {
        throw new IllegalArgumentException("oops", exception);
    }

    return result;
}

style 2:

public String doSomethingStyle2(final String... parameters) {
    try {
        return doSomethingInternal(parameters);
    } catch (final Exception exception) {
        throw new IllegalArgumentException("oops", exception);
    }
}

so which style are you, 1, 2 or even something else, tell me about it in the comments. 😄



118 views1 comment

Recent Posts

See All