Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options answers only not deleted user 131624

Use the [state] tag for questions pertaining to retained information determining the behavior of a program.

2 votes

How to implement a counter without global state?

What makes global state difficult is different. You can keep stuff in global state without giving everything access to it. … Global state prevents you from creating more than one task cleanly. It isn't that global state is bad. It has many good uses. …
candied_orange's user avatar
68 votes

How to keep applications stateless

Here's a simplified model: Web Browser (has state) <-> Web Server (stateless) <-> Database (has state) This could work for Software Engineering Stack Exchange. … If someone tries to do a denial of service attack, they can't use web server state resources to do it, because the web server doesn't allocate any state for them between sessions. …
candied_orange's user avatar
5 votes

How to to send a file and record that it has been sent in an atomic way?

I think this is about meaningful state. Right now you have three possible states. The object's uploaded field is true, it's false, or the objects record doesn't exist. …
candied_orange's user avatar
6 votes

What to do when an aggregate is given a bad event?

The problem is that you're calling it an event. Events are reports of what has happened. They can't fail because they're over and done with. Since this hasn't happened yet, and it can still fail, it' …
candied_orange's user avatar
3 votes

Why does "a consistent, understandable interface" differentiates database from global states?

Well in one way a DB has the same problem that a global does: Shared mutable state. "a consistent, understandable interface" code differentiates from accessing global variables? … Measure the temperature with some instrument and report that to anything that asks and you have a shared mutable state. …
candied_orange's user avatar
2 votes

Best way to display errors from a model to the user?

These models data would never be out of sync with their state flag, making them thread safe, easier to read, and easier to debug. …
candied_orange's user avatar
5 votes

Is global state really always bad?

Sometimes it's about what you make me read. When I'm debugging something that relies on a mutable global variable (sorry, depends on) you force me to go read anything that writes to it to understand h …
candied_orange's user avatar
0 votes

Why is Dependency Injection called "alternative of global state"?I think global state still ...

Global state and static memory are not the same thing. Once state becomes global you can access it from anywhere. … Here we see two pages accessing state that will live as long as main. Yet they aren't sharing the same variable unless you declared clickCount static. …
candied_orange's user avatar
0 votes

Java Library - How to do Pure Dependency Injection When State is a Factor?

The composition root is where long lived objects are constructed. Build em in main and they die when main dies. But not everything lives that long or is born that early. These other, short lived objec …
candied_orange's user avatar
23 votes
Accepted

Is there a clean way to model methods that only make sense depending on the current state of...

There's not a lot of reason to break up these steps as different state transitions. But if you really can't stand allowing a abort call to happen when in the wrong state then this works. … However, consider the GoF's State Pattern. With this design you could always call abort. Even when it didn't make sense. And it wouldn't have to do type checking. …
candied_orange's user avatar