On Tue, Oct 12, 2021 at 6:07 AM 'Daniel Beck' via Jenkins Developers <
[email protected]> wrote:

> new options are often phrased so the legacy default behavior corresponds
> to the default field value ("dontDoWhatever" field names are common).
>

To be clear, use of the negative sense makes for terrible UI and confusing
APIs, so your *public* interfaces should refer to a `doWhatever` / “Do
Whatever” property if at all possible—just encapsulate the backwards field.

If you do want to name the field intuitively, it is typical to introduce
for example a `Boolean` field where `null` is converted to `true` either in
`readResolve` or on demand in a getter.

Note that the `configuration-as-code` plugin deals with public
constructor/getter/setter pairs, as does Pipeline when defining steps,
unlike the `config.xml` XStream storage used on disk and also in some
REST(ish) APIs and CLI commands which deals with fields and the serial form.

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-dev/CANfRfr22oHSq5QmMYErrPPKPPsfg%3Dr1eCWfWwNr8sT29f-j4_g%40mail.gmail.com.

Reply via email to