state-pattern Questions

3

Solved

I understand that the State pattern can be used to model objects that changes behavior depending on the state and the various states that the Context can have is encapsulated in concrete classes th...
Aluminum asked 21/1, 2013 at 7:33

21

What are the differences between the Strategy design pattern and the State design pattern? I was going through quite a few articles on the web but could not make out the difference clearly. Can so...
Feverish asked 1/11, 2009 at 20:11

8

Solved

I have something to do for work and I need your help. We want to implement a FSM - Finite State Machine, to identify char sequence(like: A, B, C, A, C), and tell if it accepted. We think to implem...
Goodell asked 4/11, 2012 at 17:46

7

I wonder if a state machine is just the state pattern at work or if there is actually a difference between those two? I found this article with the bold title "the state design pattern vs state ma...
Natalee asked 8/11, 2013 at 12:49

2

Solved

I'm reading about the State pattern. I have only just begun, so of course I begin by reading the entire Wikipedia article on it. I noticed that both of the examples in the article have some base a...
Hengist asked 28/5, 2010 at 17:55

0

I've been looking for a natural way to implement state-dependent behaviour (state machines) in Python objects. The goal was for objects to have a small number of states, or "mutually orthogonal" as...
Crossroad asked 6/5, 2019 at 15:7

5

I am new to the State design pattern and I can't find a proper example of saving different states of an object to the database (SQL Server in my case). The scenario is quite similar [almost identic...
Ashtonashtonunderlyne asked 21/5, 2014 at 10:23

0

Let's say I have an element with 3 states: state1, state2, state3. The most basic flow is: state1 -> state2 -> state3 -> state1 -> ... etc. The states are changed on button click. I implement...
Vennieveno asked 20/11, 2017 at 17:16

2

Solved

I'm looking for an example of where the State design pattern has been used to solve or simplify interesting or complicated state transitions. There are plenty of examples with three or four simple ...
Japeth asked 22/9, 2010 at 11:23

3

Solved

I am learning design pattern in java I was doing through some of links.I am trying to design a washing machine by state pattern I have a query regarding the implementation of state design pattern...
Emitter asked 29/10, 2016 at 10:31

2

Solved

I'm trying to instigate a simple State pattern, after following some of the excellent tutorials here: http://gameprogrammingpatterns.com/state.html I am half way through this current tutorial, and...
Columniation asked 29/8, 2016 at 11:18

3

Update: State pattern might a wrong way to solve this. Hence, any other pattern is welcome. Basically I'm looking for a way to have guard conditions for each state yet having a clean and maintaina...
Perryperryman asked 1/7, 2015 at 7:49

8

Solved

I've encountered a few implementations of state pattern in my programming experience, and done a few. I've seen them used in various scenarios (mostly UI and parsing). The trouble is that all of th...
Umlaut asked 8/2, 2011 at 16:48

2

Solved

I have read the previous stack exchanges on replacing conditional logic in Java such as IF/ELSE with State/Strategy patterns but I am not sure whether my case is a proper fit for the replacement. ...
Polyanthus asked 26/10, 2014 at 8:57

3

Solved

Memento design pattern is used for restoring objects to previous state, like undo. But we can do undo and redo multiple times. I have read articles multiple times but still unclear to me as to are ...
Quiteris asked 24/8, 2013 at 15:53

2

Solved

I am currently developing a project in MVC 3. I've separated my concerns so there are projects such as Core, Repository, UI, Services etc. I have implement the Repository, UnitOfWork and most impor...

7

Solved

I have a little problem that involves modeling a state machine. I have managed to do a little bit of knowledge engineering and 'reverse engineer' a set of primitive deterministic rules that determ...
Indoaryan asked 24/4, 2010 at 16:15

1

Solved

I've recently been developing a Java application and I've been attempting to follow the GoF's state pattern to attempt to tidy up the code. The program uses a multi-agent system's agents to evalu...
Corselet asked 30/10, 2013 at 17:50

1

Solved

I have a model Enquiry, which can be in one of two states (there are more but for the purposes of this I will just compare two): New and Closed. The state the enquiry is in is dependant upon what a...

1

Solved

I'm still trying to understand the dangers of circular references. I often read that they should only be used in rare cases. But, in the canonical State Pattern, the "state" objects need to referen...
Procurer asked 22/7, 2012 at 5:53

5

I have the following problem: I am trying to model a process using GWT, where i have a couple of views with a couple of submit buttons. And pressing button1 will create a server interaction and if ...
Noncooperation asked 11/7, 2012 at 8:59

2

Solved

From time to time it's need to make support for states for objects. As I understand there are two approaches: ENUM (SIMPLE) STATE pattern (OC principle) it's evident that need to use State patt...
Valorous asked 25/5, 2012 at 9:47

2

Solved

I have an implementation of a State Pattern where each state handles events it gets from a event queue. Base State class therefore has a pure virtual method void handleEvent(const Event*). Events i...
Marler asked 23/5, 2012 at 11:13

1

Solved

We often use simple enumerations to represent a state on our entities. The problem comes when we introduce behaviour that largely depends on the state, or where state transitions must adhere to cer...
Clintclintock asked 4/4, 2012 at 13:13

1

Solved

Doctrine2 docs said that soft-delete behavior should be better implemented as a State pattern But not provide any example of that implementation. How to achieve soft delete behavior using a state ...
Approximation asked 20/2, 2012 at 11:8

© 2022 - 2025 — McMap. All rights reserved.