|Design| Synchronous v.s. Asynchronous

This article will distinguish Synchronous and Asynchronous.
I just want to say forget your Chinese ……

中文DefinitionAPI and callbackBlock
Synchronous同步While the API receiving the callback remains on the stack, you would expect that the callback had been invoked on each element.in the same threadBlock
Asynchronous非同步Callback is invoked after a function returns, or at least on another thread’s stack.
while the API receiving the callback remains on the stack, the callback may not have been called, since it’s waiting for the connection to complete.
multi-threadnon-block

Therefore, if you want to design asynchronous APIs, keep your threads safety.


這邊很常有個謬誤:
非同步,中文看起來很像是:排排隊,一個做完再做下一件事。
同步,看起來很像是:有兩個 thread,一起做事。
事實上,非常抱歉,以英文及程式的定義來說剛好反過來!


Ref.
Good article:
https://blog.ometer.com/2011/07/24/callbacks-synchronous-and-asynchronous/
Translation:
https://www.eebreakdown.com/2015/09/callback-apis.html?m=1

https://blog.huli.tw/2019/10/04/javascript-async-sync-and-callback/
https://www.ithome.com.tw/node/74544

|Linux| D-BUS notes

Take some notes ……

Conceptions:
– D-BUS is an IPC method. what is IPC ?
– It is common on Linux-like platform
– High level API implemented by dbus-glib, python … so on.
– server – client services

Notice: use GDBus instead of dbus-glib: comparing
   → GDBus: https://developer.gnome.org/gio/stable/

Then following are some code snippets and configuration examples.

|OOP| Learn “Factory Pattern” from Android Telephony

Factory pattern is a basic pattern in grant software framework.
We create object, parent, with common interface to create new type of object.
The common interface is a static member-function (static factory method) which creates & returns instances, hiding the details of children.

The following will show a snappiest code of Android Q.