Skip to content
Imran Rashid edited this page Mar 30, 2017 · 2 revisions

Here's some tips we've learned from our own use of Sumac. Nothing here is critical, but we've found it helps over the long run.

Create your own trait that extends FieldArgs

If you are going to re-use your arg-holders in a large codebase (eg., a set of internal tools inside a company), then I'd strongly suggest you start by making your own trait that extends FieldArgs with an empty definition, and use it everywhere

import com.quantifind.sumac.FieldArgs
trait OurAwesomeCompanyArgs extends FieldArgs

trait AppArgs extends OurAwesomeCompanyArgs {
  var count = 10
  var name = "blah"
  ...
}

The reason to do this is so that you've got a common place to put any customization you might add. Eg., you might add custom parsers or validation down the line. Now you've got a common place to put them, so that they can be shared by your entire codebase.

Clone this wiki locally