This repository is my starting point to illustrate several refactorings.
The naming of the examples mentioned below is based upon the book: Refactoring by Martin Fowler. An online catalog is also available. Another very good reference is Working Effectively with Legacy Code by Michael Feathers.
Extract methods from the condition, then and else part.
Combine conditions with the same result.
Conditinal behaviour can make the path unclear.
Use a strategy to decide the outcome.
Different behaviour based on an identifier (int, enum, type). Encapsulate in class.
Create two methods, one for the query and one for the modification.
Replace null value with null object