kotlin-coroutines-1.png?w=2924

I recently read the source code of Coroutines. It’s pretty fun, and I’ve learned a lot from the source code. I am going to share some I learned here. I would break the learning into several parts. I hope everyone can find something useful for your projects.

Read more »

Process v.s Thread

Android OS is a kind of Linus system. Every time you launch an application on your device, it invokes a process to host this application and provides the necessary resources for the application. By default, all components that come from the same application would run in the same process and thread (called main thread or UI thread). By default, you would run all components, Activity, Service, Receiver, Provider, on the same process. But there’s a way for a specific need for developers who want to run these components on different processes. You can add android: process in the AndroidManifest.xml file in each component declaration. For example,

Read more »

dependency-injection-modularized-android-application-1.jpg?w=2924

Story

I recently encountered an issue that I need to separate the App module (Android project) into several library modules to fulfill the requirements of the Dynamic Feature Module in the future. In the beginning, I thought that should be an easy job, how hard it can be?

wait-its-hard.gif
How hard it can be?

Read more »

gopher10th-small.jpg
Credit by Golang Official Blog

In many programming languages such as Java, Kotlin, Objective-C, and Swift, they support the Generic programming. But in Golang, it doesn’t have that kind of feature. What if we want to use this feature, how can we do? Let’s check the Interface in Golang. And how it can achieve the generic programming in Golang.

Read more »

logos.jpg?w=2924

Why

I used to use Wordpress to write my blog. But I recently think of creating the blog system by Golang and make it for fun. Here is what I am doing now. The main reason I start doing is that I found the markdown support in Wordpress is slightly weird and hard to use. When I try to change some blog content, the markdown style sometimes won’t show correctly. That makes me feel frustrated. I think that probably might because I am using the free plan in wordpress.com and have less control of my blog.

So, my goal is quite simple and straightforward. The new blog should fully support markdown content. And it should serve a clean and straightforward interface. Let’s see how I am going to do it.

Read more »

Here are some interesting tips when you are using Kotlin. Let’s take a look at something about object, invoke operator, and destructuring.

Read more »

typescriptimage.jpeg?w=2924

What is Cron?

Cron is a classic utility found on Linux and UNIX systems for running tasks at pre-determined times or intervals. These tasks are referred to as Cron tasks or Cron jobs. Use Cron to schedule automated updates, report generation, or check for available disk space every day and send you an email if it falls below a certain amount.

Read more »

design-pattern.png?w=2924

The Story

I recently encountered a question about why it’s better to using interface than inheritance. I have this because we defined lots of interfaces (behaviors) in a recent project. And, I am not saying this is bad, but just because this is not my familiar pattern when trying to design a system and also wanted to think of it deeper why we are doing that. I am confused if some classes share the same behaviors, my first thought from Java world is to create a parent class to define those common behaviors and then derivative classes would get the benefits without implementing the same behaviors again. But someone told me: Using an interface is better. So, I want to figure out why an interface is better than inheritance. According to the wiki description:

Composition over inheritance - Wikipedia
Composition over inheritance (or composite reuse principle) in object-oriented programming (OOP) is the principle that classes should achieve polymorphic behavior and code reuse by their Composition (by containing instances of other classes that implement the desired functionality) rather than inheritance from a base or parent class

Read more »