Questions tagged [state]
Use the [state] tag for questions pertaining to retained information determining the behavior of a program.
168 questions
2votes
3answers
146views
Handling user strategy choice over many strategy patterns
I’m building a framework with many parallel implementations of strategy patterns, and I want to know the best way to handle the user’s choice of the set of strategies. E.g. I want to calculate the ...
4votes
3answers
315views
Clearing static state before testing each method
My SUT class depends on external static state (which generally should be avoided, I know). How do I make sure my tests do not depend on their order of execution? I mean other by introducing some reset(...
0votes
1answer
493views
Global Variables State Management
Background: I am working in a Java environment using Spring Boot, where I often encounter scenarios where global variable state management is critical, especially within singleton services. I have ...
0votes
0answers
91views
Best Practices for Managing State in React Applications
I'm currently developing a web application using React and I'm looking for the best practices for managing state effectively. I've come across several methods such as using the Context API, Redux, and ...
2votes
7answers
444views
Why does "a consistent, understandable interface" differentiates database from global states?
According to some answers of How are globals any different from a database? that explains how database is different from global state: https://softwareengineering.stackexchange.com/a/319389 https://...
0votes
1answer
171views
Complex stateful logic in MVVM architecture
I'm building a mobile app in Flutter, and the project has several distinct layers. The top part is something better described as MVVM: dumb View layer that performs rendering and delegates actions to ...
0votes
1answer
167views
when would I need state management like redux in my e commerce app?
I am new to React and web development generally so please try to understand if the question seems dumb. So, I am currently making a simple e-commerce app and I was thinking of using state management ...
13votes
4answers
5kviews
Is there a clean way to model methods that only make sense depending on the current state of the object?
Let's say that I have a class called Mission. This class is intended to represent a mission requested by a professor working in a faculty. Mission has a private enum field representing whether the ...
1vote
5answers
370views
Is storing computed values always bad?
Edit: I'm copying the question but changing the example code. Apparently, I used a bad example earlier that contained an imprue getter. I'm keeping the old example code at the bottom so the first ...
1vote
3answers
477views
Why is Dependency Injection called "alternative of global state"?I think global state still exists
According to Why is Global State so Evil?, I believe we should avoid global state, so suppose I have an App that count user clicks in all pages like it: public class GlobalState{ public int ...
-2votes
1answer
239views
Is it OK to stick with object graph in React State and should I make helpers for handling it?
I am trying to build ERP application using React frontend and I have not found decisive answer whether to use object graphs in React state? E.g. I would like to build Invoice view and I have the ...
0votes
1answer
70views
Including currect user/roles data within object state in .Net applications to control object behavior
I am building a .Net Core Blazor Server application. The application creates records of a Project class which move through a workflow with various phases of review and acceptance/rejection before ...
-1votes
1answer
358views
When does a REST API stops being one in terms of state management?
As far as I understand, there is no certain boundaries for the RESTness of an API. However, I would like your help to understand how large and long (in terms of running time) a caching or state ...
1vote
1answer
236views
Are there any drawbacks to partial application?
Consider the following Typescript code: function exampleAction(target: Target, options: ExampleActionOptions) { // ... } export function getExampleAction(options: ExampleActionOptions) { return (...
3votes
2answers
438views
How to implement a counter without global state?
I have read many blogs and stack exchange posts about global state (usually) being bad practice. I'm now trying to avoid this where possible in my code, but I'm running into a case where I don't know ...