The importance of Android Basic code--------Fox Productions

Source: Internet
Author: User

The first time I wrote a blog, it was really weird. I am doing video plus live development for more than a year. Want to write some experiences. Now get to the point.

The most important quality for programmers is code quality. More than a year of work actually sentiment is very big, perhaps many people did not experience the code quality exactly is what. So I'll mention it here first as the first blog post.

The quality of the code is not only reflected in the code less, to achieve the same function. The quality of the code includes 1: Format 2: NOTE 3: Code logic 4: The amount of precipitation in the language

So let's start with the code format: In fact, I put the code in the first place for a reason, personally think the format of the code is the most important part of the code. Format: There are thousands, but the uniform standard of code is best to look at the API provided by the official.

Why do you say that? 1. Many of our functions are actually from the API, then someone will say that Baidu know, why go to see the API it ~ ~ If that is your short-sighted. On the one hand, Baidu appears to be used by others

If you come across any of the features that are not Baidu? Well, it's a good thing to name the API as you look at the official API as if you were looking at your own code, so what do you need to understand? On the other hand you write the code like official

API code. Then people will see your code many times faster. The format is actually called naming, and the application of the hump.

Note Why the second place, more than a year of code format and so on development. Development for a long time naturally will not remember so clearly what this piece of code is doing? Then the comments at this time will show the benefits. Easy to review and so on. Yes convenient for others to use.

Many large companies are developed by many people, not by a single developer. Then the benefits come out. Someone else uses your code and you don't have to ask, and you think about it. There is no duplicate function code. Another aspect is that it is possible to use it when dealing with bugs.

The logic of the code--this is a big problem. Why do you say that? Because it is very simple, I may write a code of 10 lines to achieve this function, write 50 lines to achieve this function. It is possible to write 30 lines to implement this function. Maybe for some companies.

requirements, as long as it is able to achieve the function of the tube you do ... But we can't do that with the programs we write. We have to make some demands on ourselves. Code is not fast or slow ~ but to be stable. 10 lines of code may appear code structure instability and so on. For example, you might just consider

to 1 + 1 = 2, without taking into account the point of 1 + 2 = 3. Then the 50 lines of code may appear extra code, such as code that can be avoided. For example, in itself is a Boolean type of variable, in the If judgment when the addition of a judgment is constant equal to false, etc.

This is not advisable. Why is it? For the program, a couple of them is nothing. But once piled up, the problem that arises is that it affects the performance of the program. What about the 30 lines of code? It's also hard to say that maybe it's just a good code, but it might be a feature

Many changes, we may have to consider reserving space at this time, rather than writing the code structure to death.

What about the language precipitation? Perhaps you feel very basic. But what I'm going to say is. This foundation is hard to master. For example, you might want to have a new object for a split, but if you're more clear about the language. You might think hashmap these things instead of two.

The new object. On the one hand to reduce their own code, on the one hand convenient to consult the code.

Wrote some code based on these to show you ha ~ ~ The follow-up will be continued on a continuous basis and go ~ convenient for the big guys to watch. Of course, you will also write some new controls on an irregular basis for everyone to use. Then welcome the question ha ~ ~ I like to solve the problem. Have a question to ask can add

I qq:807312554 then welcome to disturb

The importance of Android Basic code--------Fox Productions

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.