Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: echoTheLiar/JavaCodeAcc
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: soxhwhat/JavaCodeAcc
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Checking mergeability… Don’t worry, you can still create the pull request.
  • 4 commits
  • 14 files changed
  • 1 contributor

Commits on Jun 29, 2023

  1. doc: 桥接模式的学习

    合成/聚合复用原则(CARP),尽量使用合成/聚合,尽量不要使用类继承。[J&DP]
    
     由于实现的方式有多种,桥接模式的核心意图就是把这些实现独立出来,让它们各自地变化。这就使得每种实现的变化不会影响其他实现,从而达到应对变化的目的。
    soxhwhat committed Jun 29, 2023
    Configuration menu
    Copy the full SHA
    afb1c61 View commit details
    Browse the repository at this point in the history
  2. docs: 简单工厂模式

    1.松耦合性--使用继承和多态
    2.到底要实例化谁,将来会不会增加实例化的对象,比如增加开根运算,这是很容易变化的地方,应该考虑用一个单独的类来做这个创造实例的过程,这就是工厂。
    soxhwhat committed Jun 29, 2023
    Configuration menu
    Copy the full SHA
    521e1ad View commit details
    Browse the repository at this point in the history

Commits on Jul 3, 2023

  1. docs: 工厂模式

    1.克服简单工程模式破坏开闭原则的缺点
    2.通过实现抽象接口、多态等特性实现够工厂模式
    soxhwhat committed Jul 3, 2023
    Configuration menu
    Copy the full SHA
    f69b53c View commit details
    Browse the repository at this point in the history

Commits on Jul 12, 2023

  1. docs: 策略模式

    原则: 对既有的代码影响最小的方式来修改软件,可以节省时间去让程序做更酷的时间。
    
    设计原则:
    1. 找出应用中可能需要变化之处,把它们独立出来,不要和一成不变的东西混在一起。(几乎是所有设计模式背后的精神所在)
    2. 针对接口编程(针对超类型,可以是抽象类或者是接口),而不是针对实现编程。比方说,我们想要产生一个新的绿头鸭实例,
    并指定特定"类型"的飞行行为给它。干脆顺便让鸭子的行为可以动态地改变好了。换句话说,我们应该在鸭子类中包含设定行为的方法,这样就可以在"运行时"动态地"改变"绿头鸭的飞行行为。
    鸭子的子类将使用接口表示行为,所以实际的行为不会被绑定在鸭子的子类中。(换句话说,特定的具体行为编写在具体的实现类中)
    
    3. 多用组合,少用继承。
    
    1. 当涉及到维护时,为了复用目的而使用继承,结局并不完美。
    2. 利用接口实现行为,会导致重复代码(实现借口)激增
    soxhwhat committed Jul 12, 2023
    Configuration menu
    Copy the full SHA
    ce998fe View commit details
    Browse the repository at this point in the history
Loading