Questions tagged [default-values]
The default-values tag has no summary.
19 questions
0
votes
1
answer
67
views
Wrapper Auxiliary Method VS Default Arguments for Initialization: Pros/Cons
I have a class in which there are several methods that can act as an "entry point" to its private innards (or the "fruit" thereof).
Said functions might be called multiple times ...
12
votes
5
answers
7k
views
Should an optional boolean function argument rather default to true or false?
In many cases I can formulate some boolean parameter equally well positively as negatively, e.g. isOn or isOff. Which one should I pick then, in case I want the argument to have a default value? Is ...
-1
votes
2
answers
7k
views
Should I assign a default value for this property in the constructor?
I'm currently creating a class in C# that will be utilized to help standardize calls to restful web services in my company's code. While the majority of my code has been written and well tested, I ...
-2
votes
1
answer
69
views
Should a CLI wrapper specify function defaults?
In my code let's say I have a function which does most of the work:
def compute(x=3, y=5):
...
And I have a CLI wrapper program using argparse. I intend end users to use the CLI program and not ...
0
votes
2
answers
638
views
Should default values be explicitly stated in configuration files for libraries or frameworks?
In one of the projects I work for, we have just added karma to run unit tests.
When reviewing the MR of a coworker, I noticed the karma.conf.js (the configuration file) has 120 lines, which seems to ...
5
votes
3
answers
9k
views
Is it necessary for a boolean to be "false" by default?
For example, to store whether sound is on, I have a boolean originally named "isSoundOn":
private boolean isSoundOn=true;
however, the default value of boolean is false, but I want my application to ...
3
votes
2
answers
2k
views
Should default configuration for deployed services be set as per production usage?
Today, I and my colleague had a difference of opinion regarding the usage of default values in software configuration. We both agreed that for a consumer software, the default configuration should be ...
1
vote
4
answers
3k
views
What should be the last entry in a switch/case statement?
When writing a switch statement that only ever has to deal with a known set of values (imagine an implicit enumeration), I find myself wondering what should be the last entry in the construct. I'm ...
3
votes
1
answer
516
views
Miroservices default value for Fallback scenarios
Default values are often suggested to be part of failover mechanism for microservices. At a high level, for any services (say microservices here) the nature of the operation can be broadly classified ...
0
votes
1
answer
103
views
Is there a normal way to program a CLI script that overrides default parameters in python
If I've got a script that uses a config file (or defaults to a generic config file) that calls another module which needs the config file passed to it as a parameter should I always
File 1 (the ...
3
votes
3
answers
437
views
Can a default value for a business process be set in the database column definition?
The business team in my company has come up with a new field to add to one of our entities. For new instances of this entity, it'll be calculated dynamically, but for previously existing instances, we ...
4
votes
1
answer
5k
views
Assigning default values from environment variable in Node.js
When attempting to set default values for parameters that may exist in environment variables in JavaScript, I often see this pattern:
var lag;
try {
lag = process.env.THROTTLE_LAG;
}
catch ( e ) ...
3
votes
1
answer
10k
views
OOP best practice: Optional referenced-type parameter
I know in C#, by default, referenced type variables are passed by reference to a method. I have a function which sometimes I just need its return value and sometimes both return value and the changes ...
0
votes
3
answers
1k
views
How can DB and UI agree on default values?
I created a table in a Postgres database. I would like to create a form in a Java application to insert rows into that table. Certain fields have default values. What is the best way for the database ...
4
votes
6
answers
2k
views
Is it bad practice to resolve null arguments to default static variables?
First, let me show you an example (written in ActionScript 3.0):
class GameObject {
public static function MakeFromName( pName:String,
pAtlas:TextureAtlas ...