hyperledger / iroha

Iroha - A simple, enterprise-grade decentralized ledger
https://wiki.hyperledger.org/display/iroha
Apache License 2.0
421 stars 275 forks source link

Immutable configuration #4282

Open mversic opened 4 months ago

mversic commented 4 months ago

I would prefer config to have private fields with constructors and getters for the following reasons:

  1. consistency - access to some fields has to be done through getters because the value has to be converted
  2. maintaining invariants - sometimes config params are interdependent,
    1. future proofing - we can change the underlying type without affecting the API

setters we can but don't even have to have. I wouldn't mind if the config structs were completely immutable. If we do decide to have setters we can put validation logic into them. But I would prefer to not have setters at least atm

mversic commented 4 months ago

you can find more info in discussion here

0x009922 commented 2 months ago

@VAmuzing, you might need to consider changes https://github.com/hyperledger/iroha/pull/4456

0x009922 commented 1 month ago

@mversic is it still relevant?

mversic commented 1 month ago

yes