Skip to main content

Questions tagged [state]

The State pattern is used to represent the internal state of an object and to encapsulate varying behavior for the same object based on its state. This can be a cleaner way for an object to change its behavior at runtime without resorting to large monolithic conditional statements and thus improve maintainability.

1 vote
1 answer
111 views

I'm new to Flutter and BloC and it just seems quite different than what I've been using until now. In terms of state, I'm coming from the JS world of Vuex, Pinia and Redux and I've also worked a with ...
thefallen's user avatar
5 votes
1 answer
546 views

I am working on a website using .NET Razor Pages. I have multiple pages that share JavaScript code. I'm using vanilla JavaScript. I have to perform actions related to mapping using leaflet. Most of ...
Yohannes Kifle's user avatar
3 votes
1 answer
132 views

I am implementing authentication with the Spotify web API as part of a larger project. Yes I know there are already crates that can handle it for me but that is no fun. I am implementing the auth code ...
flakpm's user avatar
  • 77
6 votes
3 answers
978 views

Intro This post continues the A chess engine in Java: generating white pawn moves. I was advised to choose between efficiency and type safety. Since this is my first attempt at a chess engine, I have ...
coderodde's user avatar
  • 32.3k
9 votes
4 answers
2k views

(This post has now a continuation.) I decided to embark on implementing my own chess engine. The first (and perhaps most demanding) part of that endeavour is generating child states out of a given ...
coderodde's user avatar
  • 32.3k
2 votes
1 answer
143 views

I have a working code to have 2 search bars with dropdown suggestions, selectable by both mouse and arrow keys in TypeScript and Fresh/Preact. In there I have to explicitly declare individual hooks ...
Ooker's user avatar
  • 201
5 votes
1 answer
269 views

I try to program a small app to track my cost spendings. As state management I use Cubit. As I am a flutter beginner, I wanted to verify if I implemented it correctly. The UI consists of 2 screens: 1 ...
Rasputin221's user avatar
-2 votes
2 answers
150 views

Using plain JavaScript, I want to load an array of objects, display the first one in a Bootstrap Card, and then click a button to advance to the next one. Focusing only on the point of getting the ...
AimFireReady's user avatar
2 votes
1 answer
96 views

Consider the following code: ...
prestokeys's user avatar
  • 1,401
1 vote
1 answer
114 views

I am working my way through a React tutorial on Scrimba (I am not finished yet). I got to a certain part that inspired me to try a project on my own. I made a game of Lights Out. If you've never heard ...
apex2022's user avatar
  • 161
3 votes
1 answer
419 views

Take this basic component using state: ...
user8758206's user avatar
0 votes
1 answer
136 views

I have a settings section to my UI which keeps track of a myriad of user settings. The settings are requested from an API when the app loads, and then used in the section to populate what the user's ...
Seth Lutske's user avatar
1 vote
1 answer
328 views

I previously asked for a review for a Vending Machine implementing State Pattern in this linked post. And received an answer from @radarbob. The code below is my revised attempt based on some of @...
fourbeatcoder's user avatar
5 votes
1 answer
621 views

I was asked to implement a Vending Machine in a recent interview coding challenge. My attempt at a solution is based on the state pattern. I would like to get some code reviews on this bearing in mind ...
fourbeatcoder's user avatar
6 votes
1 answer
2k views

An app has a feature that's much like any calendar application (like the Outlook calendar for example). Consequently, I need to do a lot of date logic. I wrote a class with date calculation methods ...
user2190492's user avatar

15 30 50 per page
1
2 3 4 5 6