Timeline for State Pattern when the Behavior in Object of Type A is Dependent on the State of the Object of Type B
Current License: CC BY-SA 4.0
18 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Apr 19 at 15:01 | history | bumped | CommunityBot | This question has answers that may be good or bad; the system has marked it active so that they can be reviewed. | |
| Dec 20, 2024 at 15:00 | history | bumped | CommunityBot | This question has answers that may be good or bad; the system has marked it active so that they can be reviewed. | |
| Aug 22, 2024 at 14:03 | history | bumped | CommunityBot | This question has answers that may be good or bad; the system has marked it active so that they can be reviewed. | |
| Apr 24, 2024 at 13:06 | history | bumped | CommunityBot | This question has answers that may be good or bad; the system has marked it active so that they can be reviewed. | |
| Dec 26, 2023 at 12:05 | history | bumped | CommunityBot | This question has answers that may be good or bad; the system has marked it active so that they can be reviewed. | |
| Aug 28, 2023 at 11:04 | history | bumped | CommunityBot | This question has answers that may be good or bad; the system has marked it active so that they can be reviewed. | |
| Apr 30, 2023 at 11:03 | history | bumped | CommunityBot | This question has answers that may be good or bad; the system has marked it active so that they can be reviewed. | |
| Dec 31, 2022 at 11:01 | history | bumped | CommunityBot | This question has answers that may be good or bad; the system has marked it active so that they can be reviewed. | |
| Sep 2, 2022 at 10:06 | history | bumped | CommunityBot | This question has answers that may be good or bad; the system has marked it active so that they can be reviewed. | |
| May 5, 2022 at 10:05 | history | bumped | CommunityBot | This question has answers that may be good or bad; the system has marked it active so that they can be reviewed. | |
| Jan 5, 2022 at 10:02 | history | bumped | CommunityBot | This question has answers that may be good or bad; the system has marked it active so that they can be reviewed. | |
| Dec 7, 2021 at 7:28 | comment | added | Filip Milovanović | No, there's no interaction/communication there. Depends on what else you're doing, but one way would be $company->attemptLogin($credentials, 'callbackOnSuccess', callbackOnFailure'), where the success callback could accept the token and do something with it, and the failure callback could accept an object (or just a string) describing why login failed. Or, instead of a callback, you could pass a full-blown object to call methods on. Or if that doesn't quite work, adjust the design, maybe introduce an intermediate object that you can call, then reveal state to it, but not to the callers. | |
| Dec 7, 2021 at 2:18 | comment | added | Khuram | If you mean to this: $company->state->login(); along with $user->state->login(); then it doesn't make sense to me. Because a user can login but a company cannot login. But the state of the company along with the state of the user decides if the user should login or not. Can you please explain with code? | |
| Dec 6, 2021 at 12:30 | comment | added | Filip Milovanović | You shouldn't ask what the state of the company is - that's internal to the company object, it's an internal representation that should be invisible to you ("you" meaning the calling code). You should ask the company object to attempt a login, let it internally process the request & determine how to respond based on its state, before returning control back to the caller. The caller can then decide how to deal with the response. Remember - write things in terms of communicating encapsulated objects. | |
| Dec 6, 2021 at 9:45 | answer | added | Bart van Ingen Schenau | timeline score: 1 | |
| Dec 6, 2021 at 3:25 | comment | added | Khuram | currently the user can be the part of only one company not more than one or zero | |
| Dec 5, 2021 at 20:12 | comment | added | Erik Eidt | What is the relationship between User and Company? Can a User be part of zero or more Companies? | |
| Dec 5, 2021 at 18:49 | history | asked | Khuram | CC BY-SA 4.0 |