Questions tagged [conditions]
The conditions tag has no summary.
131 questions
18 votes
7 answers
4k views
Is there a reason "replace conditional with table" isn't a standard refactoring?
I'm preparing a lecture where I will start with a many-branched conditional statement and replace it with a table. For example, I could start with: function getMonthName(monthNumber) { if (...
1 vote
1 answer
337 views
Could conditions be used with Data Flow Diagrams?
I'm trying to make a DFD for this scenario: after admission, the patient gets the service he needs. I've been trying to do it using this diagram (there are 3 available services): but I don't think it'...
0 votes
4 answers
222 views
Should we create a new function for every multiple conditions?
I have the existing code provided below: if (!$existing_records && !$has_required_field) { return 'Skip Update, no records found'; } elseif (!$existing_records && $...
0 votes
1 answer
215 views
Many if conditions
I have the code but I want to be pseudo as possible so I learn from other ways as much as possible. So what I am building is web based tool and in one section we have a table. This table renders lines ...
2 votes
1 answer
3k views
Multiple if condition optimization
Often I find conditional statements such as: if (life_max < max): if (expand): do life_max = max else: if (life_max > max) and not (expand): do life_max = max; Although readable, ...
2 votes
1 answer
298 views
What is the name of this pattern / style?
We have a "workflow orchestration" system at work. It works something like this: You configure what to run (in a database table), such as: NameOfStepATHingToRun ="weather_data" ...
3 votes
1 answer
4k views
Why does a condition variable's wait() release the associated mutex before blocking and reacquire it before returning?
Stallings' Operating System book says about condition variable in Solaris, A condition variable is used to wait until a particular condition is true. Condition variables must be used in ...
-2 votes
1 answer
982 views
Conditional command pattern
I have an abstraction that defines something like a command pattern, interface Participant { void proceed(); } Participants are grouped in a collection and are called all together. But each ...