Some friends of Zhihu asked, what should I do if I can’t remember the front-end code?
My answer is: if you don’t remember it, you don’t.
I’ve worked for so many years, and I haven’t really memorized any codes.
This friend should be thinking, when to use, can’t remember how to do?
Let me share with you how this works in the real world (and my own workflow).
Front-end development workflow
Here’s a simple scenario:
Suddenly, on a project, Sam needed to achieve a spectacular radar effect.
Here are two more common restrictions:
- It needs to be implemented in the style of the UI design
- Limited time (e.g. only 2 hours)
So here are 5 ways: self masturbation, find packages, look up history, find wheels, search engines.
1. His lu
There’s no way you can masturbate this thing. Joe can’t remember that code.
In addition, Zhang SAN also felt that no code is worth memorizing, and do math problems, long live understanding!
So what do we do? See if it’s been sealed, collected, or written before.
2. Find your own package
I went through my own package library (I like to call it a weapons library) and realized that I really hadn’t.
Zhang SAN thought, also, at ordinary times the business code can not finish writing, which time and energy to write encapsulation ah!
Think about which projects you’ve used in the past.
3. History code
Historical project code, either on the computer or asleep in the code warehouse, is documented.
Turn over turn over, carefully recall, really not!
Well, we’ll have to go to the Internet, and find ready-made wheels first. Lazy Joe can’t write code without writing it.
4. Find a ready-made wheel
Search for keywords: “Radar”, “radar”, “radar map”…
Languages can filter JavaScript and HTML directly.
In fact, according to experience, this “radar chart” belongs to the “chart” category, I will first find mature chart library, see if it can meet the needs.
Considering the graphics library used, D3 requires a lot of extra code, while ECharts is relatively easy to use, so it’s easy to open the official EChart documentation.
It turned out that the style provided was so far from the UI design that I had to take the last step.
(At this point, talk to the UI designer or product manager and explain why. After all, time is limited, off-the-shelf wheels don’t work, mature libraries save time, effort and bugs.
5. Search engines
It’s just copy and paste and modify
Arrived here, have no what to say, Google, Baidu walk is.
You should search for lots of shared tutorials and praise the authors!
Finding the right one, the next step is to copy and paste and modify.
According to the UI design to modify, customize. Open lu.
6. Ending
In fact, the development of new functions, to the above step is over, but in order to not waste time next time, improve work efficiency.
Zhang SAN will summarize this experience, encapsulate the code of the radar map into components, or organize the collection, maybe next time can be directly used, or at worst can be used as a reference.
conclusion
Review, in the process of development, under normal circumstances really do not deliberately remember the code, for often used, more copy a few times, more than a few times will subconsciously remember (like one plus one equals two).
I think, if you want to continue to progress in the work, grow faster, have accumulation and precipitation.
Therefore, timely summary is the most efficient way to improve efficiency and upgrade yourself.
Not just front-end development, but other work as well.
By learning and summarizing in our daily work, we can build our own Arsenal, which can be upgraded over time.
To me, this “Arsenal” has snippets, packages, and tools. For example, the daily repetitive tasks become the re-use of this code — copy, paste, and modify.
The rest of your time and energy can be allocated to more valuable and important things. These “weapons” are not only convenient for you, but also important statements of your own value.
This is not the end. Human progress is a process of increasing efficiency and increasing productivity.
I will continue to share what I see, what I think, and what I think as I progress.
Look forward to working with you to progress together, welcome to pay attention to the public account @Shihua Zhengzi.