Skip to main content
Share Your Experience: Take the 2024 Developer Survey

Questions tagged [default-values]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
9 votes
5 answers

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 ...
DaveFar's user avatar
  • 1,426
-1 votes
2 answers

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 ...
Hazel へいぜる's user avatar
-2 votes
1 answer

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 ...
qwr's user avatar
  • 343
0 votes
2 answers

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 ...
Gonzalo.-'s user avatar
  • 161
5 votes
3 answers

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 ...
ocomfd's user avatar
  • 5,712
3 votes
2 answers

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 ...
Mukul Gupta's user avatar
1 vote
4 answers

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 ...
Dev-iL's user avatar
  • 233
3 votes
1 answer

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 ...
Divs's user avatar
  • 187
0 votes
1 answer

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 ...
Peter Turner's user avatar
  • 6,915
3 votes
3 answers

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 ...
user3748908's user avatar
  • 1,647
4 votes
1 answer

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 ) ...
msanford's user avatar
  • 750
3 votes
1 answer

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 ...
Ahmad's user avatar
  • 1,826
0 votes
3 answers

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 ...
Reinstate Monica's user avatar
4 votes
6 answers

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 ...
chamberlainpi's user avatar
1 vote
2 answers

Design Pattern: Algorithm varies according to the input arguments

I will give a simple example to help you understand my question. Suppose we have a rectangle and a Utility class with a method that creates a buffer arround a shape. The .createBuffer method has ...
jorgeb's user avatar
  • 11
2 votes
1 answer

Does automatic returning affect performance?

There's a bunch of languages that automatically return the last value in a function (mostly functional) like Ruby, Haskell, Lisp, etc. Does this feature (or what do you call it) affect the ...
UncleLaz's user avatar
  • 129
2 votes
3 answers

Checking at javascript level vs checking in PHP?

Setup: We've got a form with default text values present within the text box itself which "goes away" when I click on them and enter a value (not if I dont enter a value). Currently the 'default' ...
siliconpi's user avatar
  • 205
4 votes
5 answers

The Default State of Unused Memory

In an embedded device, during the initializing of memory locations, is there any convention that are being practiced. I mean, say setting every byte to zero or 0xFF or any other value.
Shamim Hafiz - MSFT's user avatar