Sign in

Kecci Kun

Ada dilema saat saya dan rekan-rekan saya yang baru join di perusahaan baru dan melihat codingan lama atau codingan legacy yang perlu diperbaiki. Dan setelah diskusi bersama, terdapat 2 opsi yang bisa dipilih yaitu Rewrite atau Refactor.

Tujuannya adalah supaya dapat menyelesaikan beberapa issue berikut:

  • Performance Issues (RPS, Traffic spike, connections).
  • Security Issues (Config, IP Address, Vulnerabilities).
  • Code smells (Spaghetti code, Reusable code, Design pattern).
  • Lack of Architecture Design (Layering, Packaging, Naming, API).
  • Lack of Data structure (Redundant data, Data scheme).
  • Lack of Infrastructure Design (Repositories, Pod, Container).
  • Lack of Monitoring (Log, Trace, Metric).

Rewrite (+Revamp UI)

Rewrite artinya meng-code ulang dari aplikasi…


Before we go further, let’s we see how the different between OAS 2.0 and OAS 3.0 on this documentation :

OAS 2.0: https://swagger.io/docs/specification/2-0/api-host-and-base-path/OAS 3.0: https://swagger.io/docs/specification/api-host-and-base-path/

Then, I found interesting discussion on reddit forum about generate open api 3.0 for Go:


connection() : auth error: sasl conversation error: unable to authenticate using mechanism “SCRAM-SHA-1”: (AuthenticationFailed) Authentication failed.

Problem

I was tried to connect with mongo db with simple connection with mongo-go-driver. Here the code main.go :

package mainimport (
"context"
"fmt"
"net/url"
"go.mongodb.org/mongo-driver/mongo"
"go.mongodb.org/mongo-driver/mongo/options"
"go.mongodb.org/mongo-driver/mongo/readpref"
)
var ctx = context.Background()func main() {
driver := "mongodb"
host := "127.0.0.1"
port := "27017"
username := "kecci"
password := "p@sword%20"
URL := url.URL{
Scheme: driver,
Host: fmt.Sprintf("%s:%s", host, port),
}
if username != "" || password != "" {
URL.User = url.UserPassword(username, password)
}
fmt.Printf("URI: %s \n", URL.String())
clientOptions := options.Client().ApplyURI(URL.String())
clientOptions.SetDirect(true)
client…


Kok ada dua rumah yang luas tanah-nya sama tapi harga-nya berbeda ?

Padahal sama-sama luas tanah 60 meter. Yang satu 300 juta dan yang satu lagi 1,3 miliar. Wow, sangat signifikan perbedaannya hingga 1 miliar.

Sebelumnya, saya ingin katakan. Tulisan ini hanya dari sudut pandang pribadi. Hanya untuk sharing tentang apa yang telah saya alami.

Nilai Properti

Nilai properti tergantung pada 4 faktor, yaitu:

  1. Per-Surat-An.
    Tentu saja tanah yang tidak memiliki surat jauh lebih murah dibandingkan yang sudah bersertifikat. Mengapa? Karena harga yang dijual tidak memiliki patokan, sehingga tanah tergolong bebas (Non-Record). Poin plus-nya adalah harga yang diberikan adalah harga kontan atau harga…


What Webhook is and how to implement the Webhook properly.

Before we go further, let’s we read about hook.

In computer programming, the term hooking covers a range of techniques used to alter or augment the behaviour of an operating system, of applications, or of other software components by intercepting function calls or messages or events passed between software components. Code that handles such intercepted function calls, events or messages is called a hook. — Wikipedia

So what is webhook.

A webhook in web development is a method of augmenting or altering the behavior of a web page or web…


Panic is a built-in function that stops the ordinary flow of control and begins panicking. — blog.golang.org

Panic.

I was scary to hear that. It’s sounds like terrible crash. But If you using golang, as we all know, there is no exception in Go. Just Panic.

Example of panic runtime slice bounds out of range :

package mainimport (
"fmt"
)
func main() {
h := "Hello"
substring := h[0:6] // Here is the panic
fmt.Println(substring)
}

Output :

panic: runtime error: slice bounds out of range [:6] with length 5

goroutine 1 [running]:
main.main()
/tmp/sandbox094013890/prog.go:9 +0x1d

So what…


Kunci pembangunan aplikasi yaitu salah satunya adalah dokumentasi yang baik. UML Diagram dapat menggambarkan kerangka kerja secara keseluruhan dengan baik.

Sebenarnya Ada beberapa macam dari UML diagram, namun menurut pengamatan saya, yang paling sering digunakan dalam pengembangan aplikasi ada 4 UML Diagram, yaitu sebagai berikut:

  1. Use case diagram
  2. Squence diagram
  3. Class diagram
  4. Activity diagram

Use case diagram


In performance scenario, as client, they want to know how long process time form the server. So the server should have tracker to show server process time information.

There are several information, such as database read, application process, cache read, file read, total duration. Read more HTTP Server-Timing: https://www.w3.org/TR/server-timing/

What I’m doing now, I was looking from echo framework to show server-time, but I there is no feature middleware to record server-time.

Finally, I found this library called mitchellh/go-server-timing . It is simple and lightweight use to record and tracking metric of Server-Timing.

mitchellh/go-server-timing is Go (golang) library for creating…


In this day, a lot of open source library golang to support build application. I should recommend for you some library that could help to initiate project with simple design, clean code, and have good performance.

1. CLI commands (spf13/cobra)


Java, Spring boot, RESTful, H2 Database, Swagger, Heroku

There are 5 step to accomplish this project:

  1. Setup Project (Spring Initializr, Dependency POM.xml, Project Structure)
  2. Setup Database (application.properties, check database with h2 console)
  3. Create Object & Component (Entity, Repository, Pojo, Service & Controller)
  4. Setup Swagger Config (Customizing Config)
  5. Setup Heroku (Create App, Deploy App)

Step 1 — Setup Project

Initialize your project with Spring Initializr A Spring Initializr. Open: https://start.spring.io/

Add Dependency through Spring Initializr:

  • Spring Web
  • Spring Data JPA

Kecci Kun

Software Engineer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store