当前位置:网站首页>[designmode] factory pattern
[designmode] factory pattern
2022-06-30 23:44:00 【weixin_ forty-three million two hundred and twenty-four thousan】
1. Simple factory model
The simple factory pattern is a creation pattern , It's a kind of factory model . The simple factory pattern is that a factory object determines which product to create
Class . The simple factory pattern is the simplest and most practical pattern in the family of factory patternsSimple factory model : Defines a class for creating objects , This class encapsulates the behavior of the instantiated object ( Code )
In software development , When we're going to use a lot to create a certain 、 When a class or a batch of objects , It will use the factory mode .
1.1 Look at a specific need
Look at a pizza project : To facilitate the expansion of pizza varieties , Be easy to maintain
There are many kinds of pizza ( such as GreekPizz、CheesePizz etc. )
Pizza is made of prepare,bake, cut, box
Complete the pizza order function .
1.2 Use the traditional way to complete
Class diagram :

Code :
//public class OrderPizza {
// Constructors
// public OrderPizza() {
// Pizza pizza = null;
<边栏推荐
- 35家巨头科技公司联合组成元宇宙标准论坛组织
- 6-1 exploit -ftp exploit
- Achieve secure data sharing among multiple parties and solve the problem of asymmetric information in Inclusive Finance
- 基金销售行为规范及信息管理
- Ideal interface automation project
- Netease cloud sign in lottery? That year I could sign in for 365 days. No? Look.
- 一次革命、两股力量、三大环节:《工业能效提升行动计划》背后的“减碳”路线图
- How to close an open DNS resolver
- Two way data binding in wechat applet
- IFLYTEK active competition summary! (12)
猜你喜欢

206页上海BIM技术应用与发展报告2021

Ideal interface automation project

MaxPool2d详解--在数组和图像中的应用

Introduction to machine learning compilation course learning notes lesson 2 tensor program abstraction
![[fundamentals of wireless communication-13]: illustrated mobile communication technology and application development-1-overview](/img/1d/62e55f1b5445d7349ec383879f4275.png)
[fundamentals of wireless communication-13]: illustrated mobile communication technology and application development-1-overview

"Paddle + camera" has become a "prefabricated dish" in the AI world, and it is easier to implement industrial AI quality inspection

Solve arm_ release_ ver of this libmali is ‘g2p0-01eac0‘,rk_ so_ Ver is' 4 ', libgl1 mesa dev will not be installed, and there are unsatisfied dependencies

Detailed explanation of conv2d -- use in arrays and images

ABAQUS 2022 software installation package and installation tutorial

Development of wireless U-shaped ultrasonic electric toothbrush
随机推荐
lvm-snapshot:基于LVM快照的备份
flutter - sort List排序
Asynchronous transition scenario - generator
Warmup preheating learning rate "suggestions collection"
Cesiumjs 2022 ^ source code interpretation [6] - new architecture of modelempirical
CTFSHOW框架复现篇
Mysql database query optimization
Bridge emqx cloud data to AWS IOT through the public network
KubeVela 1.4:让应用交付更安全、上手更简单、过程更透明
"Paddle + camera" has become a "prefabricated dish" in the AI world, and it is easier to implement industrial AI quality inspection
Combining online and offline, VR panorama is a good way to transform furniture online!
异步过渡方案—Generator
CesiumJS 2022^ 源码解读[6] - 三维模型(ModelExperimental)新架构
Advanced mathematical modeling
Software engineering best practices - project requirements analysis
ABAQUS 2022 software installation package and installation tutorial
VR panorama adds contrast function to make the display of differentiation effect more intuitive!
Redis - 01 cache: how to use read cache to improve system performance?
基金客户和销售机构
Shell multitasking to download video at the same time