measurement-kit / engine

[DEPRECATED] Measurement Kit engine written in Go
https://measurement-kit.github.io/
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

DESIGN.md: we can cut complexity by auto-generating getters/setters #15

Closed bassosimone closed 5 years ago

bassosimone commented 5 years ago

When re-reading the spec and discussing it with @evfirerob, it turned out that it's possible to reduce the code bloat required to maintain the Go API, by writing:

type Foo struct {
  Bar string

rather than

type Foo struct {
  bar string
}

func (foo *Foo) Bar() string {
  return foo.bar

at the cost of having Go always automatically generating getters and setters for all public attributes, where often only a getter or a setter would be needed.

We should therefore amend the spec to use this option. The reason to do so is that it reduces the toil entailed by maintaining the API. It's also important to mention that we're writing a Go API that you can upgrade from C++ rather than a 100% compatible API.

bassosimone commented 5 years ago

This is now merged in master