Author: Xiao Fu Ge Blog: https://bugstack.cn
Precipitate, share, grow, and let yourself and others gain something! 😄
1. Preface: 10,000 lines by hand!
💐完结撒花:4个月、20章、134个类、1.03万行代码!
In early March 2022, Brother Fu began to prepare relevant materials for "Handwritten Mybatis" , which is another larger systematic content output after "Handwritten Spring" .
From the beginning of preparation, I hoped that this "Handwritten Mybatis" would be 源码框架为根基
, 实现逻辑为指引
. You shouldn't just concatenate ORM logic with a few classes by reducing implementation difficulty. Because it is not close to the complex architecture design of Mybatis, it should not be called handwritten Mybatis, it can only be regarded as a simple handwritten ORM!
What I prefer is to learn how Mybatis handles the functional responsibility boundary when faced with complex logic design by handwriting Mybatis, 使了哪些设计原则
, 用了什么设计模式
, so that the whole framework is so It can handle all kinds of complex problem scenarios with ease.
You can even learn how to write clean code by handwriting Mybatis! And these are what I am willing to spend a lot of time on, gradually dismantling the core modules of Mybatis, and gradually complete the realization of the framework functions. ——Learning to write clean code is very important to domestic programmers! Because the cost of the project is not only the development stage, but also the future iteration and operation and maintenance costs.
My data is compiled in the hope that more R&D partners like me on this road will go 更扎实
, 更长久
, 更广阔
!
2. Talk about: Is it so difficult to face?
- Previously asked: How to use Mybatis
- Now ask: Mybatis does not need to write an implementation class for the DAO interface, how does it associate with SQL statement execution and return the result
- Previously asked: What are the common mistakes in the use of Mybatis
- Now ask: What design patterns are used in the Mybatis framework implementation
- Previously asked: How does Mybatis insert multiple pieces of data
- Now ask: Mybatis inserts data and the result of inserting ID is 0, why?
- Previously asked: What is the use of the Mybatis plugin
- Now ask: What is the design and implementation of the Mybatis plugin based on, and what is SPI
- Previously asked: Does Mybatis have a cache function?
- Now ask: What is the first level cache data of Mybatis flushed to the second level cache
And so on a series of interview questions, from simply asking about API usage, programming the understanding of the core functions! In fact, the nature of this work has changed very closely. In the past, your job was to call the API to implement program logic and you could have a job. Now these simple function development have been replaced by low-code, and most of the core work is to write those that can be reproduced. used technical components and highly available functional services.
So your interview has become more difficult , PS: Of course, some small companies have followed suit. Although they have not yet developed such a development model, they must follow the interview first!
But in fact, these interview questions can also be easily answered after learning the source code, and even asking in various ways can give the most core answers, because this is not a memorized answer, but a real understanding!
Third, the inner volume: more real skills are needed!
都说卷,但其实都在偷偷学!
You may not understand why you need to learn the source code of frameworks like Spring and Mybatis instead of learning it repeatedly with the business engineering code at hand.
Because the business code you have at hand is really too stretched ! Most of the if...else are made for heap functions. There is no clear framework structure, no clear design principles, and no unified development standards.
And many of these problems are in the early days, in order to seize the market, the project requirements under the strong pressure of the business side bosses can be uploaded as quickly as possible, and after the storm, more and more such engineering codes have been gradually was taken offline.
Larger companies also gradually pay attention to the design structure of the framework, the quality of code implementation, and the standards of project delivery. If you write code like some evil plaster in the past, it is likely that you will be sent away before you finish developing a project. .
So you look at DDD, onion architecture, clean architecture, and design patterns. They have been paid attention to in recent years, but they suffer from the fact that many previous factory codes did not have such good implementation standards, so many have to learn from source code. Only by mastering these slow projects can you make good projects in your own business.
Fourth, the source code: brothers learn together!
- Source code: https://gitcode.net/xiaofuge/small-mybatis
5. Summary: Persevere again!
In fact, I especially like the feeling of being patient, summarizing slowly, and outputting slowly, because as long as you are on the right path, don't jump repeatedly, and insist on completing a thing that takes 3 to 4 months, it must be better than just doing it. It is more valuable to study only for a few days.
And I have done a lot of things like this, including: facebook, Netty4.x, handwriting Spring, using Java to implement JVM, re-learning Java design patterns, SpringBoot middleware development, IDEA plug-in development, DDD system architecture project development, word Section code programming, handwritten Spring, Lottery distributed projects...
Clouds and mountains are green, rivers are full of rivers, the wind of Mr., the mountains are high and the water is long! come on!
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。