Think of a class that became so small and so unused that it does not justify its existence.
Consider an application that has the following classes:
class User {
var firstName, lastName: String?
var homeAddress = Address()
...
}
class Address {
var streetName, streetNumber, city, postalCode, country: String?
var email: String?
...}
Because all the users are now virtual, keeping the physical address is not needed so our Address class becomes:
class Address {
var email: String?
}
Such a class does not deserve to live, so we can remove it from the face of the earth and move its only property, email, into the User class:
var email: String?
}
Such a class does not deserve to live, so we can remove it from the face of the earth and move its only property, email, into the User class:
class User {
var firstName, lastName, email: String?
...
}
var firstName, lastName, email: String?
...
}
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.