Blog: bugstack.cn

Precipitation, share, grow, let yourself and others can gain something! 😄

One, code field experience

🤔 has a word to call inside roll serious!

I first heard it when a friend commented on one of my HashMap source analysis posts: “Dude, you’re called inrolls!” . This article provides an in-depth explanation of perturbation functions, load factors, and related mathematical methods to verify the results. Core knowledge of HashMap, Disturbance function, load factor, Expansion list splitting, Deep learning

So what is inroll? At first glance, it’s a little new. In fact, inrolling comes from the word involution, which can also be called “overdensification.” It makes it easier to explain, for example;

  1. There are only 3 holes for 100 people to go to the bathroom, so it’s not fair to divide them, so whoever wears shorts today will go first
  2. Out of 100 students with 700 points or higher, 30 percent will go to North Chungcheong Province. Many of the more than 30,000 examinees who scored more than 600 points may not even get 211.
  3. Road congestion, can not let everyone drive, only endless lottery queue.

All of these can be explained as a serious problem of overcompaction, but fortunately, these are constantly being optimized and improved.

🤒 programmers also have internal volumes? !

In fact, most of the time we say the programmer volume, refers to the interview made rocket, job hunting is more and more difficult.

In fact, from a certain point of view, I personally do not quite agree that programmers have internal volume. In the industry as a whole, programmer employment and pay are good. Some people will feel that the interview has to brush questions, learn source code, look at the framework, understand the framework and so on, but these should not be you make a programmer career development path, the necessary breakthrough?

Maybe everyone feels stuck at some point, doing repetitive things, learning CRUD logic, not getting to the core technology, etc., and suddenly feels like a baboon. So it seems that you can only use the word “introvert” to balance your heart. Ask yourself, do you invest time in yourself to learn and grow? Do you have a plan to break through your own bottleneck? If there is no that is not called inside volume!

Ii. Conference Room

Xie Aeroplane, Xiaoji, the 🛩 aeroplane that came back to work for a week during the holiday was arranged by the group leader to share the growth of the project.

Group leader: Aircraft, in the project you share, the core module should be explained clearly to everyone. This piece is quite technical point!

Thank plane: yes yes, I also think how can let everybody understand.

Group leader: it is best to use some tools to express the code logic and functional flow through the way of diagrams.

Xie Airplane: I can draw the flow chart, but I don’t know how to do the core functions here.

Group leader: Hey, use UML class diagrams to show the core classes.

Thank plane:… No, I didn’t. Did I roll it inside?

Group leader: Shame on you! Wait for me to draw some data, teach you!

Three, rural love map learning

UML (Unified Modeling Language) is a Modeling tool for object-oriented design. The core of Modeling is model, which is a simplification of reality and a real abstraction.

In UML, all descriptions are composed of three components: transaction, relationship and diagram. The following figure shows the relationship of all components.

Next, we will focus on the UML class diagram relationship, in the embodiment of rural love characters.

1. Class diagram model

UML Class Diagrams (UML) is one of the most frequently used UML Diagrams. Class Diagrams represent classes, interfaces, and collaboration between them. Interfaces, classes, properties, and methods can be expressed as follows.

2. Inheritance

code

public classXie Guangkun{
    privateString degress.public voidAs a demon () {}}public classYong-qiang xieextendsXie Guangkun{}public classThank the planeextendsXie Guangkun{}Copy the code

The class diagram


  • Function: Inheritance relationship
  • Concept: Generaliztion, also known as generalization, is used to indicate that a subclass inherits all functions of its parent class.
  • Scene: Xie Guangkun’s skill as a demon, Xie Yongqiang and Xie Airplane inherit. Thank the aircraft inherited better, more can do.

3. Realize relationships

code

public interfaceDance art{
    voidStyle (); }public classLiu canimplementsDance art{
    privateString to name;public voidMove () {}}public classZhao fourimplementsDance art{
    privateString to name;public voidMove () {}}Copy the code

The class diagram


  • Function: Implements relationships
  • Concepts: interfaces, methods declared by abstract classes, and functions Realiztion by classes.
  • Scene: In a dance of zhao Si and Liu Neng, Zhao Si moves in fancy style and is kicked down by Liu Neng.

4. Combinatorial relationships

code

public classA marriage certificate{

    privateZhao Yutian;privateLiu Yingfu;public voidSet man (zhao Yutian man) {this.man = man; }public voidSet woman (Liu Ying woman) {this.woman = woman; }}public classZhao Yutian{

    private intAge;privateA String of gender; }public classLiu ying{

    private intAge;private intSex; }Copy the code

The class diagram


  • Function: Combinatorial relationship
  • Concept: Combination relation refers to the relation between the whole and the parts ina class. The whole and parts depend on each other.
  • Scene: The marriage certificate of Zhao Yutian and Liu Ying is indispensable.

5. Aggregation

code

public classThe heights{

    privateSong Xiaofeng;privateLi Treasure house treasure house;public voidMedicated cuisine room (Li Baoku Baoku) {thisTreasure = treasure; }public voidSecurity Department (Song Xiaofeng xiaofeng) {this. Xiao Feng = Xiao Feng; }}public classBao-ku li{

    privateString career; }public classXiao-feng song{

    privateString career; }Copy the code

The class diagram


  • Function: Aggregate relationships
  • Concept: An Aggregate relationship is also used to represent the whole and parts of an object, but the member objects can exist independently from the whole object.
  • Scene: The medicated diet in thechild Villa has Li Baoku and the security department has Song Xiaofeng. But Li Baoku and Song Xiaofeng are only one of them, and both can leave the resort.

6. Relationships

code

public classBean curd factory{
    privateWang Xiaomeng staff;public voidAdd staff (Wang Xiaomeng Xiaomeng){this.employee = Xiaomeng; }}public classsimeome{
    privateTofu factory enterprises;public voidAdd enterprise (tofu factory tofu factory){this.enterprise = tofu factory; }}Copy the code

The class diagram


  • Function: Association relationship
  • Concept: Association is a common relationship between classes. It represents the Association between one class of objects and another. Combination and aggregation also belong to this relationship, but the correlation is weaker.
  • Scene: There is Wang Xiaomeng in the tofu factory, but there is not only Wang Xiaomeng in the tofu factory, but also Wang Lao Qi. Even without Meng, the tofu factory can operate normally. And Wang Xiaomeng also has his own other enterprises, so this is a kind of correlation.

7. Dependencies

code

public classInvestment promotion and capital introduction{
    public voidInvestment (Wang Dana-Dana){}}public classAnd the king.{
    privateThe String resource; }Copy the code

The class diagram


  • Function: Dependencies
  • Dependency relationships are used when expressing that one transaction needs to use another.
  • Scene: investment promotion needs Wang Dana, but there is only one Dana. Dan Wang can’t come. Maybe There are Dan Li and Dan Zhang.

Iv. Panoramic class map of Zhao Family Class

To sum up, the code structures of combination, aggregation and correlation are similar in these six relationships, which can be understood from the strength of dependence. The order of strength is inheritance > implementation > Composition > Aggregation > Association > dependency.

To more clearly represent UML class relationships, we draw them in a single diagram, as follows;

Five, the summary

  • Some people say that if we and the aliens 👽 very friendly correspondence up. So there will be some communication between the two planets, such as asking, hello, earth people 🌐 people how tall are you? The earth says 1.75 meters. Aliens are dizzy. What’s a meter in? That leaves the two planets with the same standard: a meter is the distance light travels in a vacuum in 1/299,979,2458 seconds.
  • In fact, program development is also the same, in order to reduce the communication cost of understanding new knowledge content, need to define some communication standards, such as UML class diagram. Therefore, we need to learn these standard instrumental languages to reduce communication costs and improve work efficiency.
  • UML class diagrams are also the most commonly used diagrams and are very easy to master. In order to lay their knowledge more perfect, more solid grasp of the technology stack, but also to break through the bottleneck of each stage. You need to keep learning, keep accumulating, and find opportunities to break the game.

Six, series recommendation

  • Hold the grass! You poisoned the code!
  • A code review, almost failed the trial period!
  • Why do programmers build wheels and get promotions and pay raises?
  • “Relearning Java Design Pattern” (22 real development scenarios)
  • Interview manual (get the fastest car, get the most expensive offer)