write blog about state pattern