Tag:Design pattern
-
Ruby uses the simple factory pattern and factory method pattern in design patterns
Have you seen Ruby beforeDesign pattern》, but gradually forget. Now I bought a big talk design pattern, which doesn’t look so boring. By the way, I implemented the code in ruby. Simple factory mode: ? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 […]
-
Ruby uses code examples of proxy and decoration patterns in design patterns
proxy pattern Requirements: Xiao Ming asks Xiao Li to chase Xiao Li for him (send dolls, flowers and chocolates) Code without agent: ? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 […]
-
Go language basic template design pattern example explanation
catalogue summary Template mode life case The policy pattern involves two roles UML summary Examples summary The template method pattern defines the steps of an algorithm and allows subcategories to provide their practice for one or more steps. Let subcategories redefine some steps in the algorithm without changing the algorithm architecture The execution sequence of […]
-
Ruby design pattern programming adapter pattern practical introduction
Adapter modeThe adapter pattern can be used to wrap different interfaces and provide a unified interface, or to make an object look like an object of another type. In static typeprograming languageIn, we often use it to meet the characteristics of type system, but in similarRubyIn such a weakly typed programming language, we don’t need […]
-
An example of using builder pattern in Ruby design pattern programming
Let’s review it firstDesign patternBasic concepts of: definitionSeparate the construction of a complex object from its representation, so that the same construction process can create different representations.The builder hides how the product is assembled, so if you need to change the internal representation of a product, you only need to redefine a builder. Practical scope1. […]
-
EBay: building mission critical multi data center applications using mongodb
As the world’s top 10 global retail brands, with 170 million active buyers and 1 billion online market, eBay can’t afford the loss caused by system downtime. This is why the company relies on mongodb as one of its core enterprise data platform standards to run eBay Com provides support for multiple customer-oriented applications. At […]
-
An example explains how Ruby uses decorator pattern in design pattern
summaryIf you have been engaged in object-oriented development, adding behavior to a class or object and using inheritance mechanism are a basic feature of all object-oriented languages. If an existing class lacks some methods, or needs to add more functionality (CHARM) to the methods, you may just inherit this class to generate a new class […]
-
Example analysis of the use of strategy pattern in Ruby design pattern programming
Today, your leader came to you with interest. I hope you can do him a little favor. He is in a hurry to go to the meeting now. What can I do for you? You’re curious.He told you that there is a user information table in the database of your project, which stores a lot […]
-
Two application examples of template method pattern in design pattern in Ruby
Example 1Today, you still come to work as usual and start your programming work as usual.The project manager told you that he wants to add a new function on the server today. He wants to write a method that can process the book object and wrap all the fields of the book object in XML […]
-
Explain the structure of composite pattern and its application in Ruby design pattern programming
definition:It is also called composite mode, or part whole mode. It is mainly used to describe the relationship between part and whole, define and combine objects into a tree structure to represent the hierarchical structure of “part whole”, so that users can use single objects and combined objects consistently. Class diagram: Role description: Componnent abstract […]
-
Analysis of application examples of appearance pattern in Ruby design pattern programming
What isAppearance mode? Appearance mode provides a unified interface for a group of different interfaces in the subsystem. Appearance defines the upper interface, which makes the subsystem easier to use by reducing the complexity and hiding the communication and dependencies between subsystems. For example, there is a set of different classes in the subsystem, some […]
-
Use of ViewModel
preface As an Android Developer, MVx design pattern is the most popular one, such as MVC and MVP, but now MVVM is the most popular one. The disassembly of MVVM is: m — model class, V — view, VM — ViewModel. Let’s take a look at the use of ViewModel, which is actually the design […]