Design Patterns in Go - Refactoring.Guru

文章推薦指數: 80 %
投票人數:10人

The Catalog of Go Examples · Creational Patterns · Abstract Factory · Builder · Factory Method · Prototype · Singleton · Structural Patterns · Adapter. Hey,Ihavejustreducedthepriceforallproducts.Let'sprepareourprogrammingskillsforthepost-COVIDera.Checkitout»   DesignPatternsinGo TheCatalogofGoExamples CreationalPatterns AbstractFactory Letsyouproducefamiliesofrelatedobjectswithoutspecifyingtheirconcreteclasses. Mainarticle Codeexample Builder Letsyouconstructcomplexobjectsstepbystep.Thepatternallowsyoutoproducedifferenttypesandrepresentationsofanobjectusingthesameconstructioncode. Mainarticle Codeexample FactoryMethod Providesaninterfaceforcreatingobjectsinasuperclass,butallowssubclassestoalterthetypeofobjectsthatwillbecreated. Mainarticle Codeexample Prototype Letsyoucopyexistingobjectswithoutmakingyourcodedependentontheir classes. Mainarticle Codeexample Singleton Letsyouensurethataclasshasonlyoneinstance,whileprovidingaglobalaccesspointtothisinstance. Mainarticle Codeexample StructuralPatterns Adapter Allowsobjectswithincompatibleinterfacestocollaborate. Mainarticle Codeexample Bridge Letsyousplitalargeclassorasetofcloselyrelatedclassesintotwoseparatehierarchies—abstractionandimplementation—whichcanbedevelopedindependentlyofeachother. Mainarticle Codeexample Composite Letsyoucomposeobjectsintotreestructuresandthenworkwiththesestructuresasiftheywereindividualobjects. Mainarticle Codeexample Decorator Letsyouattachnewbehaviorstoobjectsbyplacingtheseobjectsinsidespecialwrapperobjectsthatcontainthebehaviors. Mainarticle Codeexample Facade Providesasimplifiedinterfacetoalibrary,aframework,oranyothercomplexsetofclasses. Mainarticle Codeexample Flyweight LetsyoufitmoreobjectsintotheavailableamountofRAMbysharingcommonpartsofstatebetweenmultipleobjectsinsteadofkeepingallofthedataineachobject. Mainarticle Codeexample Proxy Letsyouprovideasubstituteorplaceholderforanotherobject.Aproxycontrolsaccesstotheoriginalobject,allowingyoutoperformsomethingeitherbeforeoraftertherequestgetsthroughtotheoriginalobject. Mainarticle Codeexample BehavioralPatterns ChainofResponsibility Letsyoupassrequestsalongachainofhandlers.Uponreceivingarequest,eachhandlerdecideseithertoprocesstherequestortopassittothenexthandlerinthechain. Mainarticle Codeexample Command Turnsarequestintoastand-aloneobjectthatcontainsallinformationabouttherequest.Thistransformationletsyoupassrequestsasamethodarguments,delayorqueuearequest'sexecution,andsupportundoableoperations. Mainarticle Codeexample Iterator Letsyoutraverseelementsofacollectionwithoutexposingitsunderlyingrepresentation(list,stack,tree,etc.). Mainarticle Codeexample Mediator Letsyoureducechaoticdependenciesbetweenobjects.Thepatternrestrictsdirectcommunicationsbetweentheobjectsandforcesthemtocollaborateonlyviaamediatorobject. Mainarticle Codeexample Memento Letsyousaveandrestorethepreviousstateofanobjectwithoutrevealingthedetailsofitsimplementation. Mainarticle Codeexample Observer Letsyoudefineasubscriptionmechanismtonotifymultipleobjectsaboutanyeventsthathappentotheobjectthey'reobserving. Mainarticle Codeexample State Letsanobjectalteritsbehaviorwhenitsinternalstatechanges.Itappearsasiftheobjectchangeditsclass. Mainarticle Codeexample Strategy Letsyoudefineafamilyofalgorithms,puteachofthemintoaseparateclass,andmaketheirobjectsinterchangeable. Mainarticle Codeexample TemplateMethod Definestheskeletonofanalgorithminthesuperclassbutletssubclassesoverridespecificstepsofthealgorithmwithoutchangingitsstructure. Mainarticle Codeexample Visitor Letsyouseparatealgorithmsfromtheobjectsonwhichtheyoperate. Mainarticle Codeexample Facebook Twitter Language English Español Français Polski PortuguêsBrasileiro Русский Українська 中文 Contactus Login EnglishEnglish EspañolEspañol FrançaisFrançais PolskiPolski PortuguêsBrasileiroPortuguês-Br РусскийРусский УкраїнськаУкраїнська 中文中文 PremiumContent DesignPatternseBook RefactoringCourse Refactoring WhatisRefactoring Cleancode Technicaldebt Whentorefactor Howtorefactor Catalog CodeSmells Bloaters LongMethod LargeClass PrimitiveObsession LongParameterList DataClumps Object-OrientationAbusers SwitchStatements TemporaryField RefusedBequest AlternativeClasseswithDifferentInterfaces ChangePreventers DivergentChange ShotgunSurgery ParallelInheritanceHierarchies Dispensables Comments DuplicateCode LazyClass DataClass DeadCode SpeculativeGenerality Couplers FeatureEnvy InappropriateIntimacy MessageChains MiddleMan OtherSmells IncompleteLibraryClass Refactorings ComposingMethods ExtractMethod InlineMethod ExtractVariable InlineTemp ReplaceTempwithQuery SplitTemporaryVariable RemoveAssignmentstoParameters ReplaceMethodwithMethodObject SubstituteAlgorithm MovingFeaturesbetweenObjects MoveMethod MoveField ExtractClass InlineClass HideDelegate RemoveMiddleMan IntroduceForeignMethod IntroduceLocalExtension OrganizingData SelfEncapsulateField ReplaceDataValuewithObject ChangeValuetoReference ChangeReferencetoValue ReplaceArraywithObject DuplicateObservedData ChangeUnidirectionalAssociationtoBidirectional ChangeBidirectionalAssociationtoUnidirectional ReplaceMagicNumberwithSymbolicConstant EncapsulateField EncapsulateCollection ReplaceTypeCodewithClass ReplaceTypeCodewithSubclasses ReplaceTypeCodewithState/Strategy ReplaceSubclasswithFields SimplifyingConditionalExpressions DecomposeConditional ConsolidateConditionalExpression ConsolidateDuplicateConditionalFragments RemoveControlFlag ReplaceNestedConditionalwithGuardClauses ReplaceConditionalwithPolymorphism IntroduceNullObject IntroduceAssertion SimplifyingMethodCalls RenameMethod AddParameter RemoveParameter SeparateQueryfromModifier ParameterizeMethod ReplaceParameterwithExplicitMethods PreserveWholeObject ReplaceParameterwithMethodCall IntroduceParameterObject RemoveSettingMethod HideMethod ReplaceConstructorwithFactoryMethod ReplaceErrorCodewithException ReplaceExceptionwithTest DealingwithGeneralization PullUpField PullUpMethod PullUpConstructorBody PushDownMethod PushDownField ExtractSubclass ExtractSuperclass ExtractInterface CollapseHierarchy FormTemplateMethod ReplaceInheritancewithDelegation ReplaceDelegationwithInheritance DesignPatterns WhatisaPattern What’sadesignpattern? Historyofpatterns WhyshouldIlearnpatterns? Criticismofpatterns Classificationofpatterns Catalog CreationalPatterns FactoryMethod AbstractFactory Builder Prototype Singleton StructuralPatterns Adapter Bridge Composite Decorator Facade Flyweight Proxy BehavioralPatterns ChainofResponsibility Command Iterator Mediator Memento Observer State Strategy TemplateMethod Visitor CodeExamples C# C++ Go Java PHP Python Ruby Swift TypeScript Login Contactus



請為這篇文章評分?