mercredi 4 novembre 2020

Is it correct to expose properties on a builder pattern

Assuming I have this builder:

class XXXBuilder {
    let propertyA: Int

    func setPropertyA(value: Int) -> XXXBuilder {...}

    func build() -> XXX { ... }
}

Is it OK to have propertyA as public? or should all the properties should be private?

TIA

Aucun commentaire:

Enregistrer un commentaire