โ˜€ ๏ธ preface

  • I’ve been here since last yearApifoxSo far, the r&d team has been fastFour monthsTime, today to share with you my feelings ๐Ÿ’ญ.
  • โœ๐Ÿป is the chance for me to write this article after I successfully pass the three-month probation period. It can also be used as an explanation for myself to reflect and summarize what I have learned in these three months and some impressions.

โ˜ƒ๏ธ What have I learned

  • In thisThree months,I was more accepting of working or writing code or even being a programmerMethods should be masteredAnd these methodsIs not theWhat technology stack you are or what position is very useful ๐Ÿค“, so today I will share some of my summary30One way, I mainly share๐Ÿ’ป codeand๐Ÿง‘๐Ÿป๐Ÿ’ป programmers.

๐Ÿ’ป code

Learn to express

  • When you’re writing complex expressions that require judgments, make it a habit to change the expression to a variable that represents ๐Ÿ‘€ so that others can semantically understand your expression.
  • You can read your own code no matter how complicated it is, but for other people, if you assign your expressions to a variable, then all they need to know is what the variable means.

Learn to analyse

  • One of the differences between intermediate and advanced programmers is that the best programmers spend at least some time cleaning up ๐Ÿงน’s code.
  • They do this because they know that clean, good-looking code is easier to fix than messy code, even though they know they can hardly write clean code in the first place ๐Ÿคท๐Ÿป.
  • Although I don’t follow it strictly myself, I encourage you to review it often, because it’s a lot of fun when you look at the code you’ve written (and find it funny ๐Ÿคญ).

Embrace change

  • Never say I write features that “always meet our needs.” When doing project development, especially for public modules, learn to embrace change ๐Ÿ˜ฅ and always consider changing circumstances.
  • Get in the habit of building a public module with the possibility of implementing changes later or encapsulating them into onejsThe module โญ•๏ธ instead of using the third-party library โŒ directly.
  • Especially since we’re doing a client rather than a single page, and the public module here means “the user just needs to use the API that you provide to know how to use it, they don’t need to think about the implementation.”

Learn to fix a BUG

  • A lot of people are getting oneBUGOften only focus on the need“Eyes”That is, focusing on the problem without considering its original meaning.
  • What you need to do is not just to fix this defect but to think about ๐Ÿค” why he has this defect, be sure to pay attention to the context.
  • Raised after modifying an old moduleBUG“, we want to ensure that the original functional logic is not affected, think carefully againcommitOtherwise, there will be frequently encountered“ChangedBUGGenerate anotherBUG๐Ÿ˜ค”.

Multi-purpose structured data

  • When the logic of a component you are working on is complex, think about its structure, use structured data, and define a data structure to store intermediate state, rather than always using simple state โŒ.
  • All complex components It is acceptable to have complex states, but it is not acceptable to have multiple states.
  • Because if you use multiple states instead of structured states, you have a very complicated combinatorial relationship.
  • Decide on a data structure that you want, and all your operations will target that data structure, and that data structure can be an object, it can be an array of whatever values you want, and then at the end of the day all you need to do is take that structured data and do some simple processing, and all the problems will be solved.

Don’t be afraid of wrong

  • Many people, myself included, have a problem when entering a new company or working on a project that someone else is working on: “not being confident enough.”
  • When seeing other people’s code, it is inevitable to see other people’s obvious mistakes, and at the moment you seem to be not confident in their own coding and not willing to help correct, and afraid of being blamed by colleagues after changing, but this is wrong โŒ.
  • Don’t be afraid to fix the wrong code,If you see an error or a misnomer at the time and you think there’s a better name or refactoring that can fix itEven if it’s a mistake, that’s whenCodeReview“For everyone to make suggestions.
  • This way, the next time you see the code, don’t try to understand the logic again, because chances are you’ll be the one to change the module again.

One context at a time

  • If a module is constantly changing in unpredictable directions for different reasons, then the module becomes very disorganized.
  • When you need to add a new function on the original basis according to a condition, I may need to change three functions, two variables, so that it will be very agitated, now so inside the era of fidgeting up again how uncomfortable ๐Ÿ˜ฅ.
  • We need to get into the habit of each function doing one thing, of dividing a function into modules, into several contexts and every time we modify a function we just need to find the module to modify it and it becomes clear that we only need to focus on that one context.

Eliminate the annotation

  • Add as few comments as possible, especially for team development. Many people don’t understand why. ๐Ÿค” I take the simplest example: if this function function changes later, in addition to we need to change the inside of the code also need to help change the function name together with the previous comment also changed, if a function has 5-6 lines of comment so much, then do you have to change every one?
  • Of course without adding comments we want to make sure that our function names and variable names are as semantic as possible ๐Ÿ‘Œ๐Ÿป.
  • Anything you feel you need to annotate,99%Because this code doesn’t make sense.
  • Whenever you need to comment something, instead of explaining the code in words, we write what we need to comment into a separate function and give it a semantically named โœ… for its purpose.
  • You can even replace this with a few short lines of small functions, even if you call the function more steps later, but as long as each function name is semantic enough, the code can reasonably explain what you want to do.
  • The key to function length is not how long it is but readability, “how ๐Ÿคจ does it” and “what ๐Ÿฅด does it do”.

Not afraid of annotation

  • We can effectively reduce the number of comments in the code by using the above method, but should we ignore comments that others have left behind?
  • If there are comments in the modified function module, do not complain, it does not do you any good, on the contrary, it may be a good signal to inform us that we should modify the code, and through these comments can precisely help us locate the problem.

Learn to named

  • If you can’t name a function when you write it, the function is probably poorly designed. As we mentioned above, functions are “how to” and “what to do”, and we should name functions according to this principle.
  • When you actually name a function correctly, the structure is often readable.
  • Do not write the implementation of any business on the function name, later if others need to change the function logic, but also help you to change the function name.

Reasonable into arguments

  • There are also rules for naming functions that take parameters. We can usually use generic names for parameters rather than specific names at the moment, such as: apiSelectedKey=>selectedKey
  • Good modification can not only increase the scope of the function, but also change the conditions required to connect a module, thereby removing unnecessary coupling.

Learn to refine functions

  • One of our favorite ways to simplify a block of code is to refine functions, which allow us to separate intent from implementation.
  • And name the function after the intent, but if you find that you can’t name it properly, you shouldn’t refine the function ๐Ÿ˜ต๐Ÿ’ซ, you should think more.

Learn to return

  • There are two ways to name functions, and often in small functions we are “word poor” for internal variables.
  • Most of the functions can be usedresultAs a return value, defined at the beginning of the function and at the end of the functionreturnSo that the next person who looks at this code will immediately know what to return ๐Ÿง.

Considering the timing

  • Often when we first get a new requirement, it is easy to implement its features, even without research and modificationBUGSame thing.
  • This is easy enough for any programmer to do, but when should the “action” be considered, when to click? Dependent on change? When the function returns?
  • I have suffered this loss, when the inappropriate code exactly fulfilled the requirements but caused some uncontrollable defects, which caused me to read the entire module code repeatedly, which not only slowed down the project but also caused me to lose a few more strands of hair ๐Ÿง‘๐Ÿป๐Ÿฆฒ.

Keep it scalable

  • Never, ever think about doing it all when you get a new requirementokBecause there is no guarantee that you will not be able to add new features to this foundation even in your futurecommitAfter an hour, product requirements if you don’t have excellent product thinking is elusive ๐Ÿ˜ญ, so leave it to yourself“A way back.”.
  • And this * and the most common is nothing more than a variety of judgments, according to different judgments to let the program go to different code, at this time we can not write dead judgments but to use moremapStructure to maintain functional extensibility ๐Ÿ˜Ž.

Use opportunely module

  • If you find that the two modules need to communicate with each other, perhaps you can create a new module ๐Ÿ“ฆ to store it.
  • When creating a requirement, if many functions and variables are imported from different third-party libraries, it is better to classify it as a module, even if the function variable names are the same.
  • Just make sure you export in this module, so it’s easier for the people behind you to maintain the module and mask the implementation.
  • People who use do not care about using, only care about the result, just like the middle layer ๐Ÿ†—.

๐Ÿง‘๐Ÿป๐Ÿ’ป programmers

Using a method

  • There are many people want to enter this industry, he has to learn is the method, such as “refactoring”, “code clean way” these books are about the method, teach is the method ๐Ÿ’ก.
  • When it comes to a new project, how good an architect’s code is, it’s because of how good his method is, not how good his code is.
  • As long as your method is good, your new code will be good.

ZeShanErCong

  • When you feel like you’re doing a repetitive task, it must be the way you’re doing it, not the task.
  • Any one of your tasks has a place to learn, we are doing mental activities, there is no such situation as moving bricks, there must be a better plan, but you did not find ๐Ÿคจ.
  • You can do this by studying other people’sappLook at a lot of source code to see how others do the same effect,Learn from yourself to implement a new solution.
  • When you’re done, you’re the god of this functionalityWhen you interview with another company in the future, say that you worked at your previous companyxxxThe functionality of the program absorbs much of the industry’s similarityxxxThe advantages of a functional solution will make you look awesome, but if you just say what you’ve done beforexxxFunction of some things that others directly brush you off ๐Ÿ˜ž.

Learn to reference

  • As a programmer is to constantly see other people’s code ๐Ÿง, which code is written well, which is not written well, which is worth referring to, their heart to have a bottom, if you are not sure this is good, you will baidu, Google, see the source code.
  • APIUnless you’re an experienced person, you have to learn to refer to the design process, and the way any programmer gets started is to copy, to see how other people implement and see how other people write their code.
  • It is impossible for an entry-level programmer, an intermediate programmer, to design a very comfortable API for you ๐Ÿฅ‡, refer to the project of open source giants, refer to the design of others when doing so, not pure thinking.

Product thinking

  • Product thinking is good, understanding product needs, being able to communicate effectively with products is an advantage.
  • At this time you need to learn to jump out of the programmer’s dimension, with multidisciplinary ability ๐Ÿ’ฆ, to understand the purpose of the product to raise this demand, because in the absence of understanding, you according to their own product thinking to think that the different needs will lead to excessive or inferior ideas.
  • Do not take it for granted. When you think how to do it, you can bring the plan to the product to discuss.

Subtract appropriately

  • You want to fulfill a requirement100Scoring may be difficult, but for users this requirement is possible60That’s a good score,The rest of the40Points need to communicate with the product when to do it100Points ๐Ÿ’ฏ.
  • This is what you should do when, and at this stage it may be a struggle and a lot of time, but maybe2It’s easy for you to change this code months later.

Learn to do needs

  • After receiving a new demand, we need to make a plan and investigate ๐Ÿ‘๐Ÿป. There are many kinds of plans, all of which seem very feasible, but in fact, we still need to investigate ๐Ÿ’ฅ for suitability. Otherwise, we will have to change the plan after half of the work is done, or we will have to compromise on the product.
  • When you have a plan and you have an idea,Try it. Try it. And if you find out later that it doesn’t fit, you can start all over again and that’s fine,As long as you learn something in it, your time won’t be wasted. Even if you don’t feel safe, inCodeReviewBring it up and you’ll be pointed out.
  • Of course when we do a requirementYou can’t limit yourself to this requirementThat’s what I mentioned above: keep it scalable, keep it long term, maybe someone will use it againAPI.

Learn to ask questions

  • A habit, when you want to ask one question to know everyone is not the same as the ability to communicate, when you reach a level, can think you said a few words can make a question very clear, you can not write, if you feel like you don’t have that level, you should write your text and then sent to others, communication and coordination ability is also in the workplace needs to exercise โšก ๏ธ.
  • A lot of times you can’t just ask, you have to come up with a plan, and if you ask someone to give you a plan, they’ll always teach you how to code.
  • If you bring your own plan, others think the plan is good, or others have better will put forward, of course, others spend30sThis is the module you are in charge of. You are familiar with the logic. The solution you come up with will certainly be better.

Multi-purpose shortcut key

  • Take the time to look at the shortcut keysCodeReviewOr poking around in files during tech sessions, on a regular basisDevelop a desire for “speed”The habit of

Do one thing at a time

  • I’ve mentioned this a lot before. You can’t do everything perfectly. You know, it’s good to do one thing at a time.
  • If you want to change jobs now, review for the interview. If you want to learn a skill, stick to it. You could set yourself a time. Two months? Half a year? ๐Ÿ• does not matter, as long as you in this period of time to do the heart, time will give you the answer.

To the premise

  • When you need to use a third party library for public business and general pages, one difference between intermediate and advanced is that advanced should probably go through the document first, so that when you run into problems you can quickly locate them, rather than looking for problems and looking at the source code.
  • This will not take a lot of time, if when you look at the document when stuck, you can choose to try to see others summed up good analysis of the good article ๐Ÿ“–, maybe help you solve the problem, remember to read the article is always faster than read the source code.

Quick Problem Location

  • When you meet oneBUGWhen must think, can’t do, wisp clear cause and effect, thinking why will cause such a phenomenon.
  • The best way to solve the problem is: look at the following -> look at the issue-> look at the document -> look at the article -> look at the source.

โณ time imperceptibly we wake up later

Life may be only a few pages, constantly revising and copying poetry manuscript, from hair to white hair, someone is still under the lamp. – XiMuRong

  • Who says not? Time is like water, gone never to return. It is within our power to live every day well.
  • A few months is just a fraction of the time in the long history of programming, and it’s important to learn how to manage time.
  • I especially like what my boss said: “If I recruited you and you didn’t get promoted after you left, I would consider myself remiss.”
  • In these three months, I spent most of my time in getting familiar with the company’s business and code specifications. At the beginning, I knew that I was not familiar with the technology stack and products I had not tried, and then gradually proficient in using them. I felt that it was really not the least bit ๐Ÿ˜ for my own growth.
  • Friend here really is a product, she is my baby, attentive caress with formal code watering grow, when I was in college when MoTeDui captain with players have also been stressed: we can be together not because of me, not because of you, not because of him, but “we”, only we have reached the consensus, will more walk more long term ๐Ÿ˜ถ ๐ŸŒซ ๏ธ.
  • In addition to volunteering to study in the company at ordinary times, I would go home to tidy up one night a weekCodeReviewMentioned points, will also take two days to go home early reading and writing, after all, work and rest is the best.

  • I’ve never said how good my skills are, and I don’t think my skills are as good as many people’s, as you can tell from the screen. Time is endless, and we certainly can’t stand still.
  • A lot of people said the interview rocket work screw, but actually does rocket in the work, like us, do is very interesting, a group of people get carried away to a direction to do to grow, but the rocket ๐Ÿš€ ๐Ÿ”ฉ inevitably wring screw on the way, this time we need to know what kind of screw, what is the underlying framework, It matters what you do.
  • The methods I’ve summarized above are what I’ve learned in the last three months,Whether it’s in books or at work, there’s basically a short story for every methodI can totally break it down30Article to write, but still without reservation to write out, if you are interested in the story later I can also share out ๐Ÿ˜„.

Join us at ๐Ÿป

  • Finally help the company to send a recruitment, we are ๐Ÿ”ฅ๐Ÿ”ฅApifox๐Ÿ”ฅ ๐Ÿ”ฅ, it isAPIThe document,APIDebugging,API Mock,APIAutomated test integration cooperation platform, the know all know, don’t know slowly understand.
  • Recruitment of Web front-end, testing, product managers and we-media, Base React+TypeScript+Electron+Node, there will be technical sharing and CodeReview every week, you can install the latest MacBookPro port +4k Large screen ๐Ÿ–ฅ, company snacks ๐ŸŒญ๐Ÿฅ“๐Ÿฐ ๐Ÿฐ ordner maximum available, I can only tell you that the benefits are more than described in the recruitment.

๐Ÿ‘‹๐Ÿป comes at the end

  • First of all, thank you very much for reading ๐Ÿ˜„. This article will be shared here. If it is long, you can like it and collect it.
  • If you feel this article is helpful to your words as well ๐Ÿ‰๐Ÿ‰ attention + likes + favorites + comments + forwarding ๐Ÿ‰๐Ÿ‰ support yo ~~ ๐Ÿ‰ your support is the biggest power OF my update.
  • If you want to discuss with me and learn more about the front end you can join meFront-end communication learning group, we talk about the world ~~~