Skip to content

Commit 902bde3

Browse files
authored
Update README.md
1 parent 2370367 commit 902bde3

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

README.md

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,20 @@ but try to avoid the more advanced FP features that don't translate well to Kotl
1212
## Opinions
1313

1414
* No dependency injection. You simply do not need it.
15-
* It is trivial to pass dependencies through the constructor. Services should be small enough that you don't have
16-
layers upon layers of "services" where passing dependencies around becomes a burden.
15+
* In Kotlin, it is trivial to pass dependencies through the constructor. Services should be small enough that you don't have
16+
a dozen layers of serviceX calling serviceY calling serviceZ, where passing dependencies becomes a layer cake.
1717
* When you use constructors as they were intended, you never have to try and work out where a "bean" is being
1818
instantiated.
19+
* You'll get a compile error if anything is not wired up. As it should be.
1920
* Config as data classes.
20-
* Easy to test because you can simply create the config values you want in tests and pass in an instance of the data
21-
class.
21+
* Easy to test because you can simply create an instance of the data class with whatever values you want to use in a test and pass that into the class.
2222
* No confusion as to where values are being pulled from.
23+
* Startup time resolution on mapping config values to strongly typed values.
2324
* Tests should be real tests
24-
* No mocks. Ever. You don't need them (caveat - you might need them in some tiny edge cases, like testing a legacy
25-
Java interface with 200 methods).
26-
* Test your endpoints by using a framework that treats requests as simple objects.
27-
* Use [test containers](https://testcontainers.com/) for real databases.
25+
* No mocks. Ever. You don't need them (caveat - ok you might need them in some tiny edge cases, like testing a legacy
26+
Java interface with 200 methods when you don't want to create an implementation).
27+
* Test your endpoints by using a framework that treats requests as objects.
28+
* Use [test containers](https://testcontainers.com/) to test against real infrastructure like postgres, kafka, redis, etc. Then you know your SQL will work instead of mocking it out.
2829
* Use embedded HTTP servers for upstream dependencies.
2930
* Functional error handling
3031
* Don't throw exceptions unless it's truly exceptional. Expected errors, such as invalid json, are not exceptional.
@@ -41,6 +42,8 @@ but try to avoid the more advanced FP features that don't translate well to Kotl
4142
* Spring JDBC Template is a simple set of helpers around JDBC calls that will handle injection projection and transaction support and mapping results back to classes without needing to jump through hoops.
4243
* Don't use Strings for all your types
4344
* Avoid so called stringy-typed development.
45+
* Use value objects for extra type safety
46+
* You can create `data class Height(val value: Int)` and pass that about. Yes it's another object to be instantiated. No you're never going to see a performance impact because your webapp is spending all its time in IO anyway.
4447

4548
## Libraries
4649

0 commit comments

Comments
 (0)