I will try to mention some software design topics which I think are important. These are:
LoD is a design guideline for developing software whose rules and benefits can be summarized as:
Rules (based on Wikipedia):
Benefits:
The extension functions should have a task related to the responsibility of the respective class. One of the most common mistakes made by developers is to write extension functions like a utility function. Here is an example to explain this better:
fun String.validateEmail(): Boolean {
//validation process
return result
}
These types of functions should not be defined as extension functions. Storing the e-mail information as String does not mean that String class is associated with the e-mail information. Instead this validation should reside in a class like EmailValidator.
class EmailValidator {
fun validate(email: String): Boolean {
//validation process
return result
}…
About