iluwatar / java-design-patterns

Design patterns implemented in Java
https://java-design-patterns.com
Other
90.08k stars 26.61k forks source link

Finite State Machine pattern #203

Open stephen-lazarionok opened 9 years ago

stephen-lazarionok commented 9 years ago

Description: The Finite State Machine (FSM) design pattern is a behavioral design pattern used to model the behavior of a system that can be in one of a finite number of states. The system transitions from one state to another in response to external events or internal actions. This pattern is useful in scenarios where an object’s behavior is dependent on its state, and the state can change in response to events.

Main elements of Finite State Machine pattern:

  1. States: Define the possible states the system can be in.
  2. Transitions: Define the rules or conditions that trigger a change from one state to another.
  3. Events: Actions or occurrences that cause state transitions.
  4. Context: Maintains the current state of the system and facilitates state transitions.
  5. State Interface: Defines the behavior associated with each state. Each state implements this interface to define its specific behavior.

References:

Acceptance Criteria:

  1. Implement the FSM pattern with at least three distinct states and the transitions between them.
  2. Create a context class that maintains the current state and handles state transitions based on events.
  3. Provide example scenarios demonstrating the FSM pattern, including state definitions, transitions, and event handling.
iluwatar commented 9 years ago

Hi there @stephen-lazarionok ,

I am aware of the State pattern but unfamiliar with the FSM. Can you point the source of the pattern, web link or some book maybe?

stephen-lazarionok commented 9 years ago

Here is the information about FSM: The description of the pattern FSM in Erlang - very nice explanation The implementation of FSM in Akka

iluwatar commented 9 years ago

Thank you for the links. Especially the first explains the pattern well. We'll accept the pattern once you make the pull request.

stephen-lazarionok commented 9 years ago

Initial pull request is ready - Finite state machine #222. I will add the documentation later as well as include this module to the parent pom.xml later.

amit2103 commented 8 years ago

@iluwatar Can I work on this?

iluwatar commented 8 years ago

@amit2103 Yes, I will change the labels

iluwatar commented 8 years ago

@amit2103 any updates?

amit2103 commented 8 years ago

@iluwatar COmpleted..Writing Junits

iluwatar commented 8 years ago

@amit2103 are you still working on this?

iluwatar commented 7 years ago

No answer, so this issue is free for taking once again.

npczwh commented 4 years ago

@iluwatar I'd like to take this

iluwatar commented 4 years ago

Ok @npczwh

iluwatar commented 4 years ago

@npczwh are you still working on this?

npczwh commented 4 years ago

@iluwatar I've been busy at work these days. It will take me one or two more months to finish this issue. Is that ok?

iluwatar commented 4 years ago

Ok @npczwh, let me know if you need help

ohbus commented 3 years ago

@iluwatar I've been busy at work these days. It will take me one or two more months to finish this issue. Is that ok?

Hey @npczwh, any updates?

npczwh commented 3 years ago

@iluwatar I've been busy at work these days. It will take me one or two more months to finish this issue. Is that ok?

Hey @npczwh, any updates?

@ohbus @iluwatar Sorry for the delay. I didn't have enough time to finish this issue. You can assign it to someone else.

iluwatar commented 3 years ago

The issue is free again

amit2103 commented 3 years ago

Can I take this up @iluwatar https://github.com/iluwatar

On Mon, Jun 21, 2021 at 11:01 PM Ilkka Seppälä @.***> wrote:

The issue is free again

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/iluwatar/java-design-patterns/issues/203#issuecomment-865217445, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABZXKZAFEETNKHZQQR224PDTT5ZQFANCNFSM4BNHSGAA .

ohbus commented 3 years ago

Can I take this up @iluwatar https://github.com/iluwatar

⭐ Sure thing! Thanks for your interest in our project 😃

✔️ Please mention a 📆 timeline 🕙 for when can we expect 🤔 a Pull Request against this issue.

🤝 Looking forward to your contribution. 📖 Be sure to check out our Wiki section

amit2103 commented 3 years ago

Hey Subhrodip,

I can do it by July 15.

Regards

On Tue, Jun 22, 2021 at 2:30 PM Subhrodip Mohanta @.***> wrote:

Assigned #203 https://github.com/iluwatar/java-design-patterns/issues/203 to @amit2103 https://github.com/amit2103.

— You are receiving this because you were assigned. Reply to this email directly, view it on GitHub https://github.com/iluwatar/java-design-patterns/issues/203#event-4921365270, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABZXKZBQEGNA5U7SLN2TGGTTUBGMJANCNFSM4BNHSGAA .

iluwatar commented 3 years ago

@amit2103 are you still working on this?

amit2103 commented 3 years ago

Hey Iluwatar, yeah I got a bit distracted, I will make a PR this week.

Regards

On Sun, Oct 10, 2021 at 12:12 AM Ilkka Seppälä @.***> wrote:

@amit2103 https://github.com/amit2103 are you still working on this?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/iluwatar/java-design-patterns/issues/203#issuecomment-939343581, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABZXKZBFQ4KIA3OEBS4SCNLUGCEJNANCNFSM4BNHSGAA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

iluwatar commented 3 years ago

@amit2103 seriously, are you going to finish this?

iluwatar commented 2 years ago

This issue is free for taking again.

JMZ-kk commented 2 years ago

I want to take this, could you assign it to me?

iluwatar commented 2 years ago

Ok @JMZ-kk

iluwatar commented 2 years ago

@JMZ-kk are you working on this?

JMZ-kk commented 2 years ago

Sorry, I have no more time to work on this now.

------------------ 原始邮件 ------------------ 发件人: "Ilkka @.>; 发送时间: 2022年9月22日(星期四) 凌晨2:12 收件人: @.>; 抄送: @.>; @.>; 主题: Re: [iluwatar/java-design-patterns] Finite State Machine pattern (#203)

@JMZ-kk are you working on this?

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

JanFidor commented 2 years ago

@iluwatar could I pick up this magnificent pattern?

ohbus commented 2 years ago

⭐ Sure thing! Thanks for your interest in our project 😃

✔️ Please mention a 📆 timeline 🕙 for when can we expect 🤔 a Pull Request against this issue.

🤝 Looking forward to your contribution. 📖 Be sure to check out our Wiki section

JanFidor commented 2 years ago

@ohbus Hi, as for 📆 timeline I should be able to make a PR in ~2-3 days, but to eer on the side of caution, it will definitely be finished within a week.

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

iluwatar commented 6 months ago

Updated task description