A Google interview question shows you how to break the game and become a good engineer.
Follow the Wechat official account: BaronTalk for more good posts!
I believe that every engineer once had a dream to become a technical expert, but the real road to become a technical expert is very few. In our work, we often find that some students have been working for only a few years but have grown rapidly. I will soon move to the core position of the team and become an excellent engineer. And some students work for a few years in the company is unknown, ability and position are not too much promotion, muddle through eventually become an ordinary code farmers. That’s why I often feel that too many people (myself included) have really spent five or ten years or more in the workforce with only one or two years of experience.
So what is the difference between an average engineer and a good engineer? How do good engineers grow up? Let me talk about my own observations and thoughts to see if I can find out what it is that leads to a good engineer; Then, we will work together to become an excellent engineer.
What’s the difference?
Let’s start our conversation with a Google interview question explained by Wu Jun in the column, and see how ordinary engineers and good engineers think and solve the same problem.
The question is as follows: How to design a map function to find the nearest gas station?
During a recent job interview at my company, I asked a similar question to some candidates, and most of them thought it was too easy. A common engineer’s solution is to figure out how far all the gas stations are from the current location, based on latitude and longitude, and then rank them by their distance and select the nearest ones.
The problem is that driving on the road, from point A to point B, is often not the distance as the crow flies. The distance from point A to point B is A combination of many distance segments. There may be thousands of combinations. So how to choose the closest route from these thousands of combinations? Dynamic programming algorithm can solve this problem well, and it only takes dozens of steps to calculate the shortest route among thousands of combinations. This is a threshold for some engineers.
The next step is to find the nearest gas stations in order of distance.
Most engineers, when faced with a problem like this, think about sequencing, which of course solves the problem, but it’s not the best solution. Even with the most efficient quicksort, it takes N times LogN. If there are 1,000 gas stations in the city, then LogN is about 10, which means the complexity of the calculation is about 1,000, which is not a lot for a computer, but it’s a lot when you consider that there are probably millions of cars on the road in a city.
Let’s say we only need the five nearest gas stations, and if we were to rank all the gas stations that would be a lot of useless work. There is a data structure called a binary tree. In a binary tree, there is a more detailed classification: “heap”. By heap sorting, we can only rank the top, not the bottom. The time complexity of sorting the first place by heap sorting is N, and the time complexity of sorting the second, third, fourth, and fifth places is LogN, which is much faster than sorting the 1000 gas stations. For our requirements: selecting the nearest 5 gas stations takes about 1000 computations, which is nearly 10 times faster than quicksort.
Do you think you’ve solved the problem perfectly at this point?
When we solve the problem, we can’t help but make an assumption that the optimization process of the whole algorithm is based on a certain use of a user. But in real life, many people in a city are looking for gas stations in different places at the same time. Similarly, the same person driving in different places at different times also needs to find a gas station. Considering this realistic scenario, many people are constantly looking for nearby gas stations, so many calculations can actually be done in advance, and it is good to directly call the results when the service is provided, so as to avoid double calculation.
For example, we can put all the intersections of Shanghai point-to-point distance calculation in advance, when a person to find a gas station, there would be no need for real-time calculation of the distance to calculate the dynamic planning, only need to compute from the current position to several crossroads near distance, to calculate some gas stations under it is located near the intersection of distance, Because each intersection point to the point of distance is calculated in advance, so do a few simple addition can, so the time to calculate the distance can be saved dozens of times. This is the benefit of globally optimizing the above problem.
In fact, in the face of such problems, a good engineer will not start to solve the problem directly, but will consider the problem more comprehensively. For example, the current driving direction will be taken into account. For example, in solving problems, the distance requirement is not very precise, because for drivers, there is no difference between 2.5km and 2.3km. In addition, considering the road congestion, the distance of 200 meters is even more negligible. But if a pedestrian is looking for a nearby convenience store, the distance of 200 meters has to be considered.
So from the above problem we can see the difference between ordinary engineers and excellent engineers?
1. Excellent engineers must have a solid basic knowledge of computer, have a good grasp of such tools as data structure and algorithm, and can use these tools to help solve problems in work;
2. Good engineers try to avoid doing useless work
3. Good engineers are not only satisfied with the completion of the task, they will constantly think and explore the best solution;
4. Good engineers are not limited by their thinking. They consider problems more comprehensively and know how to optimize solutions from a global perspective.
From this example, we can see that a good engineer can solve problems hundreds or thousands of times better than a normal engineer, and a good solution can even save a company millions in server costs.
Therefore, in the field of software engineering, a hundred heads are not worth one zhuge Liang!
How can we improve ourselves as ordinary engineers?
Learn data structure, algorithm, operating system principle, computer architecture and other basic skills, and lay a good foundation.
If you are a genius, you may be able to solve a problem like this one with intellectual advantage, even if you have no knowledge of computer theory, dynamic programming, binary trees, or heap sorting. Unfortunately, most people are not geniuses, so when it comes to solving problems, you need to use all kinds of tools to get twice the result with half the effort. For developers, data structures, algorithms, and all kinds of math are tools at our fingertips.
Being a good engineer requires us to sit down, sink down, and honestly understand the project you’re working on. Do simple things well so you can do more challenging work.
Many engineers complain that they are always in business, that there is no challenge, and that they do not feel growing. But is this really the case? Often our business needs like this interview question, seemingly simple in fact, to do well, behind the need to work hard. Even if the business is really simple, we can also think about whether there is a better way to achieve my code? Can I improve my efficiency in the face of similar business? If there is a Bug online, can I collect the online Log to quickly locate and solve the problem? Do you really understand the mechanics of the various frameworks used in your projects, and do you really go through the code to learn the implementation of these great frameworks? For Android development, open source frameworks like RxJava, Retrofit, OKHttp, ORM, hotfix, add-on frameworks, etc., if you really go through it, I believe you are far better than 90% of the engineers in the industry.
At the same time in the work to have the mentality of not afraid of losses, take the initiative to take on more responsibilities; Doing more often means taking on more challenges and getting more exercise.
Use fragmented time to systematize learning
Many people are against fragmented learning, but I don’t entirely agree. Fragmented time can be used either for fragmented learning or for systematic learning. Many people expect to be able to one day, there is a large amount of time, a good, systematic computer knowledge to fill up. So I bought classical books such as introduction to algorithms and in-depth understanding of computer systems and kept them at home, waiting for the day when I could have a large amount of time to bathe and dress and sit down to study. But the learning is soon interrupted by something else, and the next time it starts all over again. In the end, I often just read the first dozens of pages of a book for many times. In fact, this is the real fragmented learning.
The so-called systematic learning by using fragmented time means to make a perfect study plan and make good use of every fragmented time, such as commuting, waiting for the bus, taking the subway, waiting in line, even squatting on the toilet, to improve the study in a planned and systematic way.
Keep learning, keep reading, keep output
Technology changes too quickly, and computer science is far more complex than a few years in school can fully learn, which requires us to keep learning. However, many of us never go through any serious study after graduation, which is why we are left behind by those excellent engineers. And I think the best way to keep learning is to keep reading. You look! A good engineer should keep reading even if he is hanging in brine!! 🤣 🤣 🤣
In addition, the knowledge learned only output out, is really learned the stomach. Telling people about knowledge, writing, etc., are good ways to export knowledge.
Exercise your comprehensive ability
To be a good engineer, it takes more than good skills. Excellent completion of a job is often an examination of a person’s comprehensive ability. Good expression ability, excellent meeting organization ability, ability to promote things, personal maturity and so on, all need to be cultivated and exercised deliberately in our work. Take the expression ability as an example. If you feel inadequate in expression, you can exercise yourself by writing, taking the initiative to share technology in the team and so on. Sometimes, you don’t know how good you are until you push yourself.
Write in the last
As a technical novice, writing such an article is a bit ashamed. It’s a good way to set a tone for yourself and encourage others to make progress.
Oh, right! One more thing!! Good engineers don’t spend the night swiping their phones. 🤣 🤣 🤣
If you like my posts, follow me on BaronTalk, Zhihu or GitHub.
- Wechat official account: BaronTalk
- Zhihu column: zhuanlan.zhihu.com/baron
- GitHub:github.com/BaronZ88