When a person sees another behaving improperly, it’s easy to judge him in a negative light. How can we learn to judge him favorably?
Think about if it was you in that situation. What excuses would you give yourself? Maybe that your tired or hungry, had a difficult day or it’s not what it seems. Whatever excuse you would give yourself, give that excuse to this person. In this way you can judge him favorably.
This idea is hinted to in the gemara that says קשוט עצמך ואחר כך קשוט אחרים, which simply means first correct yourself and then correct others.
However, this statement can be understood in a different way. In addition to קשוט meaning to correct it can also mean to adorn.
It can now be understood to first adorn yourself, meaning come up with excuses for yourself if it was you in that situation. Once you do that, then קשוט אחרים, adorn others in that situation with those excuses, thereby judging them favorably.
Baba Metzia 107b.
As in the targum on ותקשרים ככלה, adorn yourself like a bride (Yeshaya 49:18) which is כקישוט כלתא.