samedi 1 octobre 2016

Distinct class for small tasks or a general class containing small tasks?

Considering performance and speed, What type of programming do you prefer ? A single class that doing small task or a general class that containing those small tasks ?

Example for General class:

general.class.php file :

class General{

    public function loadCache(){}
    public function storeCache(){}

    public function setSession(){}
    public function getSession(){}
}

Example for distinct class :

session.class.php file :

<?php
class Session{
    public function get(){};
    public function set(){};
}
?>

cache.class.php file :

<?php
    class Cache{
        public function loadCache(){}
        public function storeCache(){}
    }
?>

Aucun commentaire:

Enregistrer un commentaire