Its better to use enums instead of switch blocks which makes the code longer and difficult to maintain as and when new state appears.