The most beautiful application-from the perspective of Android Research and development engineers [kitchen story]

Source: Internet
Author: User
Tags sqlite database eventbus

The most beautiful application-from the perspective of Android research and development Engineers kitchen story

@author ASCE1885 's Github book Weibo CSDN

In this article we will analyze the technology stack of this German app for the kitchen story. Because of the difference between the domestic and foreign network environment, the technical environment, we will see it and the most beautiful time very different things. What we need to think about is how do you choose your own technology stack if you're developing a new app yourself?

Using the Open Source Library 1. Bottom Library Collection bolts-android

Bolts is a collection of underlying libraries for iOS and Android designed by Parse and Facebook, originally used for internal use by the company. It consists of two main features:

    • Tasks: Better organization and management of complex asynchronous code, similar to JavaScript's promise.
    • The app links protocol is implemented to help us link to the content provided by other apps while processing the received Deep-link.

Reference Documentation:
Parse released Bolts, a collection of underlying libraries for iOS and Android

2. Open source Logging function library Jakewharton ' s Timber

Timber is the star programmer Jakewharton Open Source, a library of logging functions, based on the Android log class, providing a simple and extensible API.

Logging behavior is abstracted as a tree??, for example, there is a log to Logcat tree, there is a log to the file tree and so on, if we want to use some kind of tree, we prefer to create an instance, and call the Timber.plant function to plant it, then you can use it at will.

3. View Injection function library Butterknife

Butterknife is also a well-known work of Jakewharton, which implements the binding of Android view properties and methods based on compile-time annotations, with the following main features:

    • Use @bind annotations instead of Findviewbyid on attributes
    • Support for multiple similar view to form a list or array, and one-time implementation of all the view in the array injection
    • Using @onclick to annotate functions, you can replace the use of anonymous inner classes
    • Use resource annotations on attributes to replace traditional resource lookups

Reference Documentation:
Official documents
Butterknife–view Injection Framework

4. JSON parsing function library Gson

Gson is a library of Google-produced libraries that can deserialize JSON strings into corresponding Java objects or, in turn, serialize Java objects into corresponding JSON strings. Eliminates the hassle of developers manually parsing JSON-based fields by Jsonobject and jsonarray, reducing the likelihood of errors and enhancing the quality of the code.

Reference Documentation:
Official User's Guide
Third-party user guides

5. Modern I/O operation function Library Okio

Okio, as a complement to java.io and Java.nio, is a library of functions developed by square, making it easier for developers to access, store, and manipulate data. It started out as a component of okhttp, and of course we can use it alone.

6. Modern HTTP function library Okhttp

Okhttp is an efficient HTTP client with the following features:

    • Supports HTTP/2 and spdy, sharing the same socket for all requests to the same host
    • Use connection pooling to reduce request latency when Spdy is unavailable
    • Transparent gzip compression reduces the size of downloaded data
    • Cache responses to avoid duplicate network requests

Okhttp works well with poor network performance and avoids common network connectivity problems. If your HTTP service is made up of multiple IP addresses, Okhttp will try other optional addresses when the first connection fails. This is necessary for Ipv4+ipv6 and for services hosted in a redundant data center. Okhttp uses the modern TLS feature (SNI, ALPN) to initialize the HTTP connection, but when the handshake fails, it is degraded using the TSL1.0 attempt to initialize the connection.

See the documentation for more detailed usage.

7. Picture asynchronous load cache function library Android-universal-image-loader

This library, called UIL, is a powerful, flexible and highly customizable open-source library for loading, caching, and displaying images, providing a range of configuration options and good control over the loading and caching of images.

The main features are:

    • Synchronous or asynchronous multi-threaded picture loading
    • Highly customizable: thread pool, downloader, decoder, memory and disk cache, picture display options, and more
    • The display of each picture supports a variety of customization options: Default stub picture, cache toggle, decode option, bitmap processing and display, etc.
    • Memory or disk (file system of device or SD card) can be slow in picture
    • Real-time monitoring of the picture loading process, including download progress.

Reference Documentation:
Android-universal-image-loader the use of the asynchronous Load Class library (Hyper-verbose configuration)
Android Open Source Framework Universal-image-loader full Parse
Android Universal Image Loader Source Analysis

8. Memory Leak detection function library Leakcanary

Leakcanary is another masterpiece of square, which can be used to monitor memory leaks in the debug version of Activity,fragment, and after using this library, square fixes a lot of memory leaks and even discovers leaks in the Android SDK. Claims to solve the problem of 94% of oom leaks in their own products.

Reference Documentation:
Leakcanary: Detects all memory leaks
Use Leakcanary to check for Android memory leaks

9. A database created for mobile devices realm

Realm is a modern mobile platform database for the replacement of SQLite and core Data, and its main features are:

    • Mobile First: A database built for mobile phones, tablets and wearable devices
    • Simple to use: Realm is not an ORM framework based on SQLite, instead it implements its own persistence engine, focusing on simplicity and speed.
    • Cross-platform: Realm supports iOS & OS X (Objective-c & Swift) & Android Three platforms, you can share realm files across platforms, use the same model classes in Java,swift and Objective-c, Implement similar business logic on all platforms.
    • Fast: Thanks to the 0 copy design, realm is much faster than the ORM framework and is usually faster than the native SQLite database.
    • Good support: The authorities provide good technical support on both Github,stackoverflow and Twitter.

Realm relative to SQLite is a newer function library, but also in the rapid evolution, like to try new technology students can try, of course, opportunities and challenges coexist, you may encounter some hidden bugs need to spend effort to repair, but a person want to pursue technology progress is the need to constantly challenge themselves.

Now try Realm's well-known products as shown in:

Reference Documentation:
Basic Realm Database Tutorial

10. Dependency Injection Function Library Dagger

Dagger is an open source of square Company's fast dependency Injection function library for Android and Java, created by Guice's inspiration. It implements the binding at compile time and uses the reflection mechanism to implement the diagram's composition.

Dagger is a relatively mature and stable function library, Google maintained a new branch, used to call Dagger2, it on the basis of dagger evolution, the elimination of the use of reflection, to provide better performance, so, at present, If you want to use dagger as a dependency injection function library, we recommend using Dagger2.

Reference Documentation:
Dagger: A dependency Injection framework for Android platforms
Dagger Source Code Analysis
Detailed Dagger2

Eventbus.

The Eventbus developed by Greenrobot is a post-subscription event bus system optimized for the Android platform. It simplifies communication between the four components of Android and makes the system more decoupled. The advantage of Eventbus is the simplicity of the code, the simplicity of its use, and the full decoupling of event publishing from subscriptions. Another well-known event bus function library Square is Otto.

Reference Documentation:
Eventbus Source Code Analysis
Eventbus use of the detailed
Write Eventbus with me.

Design Support Library

Google I/O 2015 provides an entirely new library of development functions for Android developers, making it easier for developers to create mobile applications that conform to material design.

Android Material Design Compatibility library

Third-party SDK1 used. Cloud Services Parse SDK

The parse is a foreign cloud service platform that was acquired by Facebook more than a year ago and is currently located in California, USA. The kitchen story app uses this cloud service, so the SDK for the corresponding platform is introduced.

2. Crash Statistics SDK Crashlytics

Founded in 2011, Crashlytic is a tool designed to store and analyze crash information for mobile app providers. In January 2013, Crashlytics was acquired by Twitter as another successful start-up product. Crashlytics is a powerful and lightweight crash statistics SDK that supports Java layer and NDK layer crash statistics and analysis.

Reference Documentation:
Use Crashlytics under Android
iOS development tools--tools for statistical crash Crashlytics

3. Facebook SDK

Facebook for some well-known reasons, at home is almost impossible, but this does not prevent us to introduce, if you are interested you can also download the SDK under the source code, or there is worth learning place. Can not turn over the wall to my network disk download.

Reference Documentation:
Use the latest Facebook SDK 3.0 under Android

4. Google Push service GMs

Still, for some well-known reasons, domestic apps rarely use GMS, but as an Android developer you should know it exists.

5. Amplitude SDK

Real-time user statistics and analysis tools, similar to the domestic League of Friends, know the user's behavior of using the app, can help the product manager to better constantly improve the product.

Analysis and summary

Compared with the most beautiful time, the kitchen story, although some of the choice of open source libraries overlap (all use gson,okhttp,okio,uil,timber, etc.), but the main body can be seen very different, kitchen stories using the open Source Library more "avant-garde" some. Whether the use of the new database realm, Google has just introduced the use of the design support library soon, or the introduction of Leakcanary, using Recyclerview instead of the ListView, Or to make full use of dependency injections such as Butterknife,dagger to simplify code, you can see that kitchen stories are better, and have the courage to use new technologies to serve themselves.

On the other hand, from the use of the third-party SDK can be seen in domestic apps and foreign apps significant differences. Of course, each app's technology stack will vary, depending on the team's Echelon building and member quality, each open Source Library selection will be compromised, there is no library is required, there will always be alternatives, sometimes the choice may be just an idea away. But we should always improve, constantly discover or create new function library, and apply to the actual product development, make our work and life more and more beautiful, this is the trend.

Appreciation of photography at the end of Wen

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

The most beautiful application-from the perspective of Android Research and development engineers [kitchen story]

Related Article

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.