Java8设计模式最佳实战-设计模式概述(第三天学习记录)(1)

先自我介绍一下,小编浙江大学毕业,去过华为、字节跳动等大厂,目前阿里P7

深知大多数程序员,想要提升技能,往往是自己摸索成长,但自己不成体系的自学效果低效又漫长,而且极易碰到天花板技术停滞不前!

因此收集整理了一份《2024年最新Java开发全套学习资料》,初衷也很简单,就是希望能够帮助到想自学提升又不知道该从何学起的朋友。
img
img
img
img
img
img

既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,涵盖了95%以上Java开发知识点,真正体系化!

由于文件比较多,这里只是将部分目录截图出来,全套包含大厂面经、学习笔记、源码讲义、实战项目、大纲路线、讲解视频,并且后续会持续更新

如果你需要这些资料,可以添加V获取:vip1024b (备注Java)
img

正文

  • isolates 隔离,孤立,脱离 ; 将…剔出 ; 使分离 ; 使离析 ;

In our example, the Abstract Factory’s structure has three main

在我们的示例中,抽象工厂的结构有三个主要部分

classes—AbstractFactory, Product, and Sale. The concrete classes of

类抽象工厂、产品和销售。具体类别

AbstractFactory are CellPhoneFactory, NotebookFactory, and TabletFactory.

AbstractFactory是CellPhoneFactory、NotebookFactory和TableFactory。

CellPhoneFactory is a concrete class responsible for creating the concrete classes

CellPhoneFactory是一个负责创建具体类的具体类

CellphoneProduct and CellphoneSale, NotebookFactory is a concrete class

CellphoneProduct and CellphoneSale, NotebookFactory是一个具体的类

responsible for creating the concrete classes NotebookProduct and NotebookSale, and

负责创建NotebookProduct和NotebookSale的具体类,以及

the TabletFactory is a concrete class responsible for creating the concrete classes

TabletFactory是一个具体类,负责创建具体类

TabletProduct and TabletSale. A Client is a class responsible for using

TabletProduct和TabletSale。客户端是负责使用

AbstractFactory to create AbstractProduct and AbstractSale. The concrete factory

AbstractFactory创建AbstractProduct和AbstractSale。具体工厂

is created at runtime and it then creates the concrete product and sale.

在运行时创建,然后创建具体的产品和销售。

The Abstract Factory pattern is sometimes used with another pattern such as Singleton,

抽象工厂模式有时与另一个模式(如Singleton)一起使用,

which we described earlier. Abstract Factory is a single point of creation, and often we need

我们之前已经描述过了。抽象工厂是一个单一的创作点,我们经常需要

only one instance of it in an entire system. With this, using a Singleton pattern can help us

整个系统中只有一个实例。因此,使用单例模式可以帮助我们

create a design better and more efficiently.

创造一个更好更有效的设计。

This pattern is often used in frameworks and APIs that have a difficult creation process for

这种模式通常用于那些对

an object, such as connections or sessions.

对象,如连接或会话。

Explaining Facade

解释门面

Projects can sometimes turn out to be very complex and big, making them difficult to

项目有时会变得非常复杂和庞大,这使得它们很难做到

design and organize. To solve this, a great solution is to break a system into subsystems

设计和组织。为了解决这个问题,一个很好的解决方案是将一个系统分解成子系统

(divide and conquer) and make them less complex and better organized.

(分而治之)并使之更简单,更有条理。

The Facade pattern creates a higher-level interface to hide a complexity of a set of interfaces

Facade模式创建了一个更高级别的接口,以隐藏一组接口的复杂性

in a subsystem. This pattern reduces the complexity and coupling, minimizing

在子系统中。这种模式降低了复杂性和耦合性,将

communication and dependencies between subsystems. In the following diagram, you can

子系统之间的通信和依赖性。在下图中,您可以

see the structure of Facade and how it is designed

看看门面的结构和它是如何设计的

在这里插入图片描述

In the preceding diagram, we can see the Facade pattern encapsulating all of the calls to

我们可以在前面的图中看到封装所有Facade的调用

subsystems and hiding these calls from the client. The system has one interface, Facade,

子系统,并对客户端隐藏这些调用。系统只有一个接口,Facade,

and the client calls this interface in order to call subsystems. Thus, clients does not call

客户端调用这个接口来调用子系统。因此,客户端不会调用

the subsystems directly. With this solution, the client doesn’t need to know about the

直接分系统。有了这个解决方案,客户不需要知道

subsystem and its complexity.

子系统及其复杂性。

This pattern is often used in projects and systems that have high complexity and need to be

此模式通常用于具有高度复杂性且需要

broken down into subsystems.

分解成子系统。

重点词汇


  • preceding 在…之前发生 ; 先于 ; 走在…前面 ; precede的现在分词

  • encapsulating 简述 ; 概括 ; 压缩 ; encapsulate的现在分词

  • all of 一共 ; 足足 ; 至少

  • in order to 为了;以便;目的在于 ; 要想……

  • does not 不 ; 不是 ; 否定就用

  • need to know 需了解;需知道

  • broken down 临时出故障的 ; 受损事故发生故障

Explaining Iterator

解释迭代器

Imagine that we want a way to access elements of an aggregate object sequentially without

设想一下,我们需要一种无需

exposing its internal structure. The Iterator pattern does just that.

暴露其内部结构。迭代器模式就是这样做的。

The Iterator pattern is responsible for sequentially accessing the aggregate object and

迭代器模式负责顺序访问聚合对象和

defining an interface to access the elements without exposing the internal structure. This

定义一个接口来访问元素而不暴露内部结构。这个

interface doesn’t put a new element on the aggregate object, but simply reads elements to it.

接口不在聚合对象上放置新元素,而只是向它读取元素。

In the following diagram, you can see the structure of an Iterator and how it is designed

在下面的图表中,您可以看到迭代器的结构以及它是如何设计的

在这里插入图片描述

In the preceding diagram, we can see the Aggregate and Iterator interfaces with their

在前面的图中,我们可以看到聚合和迭代器接口

concrete subclasses. The client is the class that uses the Iterator to access elements of

具体的子类。客户机是使用迭代器访问

Aggregate.

聚合。

This pattern is used on Java collections such as list, deque, and set. Understanding this

此模式用于Java集合,如list、deque和set。明白吗

pattern will help you to understand Java collections.

模式将帮助您理解Java集合。

Explaining Proxy

解释代理

Sometimes, creating a new object can be a big process and several rules can be involved in

有时,创建一个新对象可能是一个很大的过程,可能涉及到几个规则

creating this object. Imagine that we want to create a list of objects, and these objects

总结

这个月马上就又要过去了,还在找工作的小伙伴要做好准备了,小编整理了大厂java程序员面试涉及到的绝大部分面试题及答案,希望能帮助到大家

在这里插入图片描述

在这里插入图片描述

网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。

需要这份系统化的资料的朋友,可以添加V获取:vip1024b (备注Java)
img

一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!
cDD-1713386555231)]

网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。

需要这份系统化的资料的朋友,可以添加V获取:vip1024b (备注Java)
[外链图片转存中…(img-oTOYpksg-1713386555231)]

一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!

  • 47
    点赞
  • 42
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值