... | @@ -91,6 +91,12 @@ Adding a more descriptive name to the `Subnet` structure can be tempting, but le |
... | @@ -91,6 +91,12 @@ Adding a more descriptive name to the `Subnet` structure can be tempting, but le |
|
|
|
|
|
It is ok to have the same structure name in multiple packages because the package names differ. For example, we already have `keaconfig.Subnet` and `dbmodel.Subnet`. The structure name is the same but they are two different objects.
|
|
It is ok to have the same structure name in multiple packages because the package names differ. For example, we already have `keaconfig.Subnet` and `dbmodel.Subnet`. The structure name is the same but they are two different objects.
|
|
|
|
|
|
|
|
## Interface Names
|
|
|
|
|
|
|
|
According to [Effective Go](https://go.dev/doc/effective_go), one-method interfaces are named by the method name plus -er suffix (e.g., Writer, Reader etc). We follow this convention.
|
|
|
|
|
|
|
|
Another frequent case is an interface with multiple methods returning different properties. Such interfaces should be named after the object these properties belong to, plus the word `Accessor`. For example, an interface returning subnet properties can be called `SubnetAccessor`.
|
|
|
|
|
|
## Getters and Setters
|
|
## Getters and Setters
|
|
|
|
|
|
We require that getters and setters in Stork include the `Get` and `Set` prefixes. Even though the Effective Go document explicitly says that these prefixes are neither idiomatic nor required, we decided to use them because they make clear distinction between the getters and setters. Also, that's the naming convention used in other ISC projects.
|
|
We require that getters and setters in Stork include the `Get` and `Set` prefixes. Even though the Effective Go document explicitly says that these prefixes are neither idiomatic nor required, we decided to use them because they make clear distinction between the getters and setters. Also, that's the naming convention used in other ISC projects.
|
... | | ... | |