How to become an Android player

Source: Internet
Author: User
Tags php and mysql php framework

If you aspire to become a master of Android, if you have patience, "a bottle of a bowl enough."

"Is it difficult to do things in the world?" For this, it is easy for those who are difficult to do so, and those who are not are also difficult. Is it difficult for people to learn? It is easy to learn, but it is also difficult to learn. "Want to be an android player?" This is not a few lines of imagination.Code is so easy, but it's not achievable.

How to do?

1, learn to be lazy! Weird, huh? But you must have heard and felt that the world is driven by lazy people in a way that is lazy and lazy to create the world. Of course, laziness is also really silly to stay there doing nothing, but to be good at figuring out the better way to do things, so you can save a lot of time, there are more opportunities to lazy, colleagues also lazy out of the realm. How lazy is it in Android? "How to become a master of Android" article on how to be lazy in the Android Middle School and friends to share.

2, proficient in Android architecture, MVC, commondesign mode, inversion of Control (IoC): Is this difficult? It is easy to learn, but it is also difficult to learn. ”

3. Write code that is reusable, extensible, maintainable, and highly flexible: AndroidApplicationProgramThe development of using purely object-orientedJava as a development language, naturally also inherited the Java about the object-oriented thinking, how to do? How to become a master of Android is the article on how to write reusable, scalable, maintainable, flexible code in Android and share it with friends.

4. Write efficient code efficiently: writing code efficiently and writing efficient code seems like a natural enemy. It seems that the development speed up, the execution efficiency of the program went down, the execution efficiency of the program up, the development speed down. How is itTo solve the contradiction between the two, please listen to the "How to become a master of Android," the article wants us to explain.

5, learn at least one server-side development technology: no mistake, become a master of Android also need to learn service-side development technology? Yes, I need it! "How to become a master of Android" article on this issue and everyone to share.

"In Shu's humble, there are two monks: one is poor, the other is rich." The poor language in the rich said: "My desire of the South China Sea, how?" "The rich said:" How to rely on the son? "Yue:" I have a bottle of a bowl of enough. "The rich said:" I have a few years to buy a boat down, not yet. The son of what relies on! "The more next year, the poor people from the South China Sea, to tell the rich, rich people have ashamed color." West Shu to the South China Sea, do not know thousands of Li Also, the monk is rich can not, and the poor to, people's ambition, gu Shu humble monk "

If you aspire to become a master of Android, if you have patience, "a bottle of a bowl enough."

Android was born with a second-generation birthmark, not only because it was born in today's Cyber Overlord , but also with an unprecedented, powerful and spectacular open Mobile Alliance, OHA handset Alliance. What is OHA? OHA covers mobile operators such as China Mobile, T-mobile, and Sprint, including handset makers such as HTC, Motolora, and Samsung, as well as mobile software vendors represented by Google, and Inter, Nvidia is the logo of the underlying hardware vendors and commercial operations companies such as astonishing tribe, which claims that all members of the organization will develop new mobile business based on Android.

But it's not easy to be an android player. Not many people imagine the ability to quickly write a few lines of beautiful code to solve some difficult problem is the Android ace. The real Android master needs to consider the problem far from writing some beautiful code is enough.

One: Learn to be lazy

You're not mistaken, are you? Let the program developers learn to be lazy? The program developer is probably the busiest type of person in the world! Yes, that's right, learn to be lazy! Because the program developers are busy, because the program developers may be in the customer's unlimited changes in the day and night overtime, so learn to lazy, so that you can spend more time on the beautiful things!

How lazy:

1,don ' t reinvent the Wheel (do not invent the wheel repeatedly).

2,inventing the Wheel (invented the wheel).

1,don ' t reinvent the Wheel (do not invent the wheel repeatedly).

The "Wheel Theory", also known as "Don't reinvent the wheel", is a western proverb that says: Don ' t reinvent the Wheel. "Don't reinvent the wheel" means that any job in the enterprise has actually been done, and all we have to do is find someone who has done it. Get the software field refers to some projects or functions, others have done, we need to use the time, directly to use can, and do not re-manufacture.

Android claims to be the first truly open and complete mobile software for mobile devices. Soon after the release of Android, Google released the operating system core (Kernel) and part of the driver source code, so far in addition to Google Maps and other Google's core components do not have open source, Android has basically completed the full open-source, This has greatly facilitated the popularity and portability of Android. Influenced by Android's open-minded and open-source spirit, thousands of programmers around the world like to share their ingenuity and code with others. You can find a lot of good program code on Google's Android discussion group or Google search engine. This is not to encourage people to wait all day for you to write code, but you can "stand on the shoulders of great men", fully carry forward the "take doctrine", clever application of other people's program code can save you a lot of time.

2,inventing the Wheel (invented the wheel).

Invent wheels? Yes, invent the wheel! We not only have to invent the wheel, but also to become the world's leading power to invent the wheel, only in this way can we talk about the real power of the Chinese famous software cause. On Android, to invent the wheel, we have to take the initiative to solve some of the world's unresolved problems or to create new programming frameworks or to transform Android in depth to suit their business development needs. Soon after Google released Android, China Mobile put in a lot of manpower and resources, on the basis of Android to create integration into its own business and development, packaging new features and framework of the OMS, which is an important example of the invention of the wheel in Android. You might say that it's too hard to invent wheels, so don't worry, let's slow down and develop a specific area of the framework! You might look innocent and say, is it that easy to develop a framework? Of course not. But it is not impossible, first of all, we analyze the source of the charm of the framework, look at the Java EE framework such as Spring, struts, and so on. NET Framework, of course, can also look at the development of a full-on, endless PHP framework, their strength and charm of the source is: the IoC (inversion of Control).

Don ' t call us, we'll call you (don't ask me, I'll come to you).

Second: Proficient in Android architecture, MVC, common design patterns, inversion of control (IoC)

1, please look at one of the well-known IT companies one of the requirements of a recruitment information: "Familiar with Android system architecture and related technologies, more than 1 years of actual Android platform development experience;", it is very clear that requires a skilled Android system architecture, This explains to some extent the importance of understanding the Android architecture.


Linux Kernel: Responsible for the hardware driver, network, power, system security, memory management and other functions.

Libraries and Android Runtime:libraries: That is, the C + + function library section, most of which are open source libraries, such as WebKit, which is responsible for the operation of the Android Web browser, such as the standard C function library libc, OpenSSL, SQLite, and of course also includes support for game development 2D SGL and 3D OpenGL | ES, there is a mediaframework framework in multimedia to support the playback and display of various AV and graphics files, such as MPEG4, H. V, MP3, AAC, AMR, JPG, and PNG, among many other multimedia file formats. The runtime of Android is responsible for interpreting and executing bytecode in the generated Dalvik format.

Application Framework (Application software architecture), Java application developers are primarily using this layer of packaged APIs for rapid development.

Applications: This layer is the Java application layer, Android built-in Google Maps, e-mail, instant messaging tools, browsers, MP3 players, and so on the layer, Java developers developed programs are also in this layer, And the built-in application has an equal position, can call the built-in application, can also replace the built-in application.

The above four levels, the lower level for the upper layer of service, the upper layer needs the lower layer of support, call the lower level of service, this strict hierarchical approach brings great stability, flexibility and scalability, so that the different layers of developers can focus on specific layers of development.

The Android application uses the framework's API and runs under the framework, which leads to a high degree of consistency in program development, and on the other hand tells us that it is important to have a very deep understanding of the entire application framework in order to write high-quality and efficient programs. By mastering the application Framework, you can truly understand the design and operation of Android, and be able to harness the development of the entire application layer.

Three: Write code that is reusable, extensible, maintainable, and highly flexible

AndroidApplicationof the programDevelopment is the useJava authoring, using MVC on the architecture, encourages coupling between components. Developing code that is reusable, extensible, maintainable, and flexible requires that you follow these guidelines:

(1) "open-close" principle (OCP): ASoftware entities should be open to extensions and closed for modifications. This principle says that inWhen designing a module, you should make the module extensible without being modified. In other words, it should be possible without modificationChange the behavior of this module in the case of source code.

(2) Richter substitution principle (LSP): If a software entity is using a base class, it must be used in its subclasses, and it is not aware of the difference between a base class object and a subclass object at all.

(3) Dependency reversal principle (DIP): To rely on abstraction, do not rely on the specific.

(4) interface Isolation principle (ISP): Using multiple specialized interfaces is better than using a single total interface. The dependency of a class on another class should be based on the smallest interface.

Synthesis/Aggregation multiplexing principle (CARP): Also known as the synthetic multiplexing Principle (CRP), is to use some existing objects within a new object to make them part of the new object; new objects are reused by delegating to these objectsThe purpose of the function. In short: Try to use composition/aggregation as much as possible, and do not use inheritance.

(5) Dimitri Law (LoD): Also known as the least knowledge principle (LKP), which means that an object should know as little as possible about other objects. The narrow Dimitri rule is that if two classes do not have to communicate directly with each other, then these two classes should not have direct interaction. If one of the classes needs to invoke the method of another class, it can be forwarded by a third party. The generalized Dimitri rule is an important sign of how well a module is designed to be good or bad, and how much of its internalData is hidden from implementation-related details. The reason for the concealment of information is that it enables each sub-Systems are decoupled, allowing them to be independently developed, optimized, read and modified using.

Flexible use of design patterns allows for the development of reusable, scalable, maintainable, and flexible code in the face of ever-changing business needs.

Of course, since Android isRunning on mobile devices, and the processing power of mobile devices is limited, there is time to strike the right balance between writing reusable, extensible, maintainable, flexible code and efficient code.

Four: Efficient writing of efficient code


Quickly and efficiently write code and write code that executes efficiently is often the enemy of opposites, and many times you want to develop quickly, the efficiency of code execution tends to slow down; you want to write efficient code that slows down development.

Not duplicating the wheels and inventing new wheels is the right way to efficiently write efficient code.

For efficient code, the followingThe network of an article, direct reprint (do not know who is the friend wrote) as follows:

"Modern handheld devices, rather than telephones, are more like a computer in the hands. However, even the "fastest" handheld device can not perform as well as a normal desktop computer.

That's why we're writing AndroidThe application should pay extra attention to efficiency. These devices are not so fast and are subject to battery power. This means that the device has no more capability and we have to write the program as efficiently as possible.

This article discusses a lot of things that can makeDevelopers make their programs run in a more efficient way, and by following these methods, you can make your program work the most effective.
For resource-intensive systems, there are two basic principles:
1. Don't do unnecessary things
2. Do not allocate unnecessary memory

All of the following are in accordance with these two principles.

Some people may immediately jump out and attribute most of this section to "sloppy optimization," Admittedly, micro-optimization does bring many problems, such as the inability to use more efficient data structures and algorithms. But on handheld devices, you have no choice. If you think that the performance of an Android virtual machine is comparable to that of a desktop computer, your program is likely to take up all of the system's memory at first, which will slow your program down like a snail, let alone do other things.

The success of Android depends on the user experience provided by your program. The user experience, in part, depends on whether your program responds quickly and flexibly, or responds slowly and rigidly. Because all the programs are running on the same device, all together, it's like a car on a road. This document is equivalent to the traffic rules you have to learn before you get your driver 's license. If you follow these rules, driving will be smooth, but if you don't, you may passing to ruin your death. That is why these principles are so important.

Before we go straight to the topic, we must also remind you that the following principles are true regardless of whether the VM supports a just-in-time (JIT) compiler . If we have two methods with the exact same target and Foo () is faster than bar () when the interpretation is executed, then after compiling, Foo () will still be faster than bar (). So don't expect the compiler to save your program.

Five, learn at least one server-side development technology

A friend may ask: why do I need to learn to learn at least one server-side development technology for Android application development? The answer is this: Android, on the one hand, is the first truly open and complete mobile software for mobile devices. As a mobile terminal, it must be combined with the server side to play a huge role. In short, need: Cloud + cloud approach. Android is designed for the mobile internet era, the mobile internet era of service mode is "mobile terminal + Internet + application Software", mobile internet era one of the applications of Android is only for the development of mobile terminal software, and server technology for the development of Internet applications, So the future mobile internet era software mainstream application mode will be "mobile client + Internet Application Service End", this mode requires the development of mobile Internet programmers not only to master such as Android mobile phone terminal software technology also need to master the development of Internet application Server-side technology. At present, the software enterprises generally exist such problems, do the mobile Internet development of Android Terminal software programmers do not understand the Web application technology, and do Web applications programmers do not understand the mobile terminal technologies, which leads to the client and the service side of the convergence problem. The present situation is: both the mobile Internet Android Terminal technology, but also master the application of Web technology is scarce, as China stepped into the era of mobile Internet, enterprises on the mobile Internet era of comprehensive talent demand is very strong. If you don't understand Web application technology, you will end up with technical and development bottlenecks, and on the other hand, one of the real advantages of Google co-OHA is that it combines with the Internet, and one of Google's intentions is to open up new terminals to use Google's advantage services.

Server-side development technology is currently the mainstream of the Sun's Java EE, Microsoft's. NET, open source PHP and MySQL as the representative of the lamp system, which should we choose? In theory, many people tend to choose Java EE, after all, they are using Java as the development language, but many people face Java EE Many of the framework is daunting, in fact, when learning Java EE from struts, as the business needs to step in depth. Of course, choose Microsoft. NET is OK, after all, the technology system also occupies a large market share. In fact, the author believes that the choice of lamp can be the highest "price", on the one hand, PHP is now the mainstream language of the web, most new types of Web sites, especially the entrepreneurial nature of the site will generally choose PHP as a service-side development language, on the other hand, said before, Android is for mobile connectivity, both of which achieve a perfect fit.

Transferred from: http://chroya.iteye.com/blog/749838

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.