Back-end technology stack induction training perception

I joined the new company in June and was fortunate to participate in the technology stack training provided by the company.

Although I don’t usually like learning very much, and my technical foundation is weaker than my kidneys, but after all, I have been around for 5 years, and basically I have understood or experienced almost all of them. So I didn't panic at first, but from the first class, I was shocked - I always knew that I was good at it, but I didn't expect that I was so good at it!

Here are some tidies:

About node.js

1. The priority and uniqueness of require loading files: I only know that it will not be loaded twice, and our customized files are all in the form of ("./***"), and I don't know about the others.

require加载文件的优先级以及唯一性
如果是名称,优先级 文件模块缓存->内置模块->第三方模块(node_modules)
如果是路径,则会按照自定义模块的规则查找。require("./a");  a->a.js->a.json->a.node->a文件夹(package.json mian指定 没有则index)
每一个编译成功的模块都会将其文件路径作为索引缓存在Module._cache对象上,以提高二次引入的性能。(深入浅出node.js p15-p20)
调用module.load()读取模块内容,然后调用modele.compile()编译执行

2. The characteristics of the arrow function: I only know that this cannot be

没有自身的this,函数体内的this,指向定义时的对象,而不是使用时的对象
不能当作构造函数,不能使用new命令
不能使用arguments对象,可以使用rest参数代替
不可使用yield命令,因此箭头函数不能用作Generator 

3. Block-level scope

arr = [];
let i;
for (i = 1; i < 10; i++) {
  arr.push(function () {
    console.log(i);
  });
}
arr.forEach((func) => func()); 	//10,10,10,10,10,10,10,10,10

arr = [];
for (let i = 1; i < 10; i++) {
  arr.push(function () {
    console.log(i);
  });
}
arr.forEach((func) => func()); //1,2,3,4,5,6,7,8,9

arr = [];
for (let a = []; a.length < 10; a.push(a.length)) {
  arr.push(function () {
    console.log(a.length);
  });
}
arr.forEach((func) => func());	//10,10,10,10,10,10,10,10,10

This problem has troubled me for a long time.

https://es6.ruanyifeng.com/#docs/let      take a look at this website

The explanation in Ruan Yifeng's article is that each cycle is a new variable, but this statement cannot explain the phenomenon of arrays. So the variable is still the same variable, but when the basic type is assigned, it will be converted into a constant value for processing. The types such as arrays and objects still refer to the original pointer.

 

about http

Re-learned and sorted out the body's too long processing mechanism, port multiplexing, cross-domain and other knowledge. Here's an interesting little episode

The difference between the get and the post we are talking about ! ! !

I don't know when I saw this post and was attracted by his emoji at the end of the post. So he remembered what he said- GET generates a TCP packet; POST generates two TCP packets.

https://mp.weixin.qq.com/s?__biz=MzI3NzIzMzg3Mw==&mid=100000054&idx=1&sn=71f6c214f3833d9ca20b9f7dcd9d33e4#rd

When the mentor asked me, I answered this confidently, but, I feel that my mentor looked at me like I was mentally retarded ==!

Later I saw other related articles

https://zhuanlan.zhihu.com/p/25028045

https://blog.josephscott.org/2009/08/27/xmlhttprequest-xhr-uses-multiple-packets-for-http-post/

So these are the design processing mechanisms of different browsers or the server itself, including other things that we say get data, urlpost, body, etc. cannot be called differences.

So what is the difference? I found the ultimate answer - different names .

 

About mongodb and index optimization

It mainly explains the process of analyzing query execution, including b-tree, b+-tree, composite index, etc.

Mongo's sparse index is different from others. Mongo's sparse index (sparse) refers to the entries of documents that only contain index fields, and skips documents that do not have index keys. The sparse index we often say is interval, which is different from dense Index relative.

 

About framework development and unit testing

log4j log format configuration, the config module manages the operating environment version, and thenjs, which is different from await, controls the asynchronous process

The focus is to learn the knowledge and application of mocha coverage report supertest to simulate network requests and other unit tests.

If the child route wants to get the value of the parent route, you can use const router = express.Router({ mergeParams: true });


 

Through this training, I deeply realized my technical shortcomings and bad habits in development.
 
1. Basic knowledge, the concept is extremely weak, if you ask about various knowledge points, you will not know anything.
 
2. Caring only for realization, not for deep understanding. Many libraries and modules don't know what's going on at all, and they don't care if they can be used after tuning. I also know that this will leave a lot of hidden dangers. In the future work, we still need to read more official documents, read the source code carefully, and analyze the problem in detail. Don't bring in your own subjective perspective, think what he should be, and seriously understand what it is like.
 
3. I started work without a reasonable plan. I was stuck in a certain part of the training process for a long time without reviewing. This is the reason. I started writing without asking anything clearly. I set up a form anti-scraping mechanism, which is appropriate and counterproductive. , superfluous. Then the second version is equivalent to rework, and the code quality will be even worse if you are in a hurry to catch up with the progress. In fact, sharpening the knife is not the same as chopping firewood by mistake. First clarify the thinking, plan the layout, and then start development after confirming with the team and the leader. This will actually be more efficient.
 
To sum up, the summary of this training is: Seeking the truth and pursuing the details, making decisions and acting accordingly.
 
In the days to come, I will also keep this principle in my own study and work.
 
Finally, I would like to thank the company for providing this valuable opportunity.

Guess you like

Origin blog.csdn.net/sm9sun/article/details/106928761