Skip to main content

Questions tagged [conditions]

18 votes
7 answers
4k views

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 (...
Ellen Spertus's user avatar
19 votes
7 answers
5k views

I am working in small company, having a lead position in a group of 5. We are developing a C++ application. One requirement is that it needs to run fast. Today, I noticed one function, say f1(), and ...
Jason Cho's user avatar
  • 301
1 vote
1 answer
340 views

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'...
Ahmad Ahmad's user avatar
5 votes
5 answers
1k views

I've set up a ternary operator in place of a pile of if-else's, the final expression being nullptr in order to finish the loop, like so: int menuSelect; std::string operation=""; (...
Hench's user avatar
  • 61
0 votes
4 answers
222 views

I have the existing code provided below: if (!$existing_records && !$has_required_field) { return 'Skip Update, no records found'; } elseif (!$existing_records && $...
Muhammad Dyas Yaskur's user avatar
0 votes
2 answers
179 views

In a library, there could exist three types of functions. The first are those which are visible to the user i.e. their declarations are installed in the library's include directory. The third are ...
Nitin Malapally's user avatar
0 votes
1 answer
216 views

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 ...
Codemenot's user avatar
4 votes
2 answers
364 views

I have a class (as a protobuf) OrderChange, that represents when an order (imagine Amazon.com) changes: message OrderChange { Order old_order = 1; Order new_order = 2; } message Order { ...
onepiece's user avatar
  • 169
2 votes
1 answer
3k views

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, ...
Chibueze Opata's user avatar
3 votes
4 answers
850 views

I am curious about it because I talked with a friend about the strategy pattern, and we diverge about when we have to use it. Our scenario is that I have to build a view component with 3 variants. All ...
ViTUu's user avatar
  • 139
2 votes
1 answer
299 views

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" ...
Neil McGuigan's user avatar
3 votes
0 answers
103 views

I have an app where every object is checked based on various types of business rules. For this, i used multiple nested if-else statement which was done in one class. I am not happy with this situation ...
Arife Kübra's user avatar
3 votes
1 answer
4k views

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 ...
Tim's user avatar
  • 5,565
-2 votes
1 answer
818 views

I have the below default method in an interface and it seems to be pretty complex because of the many if-else conditions. default void validate() { Application application = application().get(); ...
AnOldSoul's user avatar
  • 173
-2 votes
1 answer
985 views

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 ...
lucasvc's user avatar
  • 141

15 30 50 per page
1
2 3 4 5
9