The original address: https://juejin.im/post/6844903793918738446

People ask me how do I do architecture well? How to use design patterns flexibly? My answer is that you can’t do it well simply because you haven’t developed a good programming habit

Why do I write so many open source frameworks and maintain them for so long?

In addition to the fact that I want more people to benefit from open source, I also want to maintain my good programming habits

Writing business code can also keep good programming habits

Yes, but too slow!

Details you can’t notice when writing a business

When writing business code, even if the project has plenty of time, you can overlook many of the details that are critical to your progress, but you don’t even know it, and it has a huge impact on your progress

So you’re making very slow progress, you’re just getting good at it after years of doing it, you can’t get any further

The most intuitive difference between business code and framework code is that business code can be modified at will, while framework code cannot be modified directly by the consumer

Unlimited business code changes, so there is a demand change, you can direct problem by changing the code to solve the problem quickly, even if the code changes very frequently, but your first reaction is not through the code design way to solve the problem of subsequent extension, because of the way it seems once and for all, will waste the moment a lot of time on you

The human subconscious is more focused on the costs of the present than the benefits of the future

Because the way you code above, you develop bad programming habits, and you instinctively do not care about the coupling, flexibility, and extensibility of code

So even if you’re typing code every day, your progress is slow, because you don’t have the architecture and code design, and over time, you’re just moving bricks a little faster

The changes that come with writing open source frameworks

If you have a good leader who can review your code every day and remind you of these problems, as long as you slowly change and develop a habit, then your path to advancement will be very smooth

But such a good leader is impossible to meet, then if we do not have a good leader, how to develop a good habit?

My advice is to do open source libraries, and try to do open source frameworks, such as architecture framework, UI framework, network framework, picture framework, as little as possible to do open source APPS (of course, if you want to learn some technology is ok)

Because open source App is mainly to help you and others to learn some technology, but also a large number of business code exists, nothing more than using some new technology, and you write a person, some details you will not consider…

Open source frameworks are for someone else to call, so the higher the code quality, the more detail you need to think about, and the better you can do

And because your framework code is on the server, users can’t modify your code, which forces you to pay more attention to coupling, flexibility, extensibility, and even comments and documentation that you don’t care about when you write your business

Because users will issue you with the slightest annoyance, constantly urge you to optimize your code, comments, documentation, and constantly help you develop good programming habits

If you have hundreds of good leaders reviewing your code every day, pointing out your problems and giving you better advice, how can you not grow over time?

Good programming habits will help you make rapid progress

Many of my programming habits, after constant error correction, optimization, error correction, optimization, has been deeply engraved into my mind

I frame used in most of the design patterns, is not I intentionally to use, some problems are, or what the user needs to increase functionality, I in order not to affect the previous version, under the premise of guarantee scalability, to solve these problems, and have to use the design patterns, in many cases, code has finished, just know, Originally I used xx design mode

In this continuous optimization code, good programming habit, while I wrote the code to use design pattern has become a subconscious behavior, don’t tell why want to use the design patterns, just because think it is the optimal solution, it is just like a boxer, encounter attack subconscious dodge, retaliation, as this is the result of actual combat training, and constantly

All of my open source frameworks are averaging around 50,000 downloads per month, and I have thousands of users (overseers) coming at me every day, forcing me to constantly optimize my code, and even to polish every comment

It’s hard for a framework to work for everyone, but as long as you keep optimizing to make most people happy, it’s a huge improvement and a huge leap in your programming habits

For example, when I developed the habit of writing comments, I wrote a lot of comments for each of my open source frameworks, describing them in such detail that most people understood the principles, but I still got a lot of people coming up to me and asking me questions that were already written in the documentation and comments

I’m spitting blood, man. I don’t want to answer that. You killed me.

A good habit, adhere to one day, toward the goal further

A bad habit that lasts a day is a day wasted

I do open source for three years to get rid of a lot of my bad programming habits, let me progress quickly, so I thank open source

I also encourage more people to actively participate in open source, so that others can benefit from it, and others can help you improve

Of course, open source is not only good code writing, he can harvest a large number of Star, he also needs comprehensive capabilities, such as framework positioning, product demand analysis, operation, promotion and many other things, the most important is the continuous maintenance

My new framework, AndroidAutoSize, which was innovatively launched last year, has been 3k STAR in one month, and now has more than 20,000 downloads per month, which is more than all my previous open source frameworks. This is because I have accumulated open source experience before, and I will also share about the operation of Github in the back

The public,

Scan the code and follow my official account JessYan to learn and make progress together. If there is any update of the framework, I will inform you on the official account as soon as possible


Hello, my name is JessYan. If you like my articles, you can follow me on the following platforms

  • Personal homepage: Jessyan.me
  • Making: github.com/JessYanCodi…
  • The Denver nuggets: juejin. Im/user / 976022…
  • Jane: www.jianshu.com/u/1d0c0bc63…
  • Weibo: weibo.com/u/178626251…

— The end