---
# System prepended metadata

title: Coding Guideline

---

# Coding Guideline

## 1. Large amount of data
When retrieving/processing large amount of data, utilize the mouse over function to know what are the data you are dealing with.

Example: When .ToList() is called, this means data is already pulled out from DB. 

Please make sure to only retrieve the data that are needed by adding filter syntax before calling .ToList().

-- Add screenshot, example
-- Summary execute at DB
-- Cannot process data from code

## 2. For Loop
Some things are okay if executed independently, but if it is inside a for loop, there is a different story.

Example: If there is one function that will retrieve data from DB, executing it once is fine, but inside a for loop, it will query the DB many time to retrieve the data. There will be a performance issue and wasting alot of DB resources.

**N+1 queries**

## 3. Nested For Loop
When there is a need to use nested for loop, please pay special attention and review it to make sure that it is absolutely necessary to use

## 4. Referencing current code
The code that is currently running is working as expected is definitely worth to be used as a reference. It might have been because of the things he/she have overcome and resulted in the current code.

Unless you are very sure that he/she is wrong and you are able to suggest improvement to the code, it is advised to refer to the current code and apply.

## 5. Professional RD
We are not just to simply complete a function. We need to put into consideration what if there is a lot of data.

We have high standard for RD, not just that it can successfully display the data, but it has to run smoothly and the user experience is good

Otherwise, what are our difference with those people who have just learned to code?

We are professional RD

## 6. API data
When coding an API, you have to consider the possibility of it being accessed by unauthorized user. You must prevent a stranger from getting access to confidential information.

## 7. Sharing responsibility
The whole team will be responsible for the trash code that is written by any RD.

We must have higher standard from each other and cover each other because we are standing on the same boat.