[SOLID Principle] Single Responsibility Principle
todo here
1
2
3
4
5
6
7
8
9
10
11
12
13
data class (val name: String, val email: String)
class AdminDashboardService {
fun sendNotification(user: User) {
println(“preparing email content for user ${user.email}”)
println(“send notification to ${user.email}”)
}
fun deleteUser(user: User {
println(“deleting user with email ${user.email}”)
}
}
example
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
data class (val name: String, val email: String)
class UserAccountService {
fun deleteUser(user: User) {
println(“deleting user with email ${user.email}”)
}
}
class EmailContentProvider {
fun prepareContent(user: User) {
println(“preparing email content for user ${user.email}”)
}
}
class EmailNotificationService {
fun sendNotification(user: User) {
println(“send notification to ${user.email}”)
}
}
← Go home