Retrofit Source Code Reading

 |  6 minute read

Retrofit is a well known network util framework which allows the developer to declare the HTTP APIs via JAVA interfaces. This article takes a close look at Retrofit source code and explain how it works. Before we start the code study, let’s take a look at use cases provided by the library:

  • Declaration of HTTP api interface via Java interface class
    • support declaration of http request method
    • support declaration of url path and dynamic variables in path
    • support declaration of http bodies/query map/multi-form
    • support customisation of http headers
  • Support invocation of sync and async calls
Read more...

Android UnitTest Technique Summary

 |  6 minute read

The concept of unit and ui automation testing is referred from android jetpack unit testing. By comparing the list of popular Android testing frameworks from awesome-android-testing, the following testing frameworks are shortlisted and recommended to be adopted in the current Android workspace: Roboletric/Mockito/Truth. The following framework has been experimented with existing unit tests. A further breakdown of core capabilities provided each of the frameworks and the role they played in the whole picture.

Read more...

iOS V.S. Android (Language Characters)

 |  7 minute read

After a long journey in iOS native stack development, my recent incoming projects will be leaning back to Android side again (previously before I started working on iOS in recent years, I’ve been working on Android for around 3 years). After a roughly going through the contents in google’s official Android developer portal, it is a very instinctive thing for a developer with a similar background like me to come out the idea of making a comparison on the two platforms.

By having a systematically comparison of the two platform, one can understand clearly about the difference and similarities of the two and hence, become easier to memorize and handle the development techniques on both of them.

Since the knowledge map of Android and iOS developement contains a long list of topics, which might include for example: OS Characters, Language, Architecture Components, Engineering Tools & Automations, Challenges and Advantages, and etc. When I was writing this article, I was planning to have several post as a series to cover this. In this post, I would like to start with the comparison from the language aspect.

Read more...

How Gradle Plugin Works

 |  3 minute read

This article provides a summary on Android gradle plugin core use cases and talks about how the Android gradle plugin works via reading through the source code.

Screenshot 2022-07-01 at 12 02 07 PM

Read more...

UITouchEvent Propagation Revisited

 |  10 minute read

Touch event propagation and UI responder chain is one of the most frequently visited topics during iOS interviews. As there are some of the most critical concepts in this topic which can prove whether the candidate have a solid understanding regarding event and gesture detections. A summary is made in this article to discuss:

  1. how touch event propagates and gestures get recognized.
  2. how UIResponder is relevant to this process.

Read more...

Write your own Swift optionals

 |  5 minute read

This article provides a summary on the Swift optional mechanism, the source code of Swift optional can be retrieved here

@frozen
public enum Optional<Wrapped>: ExpressibleByNilLiteral {
  // The compiler has special knowledge of Optional<Wrapped>, including the fact
  // that it is an `enum` with cases named `none` and `some`.
  /// The absence of a value.

  case none
  case some(Wrapped)

After read through the codes, there are some critical knowledge which is essential to construct the implementation

Read more...

Backbone Design Patterns - Frontend

 |  5 minute read

Comparison for frontend backbone design patterns: Flux, Redux, Vuex. Since Redux is commonly know as a replacement for Flux(declared event in its official website) and the development of Vuex has taken a lot of reference from Redux, so in the overall usecases, they are very similar.

In this article, I went through all the integration documents of the three and made a short summary on each of the frameworks core concepts.

Read more...

Common TableView Protocol Design

 |  3 minute read

Summary for a common UITableView design pattern to support the following cases:

Use Cases Description
A Single section with single empty/loading/error layout
B Multiple section in table,
but the table have a unified empty/loading/error layout
C Multiple section in table, each has isolated loading lifecyle
and display its own empty/loading/error layout
Read more...