Skip to main content


Showing posts from 2024

Bit By Bit, You're Charming My Heart

Deliver SaaS According Twelve-Factor App

If you haven't heard of  the twelve-factor app , it gives us a recommendation or a methodology for developing SaaS or web apps structured into twelve items. The recommendation has some connections with microservice architecture and cloud-native environments which become more popular today. We can learn the details on its website . In this post, we will do a quick review of the twelve points. One Codebase Multiple Deployment We should maintain only one codebase for our application even though the application may be deployed into multiple environments like development, staging, and production. Having multiple codebases will lead to any kinds of complicated issues. Explicitly State Dependencies All the dependencies for running our application should be stated in the project itself. Many programming languages have a kind of file that maintains a list of the dependencies like package.json in Node.js. We should also be aware of the dependencies related to the pla

How To Use Protocol Buffer in Javascript

We have understood a few advantages of protocol buffer like what I've explained in my other post . Now, let's look at how we can implement it in our code. The "transpiler" tool, named protoc , supports the generation of a helper class for managing the object instance in a variety of programming languages. In this post, we use Javascript as an example and run in a Linux environment. Preparation Before we develop our code, we should install protoc for generating the helper class. Download protoc binary from the release page . Extract the content and store the directories  ( bin  and  includes ) in /usr/local  directory so that the executable binary can be accessed directly. Run protoc --help to check its manual. Install a required dependency globally to enable protoc  to generate the Javascript files by running: npm i -g protoc-gen-js . Create a proto file First, we should create an empty directory

Cycle of Hatred

We realized what was inside his mind when Pein talked to Naruto.

How To Measure Modularity

A module is a set of parts that can be used to build a more complex system. How parts can be set or grouped together is based on some considerations. How optimised our module or how good the modularity level of our system is, are our questions. Several aspects are very common when we want to measure the modularity of our system or software: cohesion , coupling , and connascence . Cohesion It is the indicator of whether we efficiently group some parts together. A cohesive module means all parts in the module are well coupled. If we break a cohesive module in our code into pieces or smaller modules, that will lead to an increase in coupling across modules and a decrease in the readability of the code. There are a few types of cohesion based on the cause of cohesiveness such as functional, sequential (input-output relation), procedural (execution order), logical, or temporal. One that is not strongly related to the functional aspect is logical cohesion. For example, we may

Advantages of Using Protocol Buffer

A protocol buffer is a mechanism to share objects between machines which is language agnostic and has a target to reduce the payload size. We are already common with JSON which is used by most RESTful APIs to send/receive objects to/from any kind of client. JSON is already convenient and supported by many platforms, but, why we should know about the protocol buffer. Besides the optimization of payload encoding, protocol buffer which is also called  protobuf introduces schema definition that should be maintained by the machines to encode or decode the objects delivered. The main processes for delivering the objects are called serialization and deserialization. Serialization is the process of transforming an object instance in an application into an optimized binary payload. Deserialization is the process of decoding the binary data into the desired object. Let's take a look at the following table that shows a comparison of XML, JSON, and protobuf.