The high-level design approach of Slate Kit primarily involves an emphasis on simplicity and practicality while following best practices. There are certain items we avoid or specifically use ( see below ). We try to maintain a healthy balance between delivering new features, implementing new concepts, supporting valid and common use-cases, and incorporating functional programming as much as possible. Some of our other design choices include the following:
Use data classes for easier immutable functionality
Use higher order functions ( functions as parameters/return values )where applicable.
Use Kotlin Coroutines/JVM Futures for asynchronous processing. TODO: This is something we have to do in some areas
The following concepts, while currently used, will be incorporated in more areas in the near future
Prefer class types rather than Strings/Numbers to represent values.
E.g. Represent an email address via an Email data class vs a String
Kotlin Builders will be used for constructing various components
Tail recursion as an alternative to other looping constructs and to avoid vars.
Use a function / callback to abstract IO when applicable. This facilitates unit-tests.
E.g. writer:(String) -> Unit instead of println directly or
E.g. writer:(Request) -> Response instead of Http.post directly