Dimas Maulana

Dimas Maulana

Developer

Welcome to my website! I am a developer with a current focus on React and Go. My experience encompasses both front-end and back-end development, enabling me to design and develop seamless and efficient applications.

Git Repository Naming

This article explores best practices for naming Git repositories, ensuring clarity, consistency, and maintainability. It covers key considerations such as readability, versioning, project scope, and collaboration standards to help developers create effective repository names.

Microservices

Better suited to a project team or department where multiple products exist and are made up of sub-components.

Shell Bash Check if Environment Exist

Your provided code snippet appears to be a Bash script that checks if the TARGET_PATH environment variable is empty and, if so, sets it to ~/go by appending an export statement to the .bashrc file. This is a common technique to ensure that environment variables are set with default values if they are not already defined.

Here’s a breakdown of what the code does:

  1. if [[ -z "${TARGET_PATH}" ]]; then: This line checks if the TARGET_PATH environment variable is empty (i.e., its value is not set). The -z flag is used to test if a string is empty.

Shell Bash Check PATH Environment Exist

It looks like you are trying to check if a specific directory is included in the PATH environment variable in a Bash script. The code you provided is almost correct, but it has a small issue. You can modify it as follows to make it work correctly:

1
2
3
4
5
6
7
CHECK_PATH="/root/go/bin"

if [[ ":$PATH:" == *":$CHECK_PATH:"* ]]; then
    echo "Path found in PATH environment. Skipping configuration..."
else
    echo "Path not found in PATH environment. You may need to add it."
fi

Here’s a breakdown of the changes made:

Separating Business Model and Logic Ensuring SRP in Car Class Design

In software architecture, adhering to the Single Responsibility Principle (SRP) is crucial to maintaining clean, modular, and maintainable code. One common mistake is merging business models with business logic, leading to unnecessary dependencies and reduced scalability. This article explores how to properly separate these concerns using an MVC-based approach for a Car class and its related components.

Issue: Business Model Breaking SRP

A Car class should represent a data model rather than handle business logic or external service interactions. However, integrating dependencies like IFileSystemService into the Car class blurs the lines between the model and the business logic, leading to tightly coupled code that is harder to maintain and extend.

Rendering Empty Space in React

Sometimes in React, you may need to render empty space or create gaps between elements. There are several ways to achieve this, and one common method is to use HTML entities like   within your JSX code. In this article, we’ll explore how to render empty space in React using various techniques.

1. Using HTML Entities

As mentioned in the question, you can use HTML entities like   to render empty space in React components. Here’s an example:

Using Singular Form for Collection Repo/Folder Name in Idiomatic Go

In the world of Go programming, adhering to idiomatic coding practices is highly valued. One of these practices pertains to the naming of collection repository or folder names. The Go community recommends using the singular form for such names, and this convention is followed consistently in various Go projects. Let’s take a closer look at this best practice.

Singular vs. Plural

When organizing your Go packages into repositories or folders, you’ll often find situations where you have multiple related packages that belong to a common category. Examples could include packages for various utilities, components, or modules. In such cases, it’s recommended to use the singular form for the repository or folder name.

0%