Suggest to look at the first version of the factory mode click me > click me > click me…

Brother said, your factory model said a reasonable, add an abstract do you understand?

I think, yesterday little sister ignored, secretly looked at the factory mode ultimate version ->> abstract factory mode, and then calmly answered: slightly understand slightly understand, ha ha!

In short, the abstract factory pattern can be viewed as a two-dimensional data model.

Brother: It’s kind of like a factory factory

Me: It’s still different. It’s still a one-floor factory, not a new one for the factory. The abstract factory pattern is an updated version of the factory approach, but each physical factory can produce a much richer set of products. There are a variety of products. In order to be able to make the factory action can be uniform, that is, the abstract factory class can adapt to different products. It also abstracts the similar products of various manufacturers into interface classes. In this way, the abstract factory can adapt to the various products of various manufacturers.

Brother: How does it expand?

Me: If it is to expand the new factory, then it will be similar to the extension of the factory method pattern, not only to create a new factory, but also all the corresponding categories of products of the new factory. The factory method pattern is to create a new factory and a corresponding product class. That’s the difference. In short, when product regulations are dead, manufacturers can expand a lot.

[Factory mode]juejin.cn/post/697204…

[making address] github.com/shwndi/desi…