【IT Observation】Nine Discussions on How to Improve Programming Efficiency for Android Programmers

【IT Observation】Nine Discussions on How to Improve Programming Efficiency for Android Programmers

[51CTO.com original article] As an Android programmer who loves literature, I firmly believe that the most regrettable strategy in history is Xin Qiji's "Nine Proposals". Even Xin Qiji's enemies sighed after the fall of the Southern Song Dynasty: "If the Song Dynasty really used it, how could I have come to this point?" Although I don't have the opportunity to travel back with a bunch of tree-planting books to rewrite the history of "I exchanged the ten thousand words of pacification strategy for the easterly tree-planting books", I can plan nine solutions to improve programming efficiency for Android programmers, so that everyone can take fewer detours on the road to improving programming efficiency.

[Figure: Android Studio interface]

one, Excellent development tools

As the saying goes, "If an engineer wants to do his job well, he must first improve his compiler." If you want to improve your code writing efficiency, you must first improve your code writing tools. The so-called tools include but are not limited to mechanical keyboards that you can touch, ergonomic chairs, programmer encouragers (it seems like something strange has been mixed in), and more importantly, software such as IDE, AVD and VCS.

Unless you are working in a particularly bad team, the IDE for Android development must be Android Studio. The difference in programming efficiency among programmers who use the same Android Studio is reflected in "File->Setting". Setting a larger font size and softer colors for Android Studio can give your eyes a comfortable development environment. Android Studio also has a wealth of plug-ins. For example, the proper use of these plug-ins can make your programming work more efficient.

Even if you are a small team with only one person in a position, VCS is indispensable. VCS is not only about code backup and sharing, but also version branch management. Currently, the most common VCS is Git. If you are a nostalgic programmer, you can also choose SVN.

two, Preparation before writing code

Before writing code, eliminating unstable factors that hinder programming efficiency as much as possible is also one of the factors to improve programming efficiency.

The most important preparation before starting programming is to communicate with the product manager, clarify the requirements, and eliminate unreliable requirements. If you encounter a situation where you must start development immediately when the requirements are unreliable, such as the operation of pulling the item to the left of RecyclerView both flipping to the next tab and opening the "Delete" and "Favorites" drawers on the right (consistent with iOS), etc., you should delay unreliable requirements as much as possible, because you may not need to do it at the end.

The second step before starting programming is to prepare for preliminary investigations and solutions to some technical problems, such as how to bypass permission verification when automatically filling in SMS verification codes, how to use ThreadPool to resume uploading large files in batches, etc. Don't wait until you start programming to think about these issues.

The last preparation before starting programming is to write pseudocode. Don’t think it’s troublesome to write two almost identical codes. Not discovering your own shortcomings in advance will reduce your programming efficiency.

three, Design Patterns and Architecture

Design patterns are a set of repeatedly used, well-known, cataloged, and summarized code design experiences, emphasizing solutions to single problems. Although using design patterns can improve development efficiency, many design patterns sacrifice runtime performance for development efficiency, so you must remember not to abuse design patterns.

Architecture is a high-level design idea for the system structure. The reasonable combination of multiple design patterns becomes architecture. Currently, the most popular architecture on Android is MVP. Of course, small and beautiful apps can choose the simpler MVC architecture, while full-featured encyclopedic apps should choose the more clear MVVM architecture.

4. Clear annotations

Good comments don't have to be long, but they must be concise. Clear, concise comments can greatly improve your programming efficiency tomorrow (or next month, anyway, it's the future time); but bad comments can make you feel a sense of malice across time and space when you maintain your own bad code. Comments are not omnipotent. For example, a comment like "all left below represents right, all right represents left" is definitely not as beneficial to programming efficiency as redefining left and right.

5. Open Source Code and Third-Party Services

The number of open source frameworks and tool classes for Android on GitHub is second only to JavaScript. The vast amount of open source code can not only improve programmers' programming efficiency, but learning the principles and changes of open source code is also a process of improving one's own abilities.

Many common functions, such as push, SMS verification code, third-party login, social sharing, LBS, IM, Crash analysis, mobile advertising, etc., are all places where third-party services are used. If the company is not big enough, no one will build an IM server by themselves! There are good and bad third-party SDKs. Some third-party SDKs can make you encounter inexplicable bugs every few days, but more third-party SDKs can help you improve development efficiency.

6. Large-scale refactoring of old code

Refactoring means improving the design of an already written software. The most common reason is that with the update of the dependent library version, the old code becomes outdated. For example, WebSocket operations in OkHttp 3.5 and later versions do not require plug-ins to implement. When we rely on OkHttp 3.7, we have to rewrite the WebSocket-related code of OkHttp 3.4.1.

Another reason for large-scale refactoring is the level of the previous programmers. Many programmers who "programmed for Baidu" left and handed over a mess to the current programmers. I have seen the same App rely on Glide and Fresco at the same time, because the predecessor only used Fresco to implement the blur effect of the picture and only used Glide to implement the multi-touch of the picture. Refactoring these codes can not only solve the problem of bloated App, but also improve our programming efficiency in the next work.

seven, Training new people

Sharing open source code in the IT community is to help unfamiliar colleagues; training new people in the team is to help colleagues who have less years of work experience than you. Sharing uncommon exception solutions with colleagues will make your memory more profound; on the contrary, if you are afraid that your colleagues' technical level will surpass yours and you are unwilling to train new people, then please remember this allusion: foreign Greek fire and Chinese black powder have been "reinvented" many times in different historical periods, and they were afraid that others would know, so they kept it secret that even they forgot it.

Another benefit of training new people is to let them do simple, repetitive but error-prone work. This will help them remember the difference between layout_gravity and gravity, and give you time to study how to implement dex differential replacement and gc principles. It is a win-win situation.

8. Maintain good health

The body is the capital of revolution, and a good body is the foundation of a good working and learning state. Programmers are mental workers with well-developed brains and simple limbs. Their bodies are often in a sub-healthy state, which has a serious negative impact on programming efficiency. In order to ensure good health while sitting in the office, we can drink more water, which can not only improve blood circulation, but also increase the number of times we get up to go to the bathroom; placing a pot of succulents in front of the screen can not only absorb the radiation that makes the skin dull and greasy, but also relieve visual fatigue.

9. Worry-free Bear Programming Method

The so-called Worry-Free Bear Programming Method is to put a cute Worry-Free Bear on your desk or computer case. When you encounter a bug or bottleneck, you can talk to it about the effect of each line of your code or the problem of each line of logcat. It is very likely that it will use its magical skills to make you suddenly realize the truth. This is not feudal superstition. If you were a top student in school, you must have had such an experience: the girl you secretly love asked you a question, and you explained it to her with dancing hands: she didn’t understand it the first time, she didn’t understand it the second time, but you understood it the third time.

[51CTO original article, please indicate the original author and source as 51CTO.com when reprinting on partner sites]

<<:  Summary of common commands for Android ADB development

>>:  The 9th Aiti Tribe Technical Clinic

Recommend

Promotion strategy of Sina Weibo Fanstong

Someone told me that Sina Weibo’s scale is not up...

Kuaishou beauty industry advertising research report!

Paying for beauty has become a daily routine for ...

How can a new Douyin account reach a huge number of users?

01How to identify ineffective plans Let’s first t...

Tik Tok monetization methods and its development trends!

For commercial products, monetization is an unavo...

A 90% drop in 5 years! Why has Samsung become a pariah in China?

If three months ago, the domestic media were stil...

7 Common Mistakes in App Store Keyword Selection

In the process of mobile game or mobile applicati...

Cook's attack is Apple's retreat

[[136306]] WWDC 2015 is Apple's annual colleg...

LeTV's 5 billion financing crisis looms, LeTV Sports slims down to save itself

After experiencing a funding crisis, the share pr...

Carp: The oldest farmed fish in the world

When people mention carp, they will think of the ...

AppTalk: How to build an efficient entrepreneurial team and high-quality apps?

Beijing is a city full of entrepreneurial atmosph...

TikTok advertising click-through rate and high-click copywriting skills!

Recently, many advertisers have paid close attent...