Asked 7 years ago
18 May 2017
Views 958
jaydeep

jaydeep posted

What are design pattern in PHP ? how design pattern useful in PHP ?

What is design pattern ?
how design pattern should be apply to code ?
is there any benefit to use design pattern in programming ?

In PHP , how many Design Pattern available ? how design pattern useful in PHP ?

one of my friend said Design Pattern means extra overhead to code . Design pattern not useful at all .Design pattern is waste of time and money so please help me to understand Design pattern .
Mitul Dabhi

Mitul Dabhi
answered Nov 30 '-1 00:00

design pattern means layout of the application . it decide how application behave when request come in and result goes out .

design pattern is very good practice to use it for very big and complex application .

but for three or four web page website does not require design pattern .it can be done by simple coding without use of complex architecture .

differ design patter used for differ flavor of application , suppose database use is very critical part and you want to reduce the request of database than singleton pattern is good to use
Mitul Dabhi

Mitul Dabhi
answered Nov 30 '-1 00:00

To ensure only one object instance exists, here’s the singleton method.


/** Singleton instance */
public static function get_instance() {
	if ( ! isset( self::$instance ) ) {
		self::$instance = new self();
	}

	return self::$instance;
}
Post Answer