Long conditionals in ifs Very easy question for these who spend some time on analyzing code written by co-workers. 

When I write my code, I do my best to write it in a very, extremely readable way. But sometimes I have an impression, that I write it too easy... Simple example:

When I see such a code:

public Category getCategoryType(Component components){
        if(component.hasSensor() &amp;&amp; component.hasInputUnit &amp;&amp; component.isValid() &amp;&amp; !component.isSuspended()){
            return Category.TYPE_A;
        }
} 


the first thing I do is changing it into:

    public Category getCategoryType(Component components){
            boolean hasSensor = component.hasSensor();
            boolean hasInput = component.hasInputUnit();
            boolean isValid = component.isValid();
            boolean isNotSuspended = !component.isSuspended();

            if(hasSensor &amp;&amp; hasInput &amp;&amp; isValid &amp;&amp; isNotSuspended){
                return Category.TYPE_A;
            }
        } 


One of my collegue told me politely, that it is not necessary, because people can read a little more complicated code. But I think, that someone who will read this ode after me, will have a easier task (despite the fact, that I make this function a little bit longer)

Question for you:
Do you think, that such changes in code are senseless?

Maybe only formatting stuff is sufficient:

public Category getCategoryType(Component components){
        if(component.hasSensor() &amp;&amp; 
           component.hasInputUnit &amp;&amp; 
           component.isValid() &amp;&amp;
           !component.isSuspended()){
               return Category.TYPE_A;
        }
}
Readability is extremely important, particularly in large projects with many programmers involved with the same code. What you do, using local Boolean variables to clarify potentially complex conditions, is a very good way of improving readability that I try to imprint on my co-workers.

That said, in your example, if I wrote that method from scratch, I would do it similarly to your first re-write. However, if I just happened upon the existing code, I would do just about exactly as your second re-write. It is good enough, and I do not really like to change other peoples code unless it is either incorrect, or directly violates the coding standard (which it incidentally does two-fold: The conditional line is too long, and our standard also tells us to place sub-conditions on separate lines).

So, in my humble opinion: You have it right - I like how you do it, and you should take pride in writing readable code. But do not waste time on re-writing working code when a simple re-formatting is good enough.