Students who are in the direction of Tailiruan can come in and have a look, some tips for the final exam

I heard that the little cutie in our direction is going to take an exam recently. As an old senior (emphasis!) (pointing), let me share with you some of my experience on the exam~

** Declaration in advance: My grades are not particularly good, and my experience may not be helpful. If you waste your time, don't scold me :)

Design Patterns:

First of all, the following content is the essence, you must memorize it all! Secondly, the multiple-choice questions need to integrate the following content and then add a little expansion to make a high score, but the short-answer questions are invincible if you memorize the following things. For big questions, you need to have a good understanding of all design patterns, and you must memorize the code to get full marks. It is recommended to find out last year's questions and do it to feel it.

Single Responsibility Principle: Improve reusability, high cohesion and low coupling.
The principle of opening and closing: open for expansion, and close for modification. Flexibility, stability, abstraction.
Liskov Substitution Principle: A parent class can be replaced by a subclass, but not vice versa. (Abstraction, code reuse, scalability)
Dependency inversion principle: programming for the abstraction layer. (Abstract)
Interface Segregation Principle: Multiple specialized interfaces replace unified interfaces and do not rely on unnecessary interfaces.
The principle of synthetic reuse: more combination and aggregation, less inheritance. (Down-Coupling)
Law of Demeter: A software entity interacts with other entities as little as possible. Only communicate with direct friends. (loose coupling)

name definition advantage shortcoming Applicable environment Remark
Simple Factory (Static Factory) (Creative Type) Returns instances of different classes depending on the parameters. OA system The creation and use of objects are separated. The use of configuration files improves system flexibility. The client only needs to know the corresponding parameters of the product category. The factory class has too many responsibilities. Scaling is difficult. Increased system complexity and difficulty of understanding. The factory class is responsible for creating fewer objects. Don't care about creation details. Single Responsibility Principle Down-Coupling Open-Closed Principle
factory method The instantiation of the class is delayed to the subclass, and the subclass decides which class to instantiate (create). logger Hide from clients which concrete product class is instantiated. The factory independently determines which product objects to create. Adding new products follows the open-closed principle. The number of classes increases in pairs, and the complexity of the system increases. It increases the abstraction and difficulty of understanding of the system. The customer does not know the class name of the specific product class. The abstract factory class specifies which object to create through its subclasses. Open-Closed Principle Scalability
abstract factory Provides an interface for creating a series of related or interdependent objects without specifying their concrete classes. Electric factory, database operation factory The generation of concrete classes is isolated. Clients are guaranteed to always use only the same product family object. Adding a new product family is convenient and conforms to the principle of opening and closing. Adding a new product level structure is troublesome and violates the principle of opening and closing. The system does not rely on product creation, composition, and expressive details. Use only one product family at a time and all products together. The product hierarchy structure is stable. + New product family, matching opening and closing. + New product class structure, does not conform to opening and closing.
Builder Builder Separate the construction and representation of complex objects so that the same construction can create different representations. KFC package, JavaMail The product itself is decoupled from the product creation process. Replacing/adding concrete builders follows the open-closed principle. Gain finer control over the product creation process. Not applicable if there are large differences between products. The complex internal changes of the product require more specific construction classes, resulting in an overly large system. The products that need to be generated have complex internal structures, and the attributes depend on each other. The object creation process is independent of the class that creates the object.
Prototype mode Prototype Given a prototype object to indicate the type of object to be created, copy this prototype object to create more objects of the same type. Shallow clone, deep clone (serialization), mail copy. Simplify the object creation process and improve the efficiency of new instance creation. Simplify the creation of structure, good scalability. The deep clone method can save the object state. (revocation) Each class needs to be equipped with a clone method. Modifying existing classes requires modifying the source code and changing the principle of opening and closing. Deep clone code is complicated. Creating new objects is expensive. The state of the object changes little. Avoid using hierarchical factory classes.
Singleton mode Singleton To ensure that there is only one instance of a class, instantiate itself and provide this instance to the entire system. ID card, printing pool Provides controlled access to unique instances. Save system resources and improve performance. Multiple instances of classes are allowed. Scaling is difficult. Singleton class has too many responsibilities. The automatic garbage collection mechanism loses the state of the singleton object. Only one object is required/allowed to be created. Only one public access point is allowed.
Adapter mode (structural type) Adaptee Converts one interface to another interface that the client wants, enabling classes with incompatible interfaces to work together. Robot impersonation, encryption adapter Decouple the target class from the adapter. Increased class transparency and reusability. Good flexibility and scalability. Class Adapter: Only one adapter class is adapted at a time. The target abstract class can only be an interface, not a class. Object Adapter: Replacing some methods of the adapter class is troublesome. The system needs to use some existing classes, and the interface of these classes does not meet the needs of the system. Create a class that can be reused.
Bridge Mode Implementor The abstraction is partially separated from the implementation so that they can vary independently. Large, medium and small colored brushes, cross-platform video player Separation of abstract interface and its implementation part. Instead of multi-level inheritance, reduce the number of subclasses. Improve the scalability of the system. Increase the difficulty of system understanding and design. Difficulty correctly identifying two independently varying dimensions in a system. Increase flexibility between abstraction and reification. The abstraction and the realization of some independent extensions do not affect each other. Do not want to use inheritance.
Combination ModeLeaf Multiple objects are combined to form a tree structure to represent the whole-part hierarchy, and the use of single objects and composite objects is consistent. fruit plate, file browsing Define hierarchical complex objects, ignoring hierarchical differences. It is convenient to add new capacity components and leaf components. Realize object-oriented tree structure. The abstraction is complex and difficult. When adding new components, it is difficult to limit the types of components in the container. Clients are expected to treat whole, part hierarchies consistently. Handle tree structures in object-oriented development systems. Leaf and container objects can be separated in the system.
Decorator mode Decorator Dynamically add some additional responsibilities to an object. Transformers transform into airplanes, robots, and multiple encryption systems It is more flexible than inheritance and will not increase the number of classes dramatically. Dynamically extend object functionality. An object can be decorated multiple times. Adding new component classes and decoration classes conforms to the principle of opening and closing. Affects object performance to a certain extent. More error-prone and harder to debug than inheritance. Dynamically and transparently add responsibilities to individual objects. The system cannot be extended by inheritance.
Appearance mode Facade Provide a unified entry for complex subsystems. Main power switch, file encryption appearance class, Reduces the number of objects the client needs to handle. The loose coupling between the subsystem and the client is realized. Subsystem modification has no effect on other subsystems, appearance. Direct use of subsystem classes by clients is not well restricted. Adding a new subsystem needs to modify the appearance class, which violates the principle of opening and closing. Provides easy access to complex subsystems. The client has dependencies on several subsystems. Hierarchies are linked through facade classes. Demeter's Law Downcoupling
Proxy mode Proxy Provide a proxy to the object, and the proxy object controls the reference of the original object. Forum permission control, picture preview Coordinate caller, callee, decoupling. There is no need to modify the code to add/replace proxy classes, which conforms to the principle of opening and closing. (protection proxy) may cause slow request processing. (Remote Agent) The implementation process is complex. Remote Proxy, Virtual Proxy (Preview), Buffer Proxy (Shared Access), Protect Proxy (Privilege), Smart Reference Proxy
Command mode (object behavior mode) Invoker Encapsulate a request as an object to decouple the request caller and receiver. TV remote control (switch, exchange), function keys Reduce system coupling. New commands are easy to add to the system and conform to the principle of opening and closing. Command Queues, Macros, Request Undo, Redo. May cause some systems to have too many specific command classes. Decouple request caller and receiver. Requests are specified at different times, requests are queued, execution commands are revoked, and resumed.
Iterator mode Iterator Provides a way to access aggregated objects without exposing the object's internal representation. Remote control to change channels Multiple traversal methods can be defined for the same aggregation object. Simplified aggregate classes. It is convenient to add aggregation classes and iterators, and conforms to the principle of opening and closing. Adding a new aggregation class requires a new iterator class, increasing the complexity. The design is difficult and it is difficult to consider it comprehensively. Access aggregate object content without exposing internals. Provide multiple traversal methods for an aggregation class. Provide a unified interface for traversing different aggregation structures. Single Responsibility Principle
Observer pattern Observer A one-to-many dependency relationship between objects is defined, so that whenever an object state changes, its dependent objects are notified and automatically updated. Cat, dog, mouse, MVC, custom login control It can realize the separation of presentation layer and data logic layer. Support broadcast communication, one-to-many. An abstract coupling is established between the observation target and the observer. Adding specific observers and observation targets conforms to the principle of opening and closing. Notifying all observers takes a lot of time. If there is a circular dependency, the system may crash. The observer does not know how the target object changes. Abstract models depend on one side for another. Changes to one object cause changes to other objects. A trigger chain needs to be created in the system.
State mode State Allows an object to change its behavior when its internals change. Forum user level, people laugh when they are happy and cry when they are sad, the balance of the bank account is regular green, and the arrears are red 封装状态转换规则,集中管理代码。 注入不同状态可使环境对象行为不同。 允许状态转换逻辑与状态对象合成一体。 多环境对象共享一个状态对象,可以减少类的个数。 增加类和对象的个数,增大开销。 使用不当代码会导致混乱,增加难度。 新增/修改状态类不符合开闭原则。 状态改变导致对象行为变化。 代码有大量与对象状态有关的条件语句。
策略模式 Strategy 定义一系列算法,并将每个算法封装在一个类中,并让他们可以互相替换。让算法独立于使用它的客户而变化。 旅游出行策略,排序策略 支持开闭原则,可管理相关算法族。 可替换继承,提高算法复用。 避免多重条件语句。 客户端必须知道所有策略类并进行选择。 可能造成系统产生很多具体策略类。 无法同时使用多个策略类。 一个系统需动态地在多种算法中选择一个。 避免使用难以维护的多重条件选择。 不希望客户知道与算法相关的数据结构。 算法保密性 安全性

编译原理

我是通过哔哩哔哩大学的一个编译原理混子速成课学完的,有笔记(文章最后有百度网盘的分享,自取)
跟老师讲的做题步骤不一样,至于能不能得分我也不大清楚,慎学。
链接:https://www.bilibili.com/video/BV1ft4y1X7p6/
注:往年题全部做五遍,包过包高分

SpringBoot

如果学院里某个g姓老师在带课的话,一定要去蹭!讲的特别特别好,理论实践相结合,而且最重要的是会奶!
大题把springboot的数据传输过程搞明白,实验二搞明白!就好了。下附代码。
Article实体类:

public class Article {
    
    
    private int id;
    private String title;
    private String content;
    private List<Comment> commentList;

    public int getId() {
    
    
        return id;
    }

    public void setId(int id) {
    
    
        this.id = id;
    }

    public String getTitle() {
    
    
        return title;
    }

    public void setTitle(String title) {
    
    
        this.title = title;
    }

    public String getContent() {
    
    
        return content;
    }

    public void setContent(String content) {
    
    
        this.content = content;
    }

    public List<Comment> getCommentList() {
    
    
        return commentList;
    }

    public void setCommentList(List<Comment> commentList) {
    
    
        this.commentList = commentList;
    }

    @Override
    public String toString() {
    
    
        return "Article{" +
                "id=" + id +
                ", title='" + title + '\'' +
                ", content='" + content + '\'' +
                ", commentList=" + commentList +
                '}';
    }
}

Comment实体类:

public class Comment {
    
    
    private int id;
    private String content;
    private String author;
    private int aId;

    public int getId() {
    
    
        return id;
    }

    public void setId(int id) {
    
    
        this.id = id;
    }

    public String getContent() {
    
    
        return content;
    }

    public void setContent(String content) {
    
    
        this.content = content;
    }

    public String getAuthor() {
    
    
        return author;
    }

    public void setAuthor(String author) {
    
    
        this.author = author;
    }

    public int getaId() {
    
    
        return aId;
    }

    public void setaId(int aId) {
    
    
        this.aId = aId;
    }

    @Override
    public String toString() {
    
    
        return "Comment{" +
                "id=" + id +
                ", content='" + content + '\'' +
                ", author='" + author + '\'' +
                ", aId=" + aId +
                '}';
    }
}

mapper:

@Repository @Mapper
public interface ArticleMapper {
    
    
public Article findById(int id);
public List<Article> findAll();
}

mapper.xml:

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<!--<mapper><mapper>中内容自行补充-->
<mapper namespace="springbootsy.sy2.mapper.ArticleMapper">
    <select id="findById" parameterType="Integer" resultMap="articleWithComment">
        select a.*,b.id as cid ,b.content as bcontent ,author,a_id
        from t_article a left join t_comment b
        on a.id=a_id
        where a_id=#{
    
    id}
    </select>
    <resultMap id="articleWithComment" type="Article">
        <id property="id" column="id"/>
        <result property="title" column="title"/>
        <result property="content" column="content"/>
        <collection property="commentList" ofType="Comment">
            <id property="id" column="cid"/>
            <result property="content" column="bcontent"/>
            <result property="author" column="author"/>
            <result property="aId" column="a_id"/>
        </collection>
    </resultMap>

    <select id="findAll" parameterType="Integer" resultMap="articleWithComment">
        select a.*,b.id as cid ,b.content as bcontent ,author,a_id
        from t_article a left join t_comment b
        on a.id=a_id
    </select>
</mapper>

Controller:

@RestController
public class Controller {
    
    
    @GetMapping("/hello")
    public String hello(){
    
    
        return "软件1904班  白旭君   2019005368";
    }
}

ArticleController:

@Controller
@RequestMapping("/article")
public class ArticleController {
    
    
    @Autowired
    private ArticleMapper articleMapper;

    @GetMapping("/findAll")
    public  String findAll(Model model){
    
    
        List<Article> articleList = articleMapper.findAll();
        model.addAttribute("articleLists",articleList);
        return "articleList";
    }

    @GetMapping("/findById")
    public String findById(int id,Model model){
    
    
        Article article = articleMapper.findById(id);
        model.addAttribute("article",article);
        return "articleDetail";
    }
}

差不多就这些了,很多同学问我要实验报告,文章最后用百度网盘进行了分享。内容包含了一些我的个人信息,希望同学们不要恶意使用哦~

IT项目管理

就把PPT和老师发的那个文档背熟就行,平常多练练口才,考试写满!
文件(带一点点笔记)可以百度网盘自取。


百度网盘文件分享:


在这里插入图片描述链接:https://pan.baidu.com/s/1jOXvkSle2-DVsoSfYGWZJA?pwd=giv2
提取码:giv2
–来自百度网盘超级会员V5的分享
(看到没有,尊贵的v5)


声明:分享的内容均为免费,旨在为一些需要的同学提供一点点帮助,请勿私自售卖。


如果有啥想咨询的啥的,直接加我就好了,我有空就会回的~最后祝愿大家学业有成,事业顺利!一路长虹!
有想入门前端的,或者学Java、学安卓的,找我,我有很多百度网盘的网课可以分享!(都是免费的,不要再问我多少钱啦)
QQ1226371240,微信b1958721504,记得备注。

Guess you like

Origin blog.csdn.net/LYly_B/article/details/130857105