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

From semantic-mediawiki.org

The S in STUPID

Tight coupling!

public function testDoStuff() {

    // Cannot prevent disk and database writes
    // State might be leaked, order might become relevant
    $object->doStuff();

}
public function doStuff() {
    // ...

    Logger::log( 'doing stuff during caturday is madness' );

    // ...

    DataStore::saveObject( $object );

    // ...
}
  • Not just tests, applies to all code making use of doStuff.