为什么需要抽象工厂设计模式? [英] Why do we need Abstract factory design pattern?

查看:21
本文介绍了为什么需要抽象工厂设计模式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大部分定义都说:

抽象工厂提供了一个用于创建家庭的界面没有指定的相关对象他们的具体类

An abstract factory provides an interface for creating families of related objects without specifying their concrete classes

抽象工厂模式有什么用,我们可以通过创建具体类本身的对象来完成任务.为什么我们有一个创建 Concrete 类对象的工厂方法?

What is the use of Abstract Factory Pattern as we can achieve the task via creating object of concrete class itself. Why do we have a factory method that creates object of Concrete class?

请给我提供任何必须实现抽象工厂模式的真实示例?

Please provide me any real life example where I must implement abstractFactory pattern?

推荐答案

Abstract Factory 是依赖注入 (DI) 的核心设计模式.以下是 Stack Overflow 问题列表,其中抽象工厂的应用已被接受作为解决方案.

Abstract Factory is a very central design pattern for Dependency Injection (DI). Here's a list of Stack Overflow questions where application of Abstract Factory has been accepted as the solution.

据我所知,这些问题代表了人们真正关心的问题或问题,因此您应该从一些现实生活中的例子开始:

To the best of my understanding, these questions represent real concerns or problems that people had, so that should get you started with some real-life examples:

这篇关于为什么需要抽象工厂设计模式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆