Slide 8
Slide 8 text
Dependency inversion
interface Mailer {
fun sendEmail(subject: String, to: String, body: String)
}
class SMTPMailer(private val host: String): Mailer {
override fun sendEmail(subject: String, to: String, body: String) {
// call some SMTP server
}
}
class NoOpMailer: Mailer {
override fun sendEmail(subject: String, to: String, body: String) {
// nothing!
}
}