object-oriented design one thing expert designers know not to do is solve every problem from first principles -"design patternselements of reusable object-oriented software, gammar helmr johnsonand vlissides class is an encapsulation of data and methods that operate on that data classes match the way we think about computation they provide encapsulationwhich reduces the conceptual burden of writing codeand enable code reusethrough the use of inheritance and polymorphism howevernaive use of object-oriented constructs can result in code that is hard to maintain design pattern is general repeatable solution to commonly occurring problem it is not complete design that can be coded up directly--ratherit is description of how to solve problem that arises in many different situations in the context of object-oriented programmingdesign patterns address both reuse and maintainability in essencedesign patterns make some parts of system vary independently from the other parts adnan' design pattern course materialavailable freely onlinecontains lecture noteshomeworksand labs that may serve as good resource on the material in this creational patterns explain what each of these creational patterns isbuilderstatic factoryfactory methodand abstract factory solutionthe idea behind the builder pattern is to build complex object in phases it avoids mutability and inconsistent state by using an mutable inner class that has build method that returns the desired object its key benefits are that it breaks down the construction processand can give names to steps compared to constructorit deals far better with optional parameters and when the parameter list is very long static factory is function for construction of objects its key benefits are as followthe function' name can make what it' doing much clearer compared to call to constructor the function is not obliged to create new object--in particularit can return flyweight it can also return subtype that' more optimizede it can choose to construct an object that uses an integer in place of boolean array if the array size is not more than the integer word size factory method defines interface for creating an objectbut lets subclasses decide which class to instantiate the classic example is maze game with two modes--one with regular roomsand one with magic rooms from abc import abc abstractmethod