User:Jeroen De Dauw/Static: The S in STUPID/91

From semantic-mediawiki.org
Jump to: navigation, search
Jeroen De DauwJeroen De Dauw/Static: The S in STUPIDUser:Jeroen De Dauw/Static: The S in STUPID/91

The S in STUPID

  • Static calls to leaves in the call graph are less evil
  • Leaves can stop being leaves
class Awesome {
 
    public function calculateAwesomeness() {
        Utils::getAwesomeFactor();
 
        // ...
    }
 
}
class Utils {
 
    public static function getAwesomeFactor() {
        return 42;
    }
 
}
  • What if the awesome factor is now stored in a config file or db?