Hello,
I have a Request class that can be in one of the following states:
Draft, Submitted, Approved, Rejected, InMission, Completed
The state of the Request object can be changed by calling one of the following methods. Each method may include some arguments to further associate some data with a particular state:
void Submit(string by) { }
void Approve(string by, string comment) { }
void Reject(string by, string comment) { }
void AddToMission(Mission mission) { }
void Complete() { }
I was thinking of implementing the State pattern here. Each of my state classes will hold those extra information associated with them. My main idea to implement State pattern here is to not add all these unreleated properties in the Request class itself, like:
public string ApprovedBy;
public string ApprovedComment;
public string RejectedBy;
public string RejectedComment;
public Mission Mission;
Do you think State pattern is a good candidate to implement here?
Regards,
Mosh