You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Most of the time, JB is described as an anti-pattern. Getters and Setters kills the encapsulation by making private attributes public. In the case of a OOP language, this is something we have to think twice when considering JB. However, in the case of Zig, there no OOP and there are (and will be) no private attributes for structs.
With this state of the art in mind, we consider that using JB should improve maintainability.
Here the accepted proposal of a modified JB:
A struct should have:
mandatory getters: NEVER use attributes outside of getters
prefixed attributes (with __): to make an easy distinction between attrbutes and methods: NEVER use attributes outside of getters and init ()
mandatory init: NEVER use a struct constructor outside of init function
immutable setters: NEVER mutate the value of an attribute (outside or inside the struct), ALWAYS build & return a new object from the struct
Most of the time, JB is described as an anti-pattern. Getters and Setters kills the encapsulation by making private attributes public. In the case of a OOP language, this is something we have to think twice when considering JB. However, in the case of Zig, there no OOP and there are (and will be) no private attributes for structs.
With this state of the art in mind, we consider that using JB should improve maintainability.
Here the accepted proposal of a modified JB:
__
): to make an easy distinction between attrbutes and methods: NEVER use attributes outside of getters and init ()[TODOLIST] Make those changes in:
The text was updated successfully, but these errors were encountered: