Profile Picture
IT Made Easy
The site provides some rough IT Notes that make your life easier. The site currently has notes on HTML, CSS, Regex, OOPS, JS, JQuery, PHP, Java, ASP.NET, C#, Database, Linux, URL Rewrite, SEO, Project Management and Hosting. Please do share this site if you like.

Design Pattern

  • Design patterns are just guidelines on how code should be designed for scenarios. It can be procedurally coded or using more favorably using OOPs
  • Singleton Pattern gives access to a single resource not replicated. Here we have private constructor and a static function which creates a resource if and only if no resource exists. it returns the created or existing resource which is stored as a static property. An example here is mysql connection link resource
  • Factory Pattern creates a factory or generic class which returns instances or objects of seperate specialised classes that handles same task speetrately. Here depending on say function parameter different objects are instantiated and returned. Consider data storage manager which instantiates storage classes depending on say users preference. So he can choose between say INI or DB or XML which are implemented using an interface
  • Registry Pattern creates a pattern where you can register resources and later on check if a resource is registered and retrieve it. Here we add all regsitered resouces to a static property array and check against and retrives from the array as required. We add say and class and its object as an associative array properties
  • MVC or Model-View-Controller is a design pattern where the controller is called by user (even in default action) and it interfaces with model (business logic) to change its state and finally view is called which reflects changes in model
  • Active Record Pattern is a pattern where the data source is encapsulated so that the act of accessing the components is hidden within the class that implements the pattern. An example is we don't worry about how how SQL implements data row writing or fetching

IT Notes

by VinodSebastian

IT Downloads