Skip to main content

Defining a Pattern

Introduction: Defining a Pattern

What is a proto-pattern in terms of design patterns?

View Answer:
Interview Response: A pattern that has not yet passed "pattern"-ity tests is called a proto-pattern. Proto-patterns result from the work of someone that created a specific solution that is worthy of sharing but may not have yet had the opportunity to be qualified due to its newness.

What do you name a description or fragment of a proto-pattern?

View Answer:
Interview Response: A brief description or snippet of a pattern is known as patlet.

How can we know if a design pattern is worth utilizing?

View Answer:
Interview Response: Estimating a good design pattern.
  • Solves a particular problem: Patterns are not designed to capture concepts or methods; instead, they are designed to capture solutions. This method is a necessary component of a successful design pattern.

  • There is no clear answer to this problem: Problem-solving frequently seeks to deduce from well-known concepts. The best design patterns frequently give indirect answers to challenges – this approach is an essential strategy for the most challenging design problems.

  • The concepts must be proven solutions to a problem: Design patterns require proof that they function as described, and without this, we should not entertain their use.

  • It must describe or express a relationship: A pattern may represent a module type in some circumstances. While an implementation may appear this way, the formal design description must specify far deeper system structures and processes that explain how it connects to our code.

What is "The Rule of Three" concerning design patterns?

View Answer:
Interview Response: One of the additional requirements for a pattern to be valid is that they display some recurring phenomenon. We often qualify this approach in three key areas, known as the rule of three.

To show recurrence, one must demonstrate:
  1. Fitness of purpose: How is the pattern proven to be successful?

  2. Usefulness: Why is the pattern considered good?

  3. Applicability: Is the design worthy of being a pattern because it pliable? How we implement, the design pattern must be detailed. When reviewing or defining a design pattern, it is essential to keep the above in mind.

Describe the process used to author a new design pattern?

View Answer:
Interview Response: The process used to create a new design pattern include documentation of your intent, motivation, structural representation, and code examples.

Technical Response: The process used to create a new design pattern includes documentation of your intent, motivation, structural representation, and code examples. Intent covers the problems and solutions and describes what the design does. The motivation explains the problem in detail and how the pattern solves the problem. The structure includes a class and object diagram that depicts each aspect of the pattern and how they are connected. The author provides a code example to represent the design.