Engineer's laziness
Laziness is regarded as one of seven sins, a derogatory term, but in a certain scenario, laziness becomes a commendatory term: in my opinion, laziness is the key to human progress, and it is because of laziness that we create a variety of tools to improve efficiency. People do not bother to walk, invented the bicycle, later lazy pedal car, invented the car, recently even drive is not bothered to open, so there is a self-driving car. For engineers, there are two kinds of laziness, two types of laziness that can lead to a different path for engineers to grow up.
A favorable laziness
Lazy is to hate repetitive and inefficient tasks, do not bother to do, let the tools do, will repeat the task of automation. favorable laziness can greatly improve efficiency and save time. Here are a few examples:
CocoaPods
CocoaPods is a dependency management tool for a third-party library when developing OS X and IOS applications. Before CocoaPods appears, you need to add a third-party library with the following actions:
- Download the code for the third-party library.
- Introduce the code for the third-party library into the project and add the Framework required by the third-party library.
- Resolve dependencies between libraries and libraries, libraries, and projects, and detect repeated additions to the Framework.
- If a third-party library is updated, you need to remove the library from the project and repeat the steps above.
Oh buy karma, these repeated tedious work can annoy people to die, some "lazy" engineers can't stand this situation, so CocoaPods appeared, it can automatically download the configuration file specified in the third-party library, processing library and library dependencies, and by creating a new Xcworkspace To connect the third-party library with the project. Hallelujah, feel the whole world is pure.
ARC and Block
Why does ARC appear? Because in the MRC every time to retain/release is too much trouble, and it is easy to not be able to cause memory leaks, estimated that Apple engineers are tired, since the compiler can recognize the life cycle of the object, then let the compiler to do memory management, simple and convenient. Some people may not rest assured that memory management to the compiler, you can rest assured that in the recognition of the object life cycle, the compiler is better than you, the more powerful developers may be inadvertently omitted, but the compiler will not. In addition, some people think that arc will affect performance, this is actually do not understand the arc principle: arc is not garbage collection, just automatically help you write Retain/release, and write Retain/relese when the message is no longer passed, is directly called the corresponding C function, which will improve performance. In addition, for the factory method return value, ARC also optimizes, no longer puts the returned object into Autoreleasepool, but returns directly, equivalent to Alloc + init. So use the ARC bar with confidence, why not do something that improves efficiency?
Why does Block appear? In my opinion, it is very troublesome to use a callback function to combine variables into a struct every time it is used, and to pass a void * Pointer to the context parameter of the callback function. Since the compiler can identify which variables are used in the callback function, it automatically integrates with the callback function as an object, so that it can be used directly in the callback function.
Scripts in Advanced IOS development
Tang Qiao "IOS Development advanced" impresses me most is the actual combat skill in some scripts, such as delete unused image resources, check whether the image length is even, and so on, although it is simple operation, but can improve efficiency, feel great.
An automated deployment tool that I've written
In the Chinese Academy of Sciences Internship, was responsible for the development and maintenance of an embedded system, the code is run on a piece of ARM development Board, so after each cross-compilation by FTP to upload the package to the Development Board decompression, and configure the rcS
startup script. Development stage is just a piece of arm board, manual deployment is OK, and later turned into 15 ARM board, this I quit, manual deployment will be dead, and once the program has a Bug, it should be redeployed again. So "lazy" I wrote an automatic deployment tool, the idea is to poll the target ARM board IP address, for each IP, first through the FTP package upload, and then through the Telnet input decompression package and cover rcS
the startup script instructions, the entire process automation. Because it is too lazy to recompile the program every time the IP address changes, so the IP address, FTP account password and other information from the program, put into a configuration file, each startup read (also considered a dependency injection). At the same time also lazy every time telnet input command changes to recompile the program, the Telnet to enter the command is also written to a text file, dynamic read. After writing, the manual deployment estimated to be two hours of work, a line of command, feel life suddenly a lot better.
If we look closely, there are a lot of examples, in fact, to do this is not related to the ability, direction-independent, scale-independent, only with attitude , including individual and team attitude. For individuals, are repetitive tasks repeated in such a inefficient way, or are you thinking about automating to improve efficiency? For the team, does it give members time to accomplish some of the tools that improve efficiency? The more a strong team of engineers, the more tools, the higher the efficiency. In short, people are not good at doing repetitive boring work, and these work is precisely the machine is good at, think of ways to give the machine to do it, follow DRY:
Don ' t Repeat yourself!
Disadvantage of laziness
The following disadvantages of laziness will greatly hinder us to become a good engineer (in writing the following content, I also constantly reflect on themselves, found that in fact, many of their own places still made the mistake of laziness, writing while sweating, knee all kinds of arrows ... ):
Lazy Search
I remember there was a laruence on Weibo, a group of dialogue, the inside is said: "Not I say you, so simple problem, you do not Google, Baidu, to the group of Ask, is simply Shejinqiuyuan." In fact, the real reason is laziness. In this era, search is a powerful tool, think about, the world is so big, go to search, you will not be the first encounter problems, will not be the last encounter, I think, Google + StackOverflow + Github + Dash can basically solve 99% of the problem.
We often encounter the process of not searching for answers, so many people give up and return to the old way of asking everywhere. In fact, there are 2 reasons for not finding the answer: 1, we do not correctly describe and abstract problems, find the right keyword. 2, we do not use the search engine thinking. Do not give up when you are not in search, try to think about how to modify keywords and descriptions, try several times, although very painful, but the pain shows that our brains in the formation of a new mode of thinking, once formed, our search will become more accurate, more efficient.
Oh, yes, finally, to remind you, for technical issues, or to avoid the use of Baidu Bar, really do not find anything useful. Some people will say with Google also need to science Internet, much trouble, compared to search for the benefits of effective answers, FQ this work really is not what, we are engineers ah, reflect on is not because lazy so reluctant to use Google?
Too lazy to think
When we learn a knowledge, we should think positively and not memorize. When a frame/feature arises, there must be a reason for it, and think about why it appears. What kind of problems have been solved? Why do you do this? What are the benefits of doing this? What is the principle? How is it implemented? Keep a strong curiosity, this will make us constantly ask questions, in answer to the question will continue to think, and only the constant thinking to really understand a knowledge, so as to better use.
In addition, when we encounter problems, we often find that the solution is simply a copy, not the reason behind the analysis, do not analyze the impact of the solution. Bug is that torture goblin, this time do not thoroughly make clear the reason, next time it will come to annoy us, we will become the legendary fire captain, where the fire extinguished where, exhausted, but the more the fire is more.
Too lazy to read
Now is not the lack of knowledge, but knowledge explosion, if you want to learn, there are too many things to learn:
- Book: The classic Book of IOS, any book can be a benefit to people.
- Blog: There are too many excellent blogs, it is the essence of the thoughtful thought of others, spent a few hours to write out.
- Documents: Many times, stackoverflow answer the question by the way is affixed to a piece of official development documents on the text, or interface API description, in the case of the source code, the official documents can see the source of the interface description, it is worth reading. Use Dash or Xcode to bring your own documentation tools and see the dots when you're not clear.
- Source. Reading The fucking source code is not an empty word, there is no secret under the source code. Some effects do not know how to do, to a search on GitHub, to understand that they will not.
In short, stay Hungry,stay foolish!
Don't bother to try
Look at this article "leveling up", the paper came to the end of shallow, know this matter to preach, hands is the most effective way to learn:
- In the course of watching others, the Demo download, run a run, change the parameters, or try to write them again, the effect is definitely better than just looking. When you have questions or have ideas, you can write a Demo experiment.
- When looking at the Objective-c runtime principle, take
clang -rewrite-objc file.m
a look at the. m file into a. cpp file yourself. Use the associated Object to add attributes to the Category and write your own code to try.
- To see the system function call situation, you can use method Swizzle to some system methods to add some "decoration", or can also use symbolic breakpoints. Nothing dry Find a jailbreak mobile phone with Reveal look at other people's home App.
Lazy to improve optimization
The only constant is change. Code at first because the business is simple and generally good, but often in the increase in new demand/demand changes in the beginning of a bad taste, because the changes in demand often lead to changes in the environment, and different circumstances of the implementation is different, such as the site support 100 people access and support 100000 people access is two ways to achieve, Control supports only one line of display and support for multiple lines of display is also two implementations. PM sometimes not aware of changes in demand behind the impact of environmental changes on technology implementation, I think it is simple to change, what is difficult? Yes, it only takes three steps to put an elephant in the fridge, what's so hard about it? In order to cope with these changes, engineers sometimes need to adjust the structure to ensure that the structure is flexible, the next change to temporarily more leisurely, this adjustment is refactoring. Refactoring is not a scourge, refactoring can be very large, it can be very small, all in time, the earlier the modification of the point of time, the lower the cost, otherwise it will owe the technical debt. In the logic of the world, only the right and wrong, the owed will be still. Do not for a moment of convenience and neglect of sustainability, bear in mind that the technical debt is usury, arbitrage, drag the longer the time, the higher the cost, to the end will be even with the benefit of the debtor to compensate.
Therefore, engineers must set aside Buffer to deal with the structural changes caused by the reconstruction and legacy code brought about by the technical debt, not lazy, so that the future needs will be better. And the team in each iteration should also consider some of the technical debt and optimization as a requirement to join the demand pool, or the bad taste of code began to diffuse in the project, the need to do more slowly, the more bugs do more, in order to speed, began to work overtime hiring, efficiency is getting low, into a vicious circle.
Lazy Summary
In my opinion, experience is never the total time to compete, but the effect of competition. Why is it that some people experience less than one year of experience? The key is to summarize . Take the Holy Warrior Star, if the time alone, he can be a bronze Saint Warrior is very reluctant, why he can defeat the Golden Saint Warrior, because he said: the Saints will not lose to the same recruit two times! It's okay to make a mistake and fall into a hole, who didn't make mistakes? But it's not good to fall into the same pit two times, and effective experience will allow us to stop making the same or similar mistakes in the future.
How to overcome these problems
I looked closely at some of the best IOS engineers and found that:
- Every year there are WWDC, everyone can see, but meow God onevcat always write high-quality notes and summaries.
- The same is learning objective-c, male deity Sun Yuan can play out flowers, digging out a variety of characteristics and principles. (I once asked a question on male deity's blog, and male deity told me that he got it by disassembling the code, and I realized that I had made a mistake of being lazy.)
- Animated Monster Leaf Isolated City _ with animated little Prince Kitten-yang's animated dick Fried days, don't ask them why so dick, go to their GitHub to see their various attempts to animate the Demo will know.
- Tang Qiao "IOS Development advanced" Let me reap the most is not the knowledge inside, but he study and summarize the way, I constantly reflect on myself, I usually study, whether can like him summed up an own IOS learning notes.
There are a lot of good iOS engineers here do not give an example, I think, these excellent iOS engineers are not smarter than you and me, like us just ordinary people, but they are not lazy on these things, positive thinking, try, summarize, in the same conditions harvest a little more, accumulate, So they become excellent. Do not underestimate this point, we have to believe the strength of accumulation, stones Ah, Tinyfool said, this accumulation reached the level, it is difficult to be a short time to catch up, need others to accumulate, is very competitive.
In the face of these excellent iOS engineers, we often make another lazy mistake: we always want to add friends, climbing friendship, and even with a low-profile way, always feel that their thighs can grow rapidly, quickly become cattle. This is actually a kind of illusion, is not self-confidence is not independent performance. Even if you add a friend, they can answer questions, even hands-on teaching, personally help solve problems and how, that is other people's things, they do not grow any, they do not make a lazy mistake?
Learning and growth has never been a shortcut, also can only rely on their own!
In addition to appreciating and admiring these excellent people, I think it is more important to observe and work silently, to observe how they grow, to learn their good habits, to strive to improve themselves, to their standards, when one day reached their level, without deliberate training, with their own will know, Because good people always attract each other to appreciate each other, "SquarePants underwater", is not it?
In short, borrow some of the lessons from learning IOS to motivate yourself to be an excellent engineer who is lazy and not lazy:
I feel that the motivation to sustain our continuous exploration and progress is not an interest, but an insatiable curiosity and a quest for elegant code.
Technology-Independent laziness
Finally mention the engineers very common lazy: lazy exercise, do not pay attention to their body. In my opinion, we can love programming, love their work, love their own business, love their company, but these are not the most important, the most important thing is our own body and our family . Why is it? Because for the company, we can be replaced, no matter how we cow, how important, less us, the company can still operate. But for the body and the family, we are irreplaceable ! The body is not a program, can not be reset, once the body is broken, it is difficult to recover, and even continue to deteriorate, along with life. Once we have gone, our parents, spouses, and children have lost the only us, and the damage and loss for the family is immeasurable, even for a lifetime (see those who lost the lonely old people, heartbreaking AH). I believe that rational engineers will make their own decisions.
I am not here to say that we do not struggle to fight, which is completely independent of physical exercise, physical exercise can even allow us to better fight and struggle. We can not learn some of the mistakes of agile now, just emphasize fast, but ignore the sustainability (agile emphasis on the rapid iteration of sustainability), so do not spell a day of work hours, set aside time to exercise fitness, we have to add classes, long hours overtime added to the back actually brain is not sharp enough, very low efficiency, To program this kind of strong mental work is very unfavorable, prone to problems, it is better to go back to running, early rest, tomorrow more efficient completion of the good. Sometimes the atmosphere of the company or team is not to look at engineers as people, crazy overtime, fantasy to rely on 10 women pregnant one months will be able to give birth to the child, I feel really can not stand to change a house, no big deal, happy and healthy living is actually making money. (Hospital is the real Gold cave, money to that time is a number, the hospital is full of pain, helplessness, despair, numbness, but no happiness, who experienced who know)
In addition, in the eyes of engineers, since everything is logic, why not their own body as a program to debug and optimize it? The same has input and output, on high-calorie food defense programming, I have tried this, successful weight loss of 30 pounds, when I can wear a long time can not wear pants, believe me, that sense of accomplishment than write 100 programs or GitHub on a 10000+ Star warehouse are strong.
Copyright Disclaimer : I have "sole agency" for the publication of this article on the public platform to the IOS Development (iosdevtips) public number. Scan the QR code below to focus on "ios development":
Engineer's laziness