{"id":160,"date":"2016-01-31T15:10:59","date_gmt":"2016-01-31T15:10:59","guid":{"rendered":"http:\/\/kaizen-koka.com\/?p=160"},"modified":"2017-07-21T14:52:29","modified_gmt":"2017-07-21T14:52:29","slug":"design-patterns","status":"publish","type":"post","link":"https:\/\/kaizen-koka.com\/?p=160","title":{"rendered":"Design Patterns"},"content":{"rendered":"<p>\n\t<span style=\"font-size:16px;\"><span style=\"font-family:verdana,geneva,sans-serif;\"><strong>GANG OF FOUR (GOF)<\/strong><\/span><\/span><br \/>\n\t<span style=\"font-size:14px;\"><span style=\"font-family:verdana,geneva,sans-serif;\">&nbsp; &nbsp; &nbsp; Pattern is a solution to a recurring problem, in a specified context.<br \/>\n\t&nbsp;&nbsp; &nbsp; &nbsp;<br \/>\n\t&nbsp;&nbsp; &nbsp;We can divide the pattern in to 3 categories.<br \/>\n\t1)Creational Design Pattern<br \/>\n\t2)Structural Design Pattern<br \/>\n\t3)Behavioural Design Pattern<\/span><\/span>\n<\/p>\n<p>\n\t<span style=\"font-size:14px;\"><span style=\"font-family:verdana,geneva,sans-serif;\"><strong>Creational Design Pattern :<\/strong><br \/>\n\t&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; These patterns involved in obj instantiation &amp; provide a way to decouple the client from the object, it needs to instantiation<br \/>\n\t&nbsp;<br \/>\n\t&nbsp; EX: Singleton Pattern, Factory Pattern, Builder Pattern, Prototype Pattern<\/span><\/span>\n<\/p>\n<p>\n\t<span style=\"font-size:14px;\"><span style=\"font-family:verdana,geneva,sans-serif;\"><strong>Structural Design Patterns:<\/strong><br \/>\n\t&nbsp; &nbsp; These patterns let you compose classes or objects in to a larger structure.<br \/>\n\t&nbsp;EX: &nbsp;Adapter Pattern, Facade Pattern, Proxy Pattern, Decorator pattern, composite pattern, Bridge Pattern&nbsp;&nbsp; &nbsp;<br \/>\n\t&nbsp;<br \/>\n\t<strong>Behavioural Pattern :<\/strong><br \/>\n\t&nbsp; &nbsp;These patterns concerned with, how the classes &amp; objects interact &amp; distribute responsibilities<br \/>\n\t&nbsp;EX:Observer, Iterator, Command, State, Strategy Pattern, Template method pattern, Visitor Pattern, Mediator Pattern, Interpretor Pattern<\/span><\/span>\n<\/p>\n<p>\n\t<br \/>\n\t<span style=\"font-size:14px;\"><span style=\"font-family:verdana,geneva,sans-serif;\">&nbsp; We can also divide the patterns in to 2 categories,<br \/>\n\t1) Class pattern<br \/>\n\t2) Object Pattern<\/span><\/span>\n<\/p>\n<p>\n\t<span style=\"font-size:14px;\"><span style=\"font-family:verdana,geneva,sans-serif;\">Class Pattern : Describe how the relationship between the class are defined via inheritance. Relationship in class patterns are established at compile time<br \/>\n\t1) Factory Pattern<br \/>\n\t2) Adopter Pattern<br \/>\n\t3) Interpreter<br \/>\n\t4) Template&nbsp;<\/span><\/span>\n<\/p>\n<p>\n\t<span style=\"font-size:14px;\"><span style=\"font-family:verdana,geneva,sans-serif;\">Object Patterns : Describe relationship between objects. Relationship in object patterns are created at runtime &amp; are more dynamic.<br \/>\n\t1)Singleton<br \/>\n\t2)Facade<br \/>\n\t3)Observer<br \/>\n\t4)Command<br \/>\n\t5)Composite<br \/>\n\t6)Decorator<br \/>\n\t7)Proxy<br \/>\n\t8)Iterator<br \/>\n\t9)Strategy<br \/>\n\t10)Bridge<br \/>\n\t11)Prototype<br \/>\n\t&nbsp;&nbsp;<\/span><\/span>\n<\/p>\n<p>\n\t<span style=\"font-size:14px;\"><span style=\"font-family:verdana,geneva,sans-serif;\">1. Facade Design Pattern&nbsp;<br \/>\n\t&nbsp; &nbsp; Is the pattern when ever we want to provide simplified interface to client that performs many other actions behind<\/span><\/span>\n<\/p>\n<p>\n\t<span style=\"font-size:14px;\"><span style=\"font-family:verdana,geneva,sans-serif;\">2. Proxy Design Pattern :<br \/>\n\t&nbsp; &nbsp;Proxy Design pattern is class which will limit access to another class. This can be used for security reasons.<\/span><\/span>\n<\/p>\n<p>\n\t<span style=\"font-size:14px;\"><span style=\"font-family:verdana,geneva,sans-serif;\">3. Factory Design Pattern :: When a method returns ond of the several possible classes that share a common super class.<br \/>\n\t&nbsp; We need to get a capability to choose a class at runtime.<\/span><\/span>\n<\/p>\n<p>\n\t<span style=\"font-size:14px;\"><span style=\"font-family:verdana,geneva,sans-serif;\">4. Singleton pattern helps us to keep only one instance of a class at any time. The purpose of singleton is to control object creation by keeping private constructor. &nbsp;<br \/>\n\tExample like java.lang.Runtime, java.awt.Desktop are built in singleton classes and in case of logging, configuration file, cache<\/span><\/span>\n<\/p>\n<p>\n\t<span style=\"font-size:14px;\"><span style=\"font-family:verdana,geneva,sans-serif;\">&nbsp;&nbsp;<\/span><\/span>\n<\/p>\n<p>\n\t<br \/>\n\t<span style=\"font-size:14px;\"><span style=\"font-family:verdana,geneva,sans-serif;\">&nbsp; &nbsp;<\/span><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>GANG OF FOUR (GOF) &nbsp; &nbsp; &nbsp; Pattern is a solution to a recurring problem, in a specified context. &nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;We can divide the pattern in to [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false},"version":2}},"categories":[9,2],"tags":[],"class_list":["post-160","post","type-post","status-publish","format-standard","hentry","category-advance","category-technology"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p70lnf-2A","jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/kaizen-koka.com\/index.php?rest_route=\/wp\/v2\/posts\/160","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kaizen-koka.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kaizen-koka.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kaizen-koka.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kaizen-koka.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=160"}],"version-history":[{"count":2,"href":"https:\/\/kaizen-koka.com\/index.php?rest_route=\/wp\/v2\/posts\/160\/revisions"}],"predecessor-version":[{"id":443,"href":"https:\/\/kaizen-koka.com\/index.php?rest_route=\/wp\/v2\/posts\/160\/revisions\/443"}],"wp:attachment":[{"href":"https:\/\/kaizen-koka.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=160"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kaizen-koka.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=160"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kaizen-koka.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=160"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}