{"id":29845,"date":"2022-11-25T18:25:20","date_gmt":"2022-11-25T12:55:20","guid":{"rendered":"https:\/\/blazeclan.com\/factory-design-pattern-dos-donts-quintessential-creational-pattern\/"},"modified":"2023-03-10T14:44:32","modified_gmt":"2023-03-10T09:14:32","slug":"factory-design-pattern-dos-donts-quintessential-creational-pattern","status":"publish","type":"post","link":"https:\/\/blazeclan.com\/india\/blog\/factory-design-pattern-dos-donts-quintessential-creational-pattern\/","title":{"rendered":"The Factory Design Pattern &#8211; The DO&#8217;s &amp; DON&#8217;Ts of the Quintessential Creational Pattern"},"content":{"rendered":"<p>Designing \u201cThe Factory Pattern\u201d<\/p>\n<p><b>Demystifying Factory Design Pattern:<span><br \/>\n<\/span><\/b><i>\u201cPatterns identify and specify abstractions that are above the level of single classes and instances, or of components.\u201d<\/i><\/p>\n<p>The avid readers of our blog can easily conclude that these Patterns are not trivial and they are not represented by features that are built into the language unlike a feature like Inheritance. Hence we say, <i>a<b> Pattern<\/b> is a<\/i><i> proven solution to a problem in a specific context.<\/i> To put it across in simple words, it\u2019s like a recipe of your Grandma\u2019s Thanksgiving Turkey! After so many trials she found a perfect way, the proper ingredients which makes the Turkey so delicious!<\/p>\n<p>So what are Design Patterns? These are nothing but Elements of Reusable Software and as&nbsp;the famous literature on design patterns, classifies patterns into three types viz. creational, structural and behavioral.<\/p>\n<p>Prior to delving deeper into the esoteric world of these patterns, it\u2019s worthwhile to touch briefly upon what a Creational Pattern is. A creational pattern gives control over instantiation of objects. Using this type of pattern the programmer doesn\u2019t need to instantiate objects directly. They give the program the ability to decide which objects need to be created for a given case.<\/p>\n<p>We have already discussed, at length, a pattern belonging to this type \u2013 \u2018The Singleton Pattern\u2019. Over the course of this blog, we will examine one of the most commonly used creational design patterns, \u2018The <strong>Factory<\/strong> Pattern\u2019.<span id=\"more-3848\"><\/span><\/p>\n<p>&nbsp;<\/p>\n<h3><strong>Factory Pattern: A Quintessential Creational Pattern<\/strong><\/h3>\n<p>A Factory pattern is one that only returns instances of several possible classes depending on the data given to it. As with other design patterns, there are countless variations of the Factory pattern, although most variants typically use the same set of primary factors, a client, a factory, and a product. The client is an object that requires an instance of another object (the product) for some purpose. Rather than creating the product instance directly, the client delegates this responsibility to the factory. Once invoked, the factory creates a new instance of the product, passing it back to the client. Put simply, the client uses the factory to create an instance of the product. The following figure shows this logical relationship between these elements of the pattern.<\/p>\n<h4>Wondering how and when to Use the Factory Pattern?<strong><span style=\"font-size: 0.75rem; line-height: 1.25rem;\"><br \/>\n<\/span><\/strong><\/h4>\n<p>Having understood in theory what a factory pattern is all about, the next logical question is how and when we can use this. The main goal of this pattern is to encapsulate the creational procedure that may span different classes into one single function. By providing the correct context to the factory method, it will be able to return the correct object. Thus, the best time to use the factory method pattern is when you have multiple different variations of a single entity. Let\u2019s say you have a class called Shape; this class has different variations, such as Circle Shape, Rectangular Shape and Square Shape. Depending on the requirement, you may need to create different Shapes \u2014this is where you can use a factory to create the Shapes for you!<\/p>\n<p>Use a factory only when you need extra control with object creation, in a way that couldn\u2019t be done with constructors.<\/p>\n<p>Factories have the possibility of caching for example. Another way to use factories is in a scenario where you do not know the type you want to construct. Often you see this type of usage in plug-in factory scenarios where each plug-in must derive from a base class or implement some kind of interface. The factory creates instances of classes that derive from the base class or that implement the interface.<\/p>\n<p>&nbsp;<\/p>\n<h4>[ More Design Patterns \u2013 Simplifying Coding with the Decorator Design Pattern!]<\/h4>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<h3><strong style=\"font-size: 1.25rem; line-height: 1.5rem;\">Factory Design Pattern: An object oriented design perspective<\/strong><\/h3>\n<p>\u2022 Each time we use the \u201cnew\u201d command, we break encapsulation of type<\/p>\n<p>\u2022 Circle circle = new Round Circle ();<\/p>\n<p>\u2022 Even though our variable uses an \u201cinterface\u201d, this code depends on \u201cRound Circle\u201d<\/p>\n<p>\u2022 In addition, if you have a code that instantiates a particular subtype based on the current state of the program, then the code depends on each concrete class.<\/p>\n<p><span style=\"color: #000080;\"><em>if (shapes) {<\/em><\/span><\/p>\n<p><span style=\"color: #000080;\"><em>Return new Round Circle ()<\/em><\/span><\/p>\n<p><span style=\"color: #000080;\"><em>} else {<\/em><\/span><\/p>\n<p><span style=\"color: #000080;\"><em>return new &nbsp;Circle ();<\/em><\/span><\/p>\n<p><span style=\"color: #000080;\"><em>}<\/em><\/span><\/p>\n<p><b>Obvious Problems<\/b>: Needs to be recompiled each time dep. changes; add new classes, change the code; remove existing classes and modify the code.<\/p>\n<h4>The example gets sweeter: Let\u2019s discuss it over a slice of Pastry<\/h4>\n<p>\u2022 We have a Pastry Corner program that wants to separate the process of creating a Pastry from the process of preparing\/ordering a Pastry<\/p>\n<p>\u2022 Initial Code: mixes the two processes<\/p>\n<p><span style=\"color: #000080;\"><em>PublicclassPastry Corner {<\/em><\/span><\/p>\n<p><span style=\"color: #000080;\"><em>Pastry orderPastry (String type) {<\/em><\/span><\/p>\n<p><span style=\"color: #000080;\"><em>Pastry pastry;<\/em><\/span><\/p>\n<p><span style=\"color: #000080;\"><em>if(type.equals(\u201cBlackForest\u201d)) {<\/em><\/span><\/p>\n<p><span style=\"color: #000080;\"><em>pastry = newBlackForest ();<\/em><\/span><\/p>\n<p><span style=\"color: #000080;\"><em>} &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014&gt; &nbsp; <\/em><\/span><strong>Creation<\/strong><\/p>\n<p><em><span style=\"color: #000080;\">elseif(type.equals(\u201cVanilla\u201d)) {<\/span><\/em><\/p>\n<p><em><span style=\"color: #000080;\">pastry = newVanillaPastry();<\/span><\/em><\/p>\n<p><em><span style=\"color: #000080;\">} elseif(type.equals(\u201cChocolate\u201d)) {<\/span><\/em><\/p>\n<p><em><span style=\"color: #000080;\">pastry = newChocolate ();}<\/span><\/em><\/p>\n<p><em><span style=\"color: #000080;\">pastry. Prepare();<\/span><\/em><\/p>\n<p><em><span style=\"color: #000080;\">pastry.bake();<\/span><\/em><\/p>\n<p><em><span style=\"color: #000080;\">pastry.cut(); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<\/span><\/em><\/p>\n<p><em><span style=\"color: #000080;\">pastry.box();<\/span><\/em><\/p>\n<p><em><span style=\"color: #000080;\">return<\/span><\/em><\/p>\n<p><em><span style=\"color: #000080;\">pastry;<\/span><\/em><\/p>\n<p><em><span style=\"color: #000080;\">}}<\/span> <\/em>&nbsp; &nbsp; &nbsp; &nbsp;<em>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014&gt; &nbsp;&nbsp;<\/em><strong>Preparation<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<h3><strong>Encapsulate Creation Code: Encapsulation Mechanism<\/strong><\/h3>\n<p>\u2022 A simple way to enc apsulate this code is to put it in a separate class<\/p>\n<p>\u2022 That new class depends on the concrete classes, but those dependencies no longer impact the preparation code<\/p>\n<p><span style=\"color: #000080;\"><em>Publicclass Pastry Corner {<\/em><\/span><\/p>\n<p><span style=\"color: #000080;\"><em>PrivateSimple Pastry Corner Factory factory;<\/em><\/span><\/p>\n<p><span style=\"color: #000080;\"><em>Public Pastry Corner (Simple Pastry Corner Factory factory) {<\/em><\/span><\/p>\n<p><span style=\"color: #000080;\"><em>this.factory = factory;<\/em><\/span><\/p>\n<p><span style=\"color: #000080;\"><em>}<\/em><\/span><\/p>\n<p><span style=\"color: #000080;\"><em>Public Pastry order Pastry (String type) {<\/em><\/span><\/p>\n<p><span style=\"color: #000080;\"><em>Pizza Pastry = factory.create Pastry (type);<\/em><\/span><\/p>\n<p><span style=\"color: #000080;\"><em>Pastry.prepare();<\/em><\/span><\/p>\n<p><span style=\"color: #000080;\"><em>Pastry.bake();<\/em><\/span><\/p>\n<p><span style=\"color: #000080;\"><em>Pastry.cut();<\/em><\/span><\/p>\n<p><span style=\"color: #000080;\"><em>Pastry.box();<\/em><\/span><\/p>\n<p><span style=\"color: #000080;\"><em>return Pastry;}}<\/em><\/span><\/p>\n<p><span style=\"color: #000080;\"><em>publicclassSimple Pastry Factory {<\/em><\/span><\/p>\n<p><span style=\"color: #000080;\"><em>public Pastry create Pastry (String type) {<\/em><\/span><\/p>\n<p><span style=\"color: #000080;\"><em>if(type.equals(\u201cBlackForest\u201d)) {<\/em><\/span><\/p>\n<p><span style=\"color: #000080;\"><em>returnnewBlackForest();<\/em><\/span><\/p>\n<p><span style=\"color: #000080;\"><em>}<\/em><\/span><\/p>\n<p><span style=\"color: #000080;\"><em>elseif(type.equals(\u201cVanilla\u201d\u201d)) {<\/em><\/span><\/p>\n<p><span style=\"color: #000080;\"><em>returnnewVanilla Pastry \u201c();<\/em><\/span><\/p>\n<p><span style=\"color: #000080;\"><em>} else if (type. equals (\u201cChocolate\u201d)) {<\/em><\/span><\/p>\n<p><span style=\"color: #000080;\"><em>returnnewChocolate();<\/em><\/span><\/p>\n<p><span style=\"color: #000080;\"><em>}}}<\/em><\/span><\/p>\n<p>Class Diagram for New Solution<\/p>\n<p>&nbsp;<\/p>\n<p>While this is nice, it\u2019s not as flexible as it can potentially be: to increase flexibility we need to look at one more part of Factory design patterns: The Factory Method<\/p>\n<p><b>Simple factory Method<\/b><b>: <\/b>Encapsulates object creation in a static method.<b><br \/>\n<\/b>A static method in a class which creates an object and returns the instance of a class!! So instead of creating an object you will call this method which gives you the instance of controller class.<\/p>\n<p>\u2022To demonstrate the factory method pattern, the pastry store example evolves to include the notion of different franchises that exist in different parts of the cities (Pune, Mumbai, and Bangalore).<\/p>\n<p>\u2022Each franchise needs its own factory to match the proclivities of the locals.<\/p>\n<p>\u2022However, we want to retain the preparation process that has made Pastry Store such a great success.<\/p>\n<p>\u2022The Factory Method Design Pattern allows you to do this by placing abstract, \u201ccode to an interface\u201d code in a super class placing object creation code in a subclass Pastry Store becomes an abstract class with an abstract create Pastry() method. We then create subclasses that override create Pastry() for each region<\/p>\n<p><strong>New Pastry Corner Class:<\/strong><\/p>\n<p><em><span style=\"color: #000080;\">Public abstract class Pastry Corner {<\/span><\/em><\/p>\n<p><em><span style=\"color: #000080;\">Protected abstract create Pastry (String type);<\/span><\/em><\/p>\n<p><em><span style=\"color: #000080;\">Public Pastry order Pastry (String type) {<\/span><\/em><\/p>\n<p><em><span style=\"color: #000080;\">Pastry pastry = create Pastry (type);<\/span><\/em><\/p>\n<p><em><span style=\"color: #000080;\">pastry.prepare();<\/span> <\/em>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2013&gt; Beautiful Abstract Class!<\/p>\n<p><em><span style=\"color: #000080;\">pastry.bake();<\/span><\/em><\/p>\n<p><em><span style=\"color: #000080;\">pastry.cut();<\/span><\/em><\/p>\n<p><em><span style=\"color: #000080;\">pastry.box();<\/span><\/em><\/p>\n<p><em><span style=\"color: #000080;\">return<\/span><\/em><\/p>\n<p><em><span style=\"color: #000080;\">pastry;<\/span><\/em><\/p>\n<p><em>}} <\/em><\/p>\n<p>This class is a (very simple) OO framework. The framework provides one service \u201cprepare pastry\u201d. The framework invokes the create Pastry () factory method to create a pastry that it can prepare using a well-defined, consistent process.<\/p>\n<p>A \u201cclient\u201d of the framework will subclass this class and provide an implementation of the create Pastry () method.<\/p>\n<p>Any dependencies on concrete \u201cproduct\u201d classes are encapsulated in the subclass.<\/p>\n<p>Huh\u2026Tired??? We would not overwhelm you with more information at this point of time. We will discuss other patterns like: Observer, Strategy, Template Method, and Abstract which are famous outside non-Object oriented programming in the series of blogs to follow soon.<\/p>\n<p>P.S.: User discretion is required when you use these design patterns, <strong>always<\/strong> make sure that you\u2019re trying to solve the correct problem. As I mentioned previously, these design patterns are a double-edge sword: if used in the wrong context, they can potentially make things worse; but if used correctly, they become indispensable.<\/p>\n<p>&nbsp;<\/p>\n<h4>Some Interesting reads from the Cloud World :<\/h4>\n<p>1.&nbsp;Optimize Big Data Analytics with a Complete Guide to Amazon Cloud\u2019s EMR<br \/>\n2.&nbsp;AWS Cloud for Start-ups Jump Start Package at just $99.99<br \/>\n3.&nbsp;Why is Cloud Computing Big Data\u2019s Best Friend? Hadoop in the Clouds to Answer your Doubts!<br \/>\n4.&nbsp;Building a Live AWS Kinesis Application \u2013 The Producer Class, Put Constructor &amp; more\u2026<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Designing \u201cThe Factory Pattern\u201d Demystifying Factory Design Pattern: \u201cPatterns identify and specify abstractions that are above the level of single classes and instances, or of components.\u201d The avid readers of our blog can easily conclude that these Patterns are not trivial and they are not represented by features that are built into the language unlike [&hellip;]<\/p>\n","protected":false},"author":192,"featured_media":16668,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[914,2037,1949],"tags":[3083,3084,3085],"class_list":["post-29845","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-cloud","category-news-more-india","category-tech-india","tag-factory-design-pattern-india","tag-factory-design-pattern-all-you-need-to-know-india","tag-what-is-factory-design-pattern-india"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>The DO&#039;s &amp; DON&#039;Ts of the Factory Design Pattern<\/title>\n<meta name=\"description\" content=\"Patterns identify and specify abstractions that are above the level of single classes and instances, or of components.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/blazeclan.com\/india\/blog\/factory-design-pattern-dos-donts-quintessential-creational-pattern\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"The DO&#039;s &amp; DON&#039;Ts of the Factory Design Pattern\" \/>\n<meta property=\"og:description\" content=\"Patterns identify and specify abstractions that are above the level of single classes and instances, or of components.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/blazeclan.com\/blog\/factory-design-pattern-dos-donts-quintessential-creational-pattern\/\" \/>\n<meta property=\"og:site_name\" content=\"Blazeclan\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/blazeclan.hq\/\" \/>\n<meta property=\"article:published_time\" content=\"2022-11-25T12:55:20+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-03-10T09:14:32+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/blazeclan.com\/wp-content\/uploads\/2014\/02\/The-Factory-Design-Pattern-\u2013-The-DOs-_-DONTs-of-the-Quintessential-Creational-Pattern-1.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1650\" \/>\n\t<meta property=\"og:image:height\" content=\"680\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Team Blazeclan\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@blazeclan_hq\" \/>\n<meta name=\"twitter:site\" content=\"@blazeclan_hq\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Team Blazeclan\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/blazeclan.com\/blog\/factory-design-pattern-dos-donts-quintessential-creational-pattern\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/blazeclan.com\/india\/blog\/factory-design-pattern-dos-donts-quintessential-creational-pattern\/\"},\"author\":{\"name\":\"Team Blazeclan\",\"@id\":\"https:\/\/blazeclan.com\/india\/#\/schema\/person\/779910eccddff4a1ea6663b6bfb271e8\"},\"headline\":\"The Factory Design Pattern &#8211; The DO&#8217;s &amp; DON&#8217;Ts of the Quintessential Creational Pattern\",\"datePublished\":\"2022-11-25T12:55:20+00:00\",\"dateModified\":\"2023-03-10T09:14:32+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/blazeclan.com\/india\/blog\/factory-design-pattern-dos-donts-quintessential-creational-pattern\/\"},\"wordCount\":1456,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/blazeclan.com\/india\/#organization\"},\"image\":{\"@id\":\"https:\/\/blazeclan.com\/blog\/factory-design-pattern-dos-donts-quintessential-creational-pattern\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/blazeclan.com\/wp-content\/uploads\/2014\/02\/The-Factory-Design-Pattern-\u2013-The-DOs-_-DONTs-of-the-Quintessential-Creational-Pattern-1.png\",\"keywords\":[\"Factory Design Pattern\",\"Factory Design Pattern All you need to know\",\"What is Factory Design Pattern\"],\"articleSection\":[\"Cloud\",\"News &amp; More\",\"Tech\"],\"inLanguage\":\"en-IN\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/blazeclan.com\/blog\/factory-design-pattern-dos-donts-quintessential-creational-pattern\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/blazeclan.com\/india\/blog\/factory-design-pattern-dos-donts-quintessential-creational-pattern\/\",\"url\":\"https:\/\/blazeclan.com\/blog\/factory-design-pattern-dos-donts-quintessential-creational-pattern\/\",\"name\":\"The DO's & DON'Ts of the Factory Design Pattern\",\"isPartOf\":{\"@id\":\"https:\/\/blazeclan.com\/india\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/blazeclan.com\/blog\/factory-design-pattern-dos-donts-quintessential-creational-pattern\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/blazeclan.com\/blog\/factory-design-pattern-dos-donts-quintessential-creational-pattern\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/blazeclan.com\/wp-content\/uploads\/2014\/02\/The-Factory-Design-Pattern-\u2013-The-DOs-_-DONTs-of-the-Quintessential-Creational-Pattern-1.png\",\"datePublished\":\"2022-11-25T12:55:20+00:00\",\"dateModified\":\"2023-03-10T09:14:32+00:00\",\"description\":\"Patterns identify and specify abstractions that are above the level of single classes and instances, or of components.\",\"breadcrumb\":{\"@id\":\"https:\/\/blazeclan.com\/blog\/factory-design-pattern-dos-donts-quintessential-creational-pattern\/#breadcrumb\"},\"inLanguage\":\"en-IN\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/blazeclan.com\/blog\/factory-design-pattern-dos-donts-quintessential-creational-pattern\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-IN\",\"@id\":\"https:\/\/blazeclan.com\/blog\/factory-design-pattern-dos-donts-quintessential-creational-pattern\/#primaryimage\",\"url\":\"https:\/\/blazeclan.com\/wp-content\/uploads\/2014\/02\/The-Factory-Design-Pattern-\u2013-The-DOs-_-DONTs-of-the-Quintessential-Creational-Pattern-1.png\",\"contentUrl\":\"https:\/\/blazeclan.com\/wp-content\/uploads\/2014\/02\/The-Factory-Design-Pattern-\u2013-The-DOs-_-DONTs-of-the-Quintessential-Creational-Pattern-1.png\",\"width\":1650,\"height\":680},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/blazeclan.com\/blog\/factory-design-pattern-dos-donts-quintessential-creational-pattern\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/blazeclan.com\/india\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"The Factory Design Pattern &#8211; The DO&#8217;s &amp; DON&#8217;Ts of the Quintessential Creational Pattern\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/blazeclan.com\/india\/#website\",\"url\":\"https:\/\/blazeclan.com\/india\/\",\"name\":\"Blazeclan\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/blazeclan.com\/india\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/blazeclan.com\/india\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-IN\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/blazeclan.com\/india\/#organization\",\"name\":\"Blazeclan\",\"url\":\"https:\/\/blazeclan.com\/india\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-IN\",\"@id\":\"https:\/\/blazeclan.com\/india\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/blazeclan.com\/wp-content\/uploads\/2024\/10\/ITCI-Blazeclan_logo.svg\",\"contentUrl\":\"https:\/\/blazeclan.com\/wp-content\/uploads\/2024\/10\/ITCI-Blazeclan_logo.svg\",\"caption\":\"Blazeclan\"},\"image\":{\"@id\":\"https:\/\/blazeclan.com\/india\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/blazeclan.hq\/\",\"https:\/\/x.com\/blazeclan_hq\",\"https:\/\/www.instagram.com\/blazeclantechnologies\/\",\"https:\/\/www.linkedin.com\/company\/blazeclan-technologies\/\",\"https:\/\/www.youtube.com\/channel\/UCCKF4Lcbtus-pUoZr7Lxrow\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/blazeclan.com\/india\/#\/schema\/person\/779910eccddff4a1ea6663b6bfb271e8\",\"name\":\"Team Blazeclan\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-IN\",\"@id\":\"https:\/\/blazeclan.com\/india\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/a43c1fa01bb3c7e839254c9084bf11ed422d7e633231f9e935096045af416ba2?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/a43c1fa01bb3c7e839254c9084bf11ed422d7e633231f9e935096045af416ba2?s=96&d=mm&r=g\",\"caption\":\"Team Blazeclan\"},\"sameAs\":[\"http:\/\/localhost\/ps-local-wp\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"The DO's & DON'Ts of the Factory Design Pattern","description":"Patterns identify and specify abstractions that are above the level of single classes and instances, or of components.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/blazeclan.com\/india\/blog\/factory-design-pattern-dos-donts-quintessential-creational-pattern\/","og_locale":"en_US","og_type":"article","og_title":"The DO's & DON'Ts of the Factory Design Pattern","og_description":"Patterns identify and specify abstractions that are above the level of single classes and instances, or of components.","og_url":"https:\/\/blazeclan.com\/blog\/factory-design-pattern-dos-donts-quintessential-creational-pattern\/","og_site_name":"Blazeclan","article_publisher":"https:\/\/www.facebook.com\/blazeclan.hq\/","article_published_time":"2022-11-25T12:55:20+00:00","article_modified_time":"2023-03-10T09:14:32+00:00","og_image":[{"width":1650,"height":680,"url":"https:\/\/blazeclan.com\/wp-content\/uploads\/2014\/02\/The-Factory-Design-Pattern-\u2013-The-DOs-_-DONTs-of-the-Quintessential-Creational-Pattern-1.png","type":"image\/png"}],"author":"Team Blazeclan","twitter_card":"summary_large_image","twitter_creator":"@blazeclan_hq","twitter_site":"@blazeclan_hq","twitter_misc":{"Written by":"Team Blazeclan"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/blazeclan.com\/blog\/factory-design-pattern-dos-donts-quintessential-creational-pattern\/#article","isPartOf":{"@id":"https:\/\/blazeclan.com\/india\/blog\/factory-design-pattern-dos-donts-quintessential-creational-pattern\/"},"author":{"name":"Team Blazeclan","@id":"https:\/\/blazeclan.com\/india\/#\/schema\/person\/779910eccddff4a1ea6663b6bfb271e8"},"headline":"The Factory Design Pattern &#8211; The DO&#8217;s &amp; DON&#8217;Ts of the Quintessential Creational Pattern","datePublished":"2022-11-25T12:55:20+00:00","dateModified":"2023-03-10T09:14:32+00:00","mainEntityOfPage":{"@id":"https:\/\/blazeclan.com\/india\/blog\/factory-design-pattern-dos-donts-quintessential-creational-pattern\/"},"wordCount":1456,"commentCount":0,"publisher":{"@id":"https:\/\/blazeclan.com\/india\/#organization"},"image":{"@id":"https:\/\/blazeclan.com\/blog\/factory-design-pattern-dos-donts-quintessential-creational-pattern\/#primaryimage"},"thumbnailUrl":"https:\/\/blazeclan.com\/wp-content\/uploads\/2014\/02\/The-Factory-Design-Pattern-\u2013-The-DOs-_-DONTs-of-the-Quintessential-Creational-Pattern-1.png","keywords":["Factory Design Pattern","Factory Design Pattern All you need to know","What is Factory Design Pattern"],"articleSection":["Cloud","News &amp; More","Tech"],"inLanguage":"en-IN","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/blazeclan.com\/blog\/factory-design-pattern-dos-donts-quintessential-creational-pattern\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/blazeclan.com\/india\/blog\/factory-design-pattern-dos-donts-quintessential-creational-pattern\/","url":"https:\/\/blazeclan.com\/blog\/factory-design-pattern-dos-donts-quintessential-creational-pattern\/","name":"The DO's & DON'Ts of the Factory Design Pattern","isPartOf":{"@id":"https:\/\/blazeclan.com\/india\/#website"},"primaryImageOfPage":{"@id":"https:\/\/blazeclan.com\/blog\/factory-design-pattern-dos-donts-quintessential-creational-pattern\/#primaryimage"},"image":{"@id":"https:\/\/blazeclan.com\/blog\/factory-design-pattern-dos-donts-quintessential-creational-pattern\/#primaryimage"},"thumbnailUrl":"https:\/\/blazeclan.com\/wp-content\/uploads\/2014\/02\/The-Factory-Design-Pattern-\u2013-The-DOs-_-DONTs-of-the-Quintessential-Creational-Pattern-1.png","datePublished":"2022-11-25T12:55:20+00:00","dateModified":"2023-03-10T09:14:32+00:00","description":"Patterns identify and specify abstractions that are above the level of single classes and instances, or of components.","breadcrumb":{"@id":"https:\/\/blazeclan.com\/blog\/factory-design-pattern-dos-donts-quintessential-creational-pattern\/#breadcrumb"},"inLanguage":"en-IN","potentialAction":[{"@type":"ReadAction","target":["https:\/\/blazeclan.com\/blog\/factory-design-pattern-dos-donts-quintessential-creational-pattern\/"]}]},{"@type":"ImageObject","inLanguage":"en-IN","@id":"https:\/\/blazeclan.com\/blog\/factory-design-pattern-dos-donts-quintessential-creational-pattern\/#primaryimage","url":"https:\/\/blazeclan.com\/wp-content\/uploads\/2014\/02\/The-Factory-Design-Pattern-\u2013-The-DOs-_-DONTs-of-the-Quintessential-Creational-Pattern-1.png","contentUrl":"https:\/\/blazeclan.com\/wp-content\/uploads\/2014\/02\/The-Factory-Design-Pattern-\u2013-The-DOs-_-DONTs-of-the-Quintessential-Creational-Pattern-1.png","width":1650,"height":680},{"@type":"BreadcrumbList","@id":"https:\/\/blazeclan.com\/blog\/factory-design-pattern-dos-donts-quintessential-creational-pattern\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/blazeclan.com\/india\/"},{"@type":"ListItem","position":2,"name":"The Factory Design Pattern &#8211; The DO&#8217;s &amp; DON&#8217;Ts of the Quintessential Creational Pattern"}]},{"@type":"WebSite","@id":"https:\/\/blazeclan.com\/india\/#website","url":"https:\/\/blazeclan.com\/india\/","name":"Blazeclan","description":"","publisher":{"@id":"https:\/\/blazeclan.com\/india\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/blazeclan.com\/india\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-IN"},{"@type":"Organization","@id":"https:\/\/blazeclan.com\/india\/#organization","name":"Blazeclan","url":"https:\/\/blazeclan.com\/india\/","logo":{"@type":"ImageObject","inLanguage":"en-IN","@id":"https:\/\/blazeclan.com\/india\/#\/schema\/logo\/image\/","url":"https:\/\/blazeclan.com\/wp-content\/uploads\/2024\/10\/ITCI-Blazeclan_logo.svg","contentUrl":"https:\/\/blazeclan.com\/wp-content\/uploads\/2024\/10\/ITCI-Blazeclan_logo.svg","caption":"Blazeclan"},"image":{"@id":"https:\/\/blazeclan.com\/india\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/blazeclan.hq\/","https:\/\/x.com\/blazeclan_hq","https:\/\/www.instagram.com\/blazeclantechnologies\/","https:\/\/www.linkedin.com\/company\/blazeclan-technologies\/","https:\/\/www.youtube.com\/channel\/UCCKF4Lcbtus-pUoZr7Lxrow"]},{"@type":"Person","@id":"https:\/\/blazeclan.com\/india\/#\/schema\/person\/779910eccddff4a1ea6663b6bfb271e8","name":"Team Blazeclan","image":{"@type":"ImageObject","inLanguage":"en-IN","@id":"https:\/\/blazeclan.com\/india\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/a43c1fa01bb3c7e839254c9084bf11ed422d7e633231f9e935096045af416ba2?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/a43c1fa01bb3c7e839254c9084bf11ed422d7e633231f9e935096045af416ba2?s=96&d=mm&r=g","caption":"Team Blazeclan"},"sameAs":["http:\/\/localhost\/ps-local-wp"]}]}},"_links":{"self":[{"href":"https:\/\/blazeclan.com\/india\/wp-json\/wp\/v2\/posts\/29845","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blazeclan.com\/india\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blazeclan.com\/india\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blazeclan.com\/india\/wp-json\/wp\/v2\/users\/192"}],"replies":[{"embeddable":true,"href":"https:\/\/blazeclan.com\/india\/wp-json\/wp\/v2\/comments?post=29845"}],"version-history":[{"count":0,"href":"https:\/\/blazeclan.com\/india\/wp-json\/wp\/v2\/posts\/29845\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blazeclan.com\/india\/wp-json\/wp\/v2\/media\/16668"}],"wp:attachment":[{"href":"https:\/\/blazeclan.com\/india\/wp-json\/wp\/v2\/media?parent=29845"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blazeclan.com\/india\/wp-json\/wp\/v2\/categories?post=29845"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blazeclan.com\/india\/wp-json\/wp\/v2\/tags?post=29845"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}