21
loading...
This website collects cookies to deliver better user experience
TL;DR: Don't use abbreviations in subclasses
Readability
Mistakes
Rename your classes to provide context
Use modules, namespaces or fully qualified names
abstract class PerserveranceDirection {
}
class North extends PerserveranceDirection {}
class East extends PerserveranceDirection {}
class West extends PerserveranceDirection {}
class South extends PerserveranceDirection {}
//Subclasses have short names and meaningless outside the hierarchy
//If we reference East we might mistake it for the Cardinal Point
abstract class PerserveranceDirection {
}
class PerserveranceDirectionNorth extends PerserveranceDirection {}
class PerserveranceDirectionEast extends PerserveranceDirection {}
class PerserveranceDirectionWest extends PerserveranceDirection {}
class PerserveranceDirectionSouth extends PerserveranceDirection {}
//Subclasses have fully quallified names
The programmer's primary weapon in the never-ending battle against slow system is to change the intramodular structure. Our first response should be to reorganize the modules' data structures.