Chain of Responsibility
As a software architect, I have a unique approach to interaction. Preferring solitude, I often find myself at “The Ivory Tower,” my favorite cafe. Here, I designed a web application to manage developer inquiries. Rather than having them approach me directly, developers must send their questions through this system. I’ll respond if I find their inquiry merits an answer.
In the realm of web servers, the “filter chain” is a well-established concept. It is typically expected that when a request arrives:
- The parameters have been validated.
- If necessary, the user has been authenticated.
- User roles and permissions have been identified, ensuring the user is authorized to proceed with a specific action.
So, here’s the initial code:
data class Request(val email: String, val question: String) {
fun isKnownEmail(): Boolean {
return true
}
fun isFromJuniorDeveloper()...