Skip to main content
added 6 characters in body
Source Link
Nae
  • 197
  • 6

Is it bad practice to add false or ... or true and ... for the sake of promoting code genericness and/or ease of use?

As in:

SELECT * FROM table WHERE TRUE  AND IsEnabled  AND SomeField = some_value  AND SomeOtherField != some_value 

in SQL or in javascript for example:

if (false || prop === 'category' || prop === 'subCategory' || prop === 'productLogisticGroup' || prop === 'productName' || prop === 'color' || prop === 'configuration' ) 

This lets adding or removing conditions a little easier by removing the thinking process whether the condition is on the edge or not. Is this bad in someway?

Is it bad practice to add false or ... or true and ... for the sake of promoting code genericness and/or ease of use?

As in:

SELECT * FROM table WHERE TRUE AND IsEnabled AND SomeField = some_value AND SomeOtherField != some_value 

in SQL or in javascript for example:

if (false || prop === 'category' || prop === 'subCategory' || prop === 'productLogisticGroup' || prop === 'productName' || prop === 'color' || prop === 'configuration' ) 

This lets adding or removing conditions a little easier by removing the thinking process whether the condition is on the edge or not. Is this bad in someway?

Is it bad practice to add false or ... or true and ... for the sake of promoting code genericness and/or ease of use?

As in:

SELECT * FROM table WHERE TRUE  AND IsEnabled  AND SomeField = some_value  AND SomeOtherField != some_value 

in SQL or in javascript for example:

if (false || prop === 'category' || prop === 'subCategory' || prop === 'productLogisticGroup' || prop === 'productName' || prop === 'color' || prop === 'configuration' ) 

This lets adding or removing conditions a little easier by removing the thinking process whether the condition is on the edge or not. Is this bad in someway?

Tweeted twitter.com/StackSoftEng/status/1260449697975713793
Became Hot Network Question
added 1 character in body
Source Link
Nae
  • 197
  • 6

Is it bad practice to add false or ... or true and ... for the sake of promoting code modularitygenericness and/or ease of use?

As in:

SELECT * FROM table WHERE TRUE AND IsEnabled AND SomeField = some_value AND SomeOtherField != some_value 

in SQL or in javascript for example:

if (false || prop === 'category' || prop === 'subCategory' || prop === 'productLogisticGroup' || prop === 'productName' || prop === 'color' || prop === 'configuration' ) 

This lets adding or removing conditions a little less easier by removing the thinking process wetherwhether the condition is on the edge or not. Is this bad in someway?

Is it bad practice to add false or ... or true and ... for the sake of promoting code modularity and/or ease of use?

As in:

SELECT * FROM table WHERE TRUE AND IsEnabled AND SomeField = some_value AND SomeOtherField != some_value 

in SQL or in javascript for example:

if (false || prop === 'category' || prop === 'subCategory' || prop === 'productLogisticGroup' || prop === 'productName' || prop === 'color' || prop === 'configuration' ) 

This lets adding or removing conditions a little less easier by removing the thinking process wether the condition is on the edge or not. Is this bad in someway?

Is it bad practice to add false or ... or true and ... for the sake of promoting code genericness and/or ease of use?

As in:

SELECT * FROM table WHERE TRUE AND IsEnabled AND SomeField = some_value AND SomeOtherField != some_value 

in SQL or in javascript for example:

if (false || prop === 'category' || prop === 'subCategory' || prop === 'productLogisticGroup' || prop === 'productName' || prop === 'color' || prop === 'configuration' ) 

This lets adding or removing conditions a little easier by removing the thinking process whether the condition is on the edge or not. Is this bad in someway?

Source Link
Nae
  • 197
  • 6

Is it bad practice to add "false or" or "true and" to conditionals?

Is it bad practice to add false or ... or true and ... for the sake of promoting code modularity and/or ease of use?

As in:

SELECT * FROM table WHERE TRUE AND IsEnabled AND SomeField = some_value AND SomeOtherField != some_value 

in SQL or in javascript for example:

if (false || prop === 'category' || prop === 'subCategory' || prop === 'productLogisticGroup' || prop === 'productName' || prop === 'color' || prop === 'configuration' ) 

This lets adding or removing conditions a little less easier by removing the thinking process wether the condition is on the edge or not. Is this bad in someway?