SRP kind of implies that each class has only one public method, and perhaps multiple supporting private methods.
What if our language forced this?
ReadsFiles
path
execute
# return file contents
end
end
file_text = ReadsFile("file.txt")!
See how we only have one usage? Could this language even be usable?
email = Email("andrew.vos@gmail.com", "hey!", "what's up?")
SendsEmail(email)!
Email
to, subject, body
end
SendsEmail
email
execute
connection = SmtpConnection("smtp.bla.com")
SendsSmtpMail(connection, email)!
end
end
path = Path("files/")
DeletesFiles(path)!
DeletesFiles
path
each file in ListsFiles(path)!
DeletesFile(path)
end
each directory in ListsDirectories(path)!
DeletesFiles(path)!
end
end
DeletesFile
path
execute
ExecutesCommand("rm " + path)
end
end