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 »

artillery-logo.png?w=2924

There are so many choices for doing a system loading test on backend side. Let’s see the list below:

You can read this post to get more detail information. Choosing Artillery is because it can provide the test scenario for developers to design a test context. After doing some researches and adapting to this tool, I found some advantages for using it to do the web benchmark.

Read more »

typescriptimage.jpeg?w=2924

You might sometimes see import * from library in the third-party library or some project, and in the meantime, you can also see this code import something = require('library'). Would you wonder what the difference between these two sentences is? Here is the explanation about what difference between import from and import require is.

Let’s see an example first, and you can find these two usages:

1
import uuid = require('uuid');

And, another way like this:

1
import uuid from 'uuid';
Read more »

typescriptimage.jpeg?w=2924

Problem

In the recent project, we’ve mentioned about one question:

why do we do our imports as relative paths rather than absolute paths? It’s not easy to figure out what’s the correct path.

We then start discussing what the pros and cons are for using an absolute path or relative path. To my best knowledge, I always voted for the relative path, cause that won’t cause a problem when we try to deploy the service into different file paths. But the con is that we need first to figure out what’s the correct import path. But using an absolute import path is the contrary.

Read more »