---
title: "Understanding list of coding principle"  
description: "Understanding list of coding principle"  
author: "ICSM Computer"  
published: 2025-04-22  
updated: 2025-04-28  
canonical: https://www.mindstick.com/interview/34042/understanding-list-of-coding-principle  
category: "programming language"  
tags: ["programming language"]  
reading_time: 4 minutes  

---

# Understanding list of coding principle

There are **many other software design and coding principles** that help guide good programming practices. Here’s a list of **additional important coding principles** that developers often follow:

### DRY (Don't Repeat Yourself)

> **Avoid code duplication**. Extract common logic into reusable methods or modules.

**Why?**\
Helps maintain code. If something changes, you only need to update it in one place.

### KISS (Keep It Simple, Stupid)

> Write **simple and straightforward** code.

**Why?**\
Simple code is easier to read, debug, and maintain.

### YAGNI (You Aren’t Gonna Need It)

> Don’t build something **unless you actually need it**.

**Why?**\
Avoids overengineering and keeps the codebase lean.

### Separation of Concerns (SoC)

> Divide a program into distinct sections, each handling a **specific responsibility**.

**Why?**\
Improves readability, maintainability, and testability.

### Law of Demeter (LoD)

> “**Only talk to your immediate friends**.”

**In Code:**\
A method should call methods only on:

1. Itself
2. Its parameters
3. Its instance variables

**Why?**\
Reduces tight coupling and improves encapsulation.

### Composition Over Inheritance

> Prefer **composing objects** with behavior over inheriting from classes.

**Why?**\
It’s more flexible and avoids deep and fragile inheritance hierarchies.

### Design for Testability

> Write code that is **easy to test** via unit tests.

## How?

1. Use dependency injection
2. Avoid static dependencies
3. Separate concerns

### Principle of Least Astonishment

> Code should behave in a way that **least surprises other developers**.

**Why?**\
Helps make APIs and systems more intuitive to use.

### Clean Code Principles (Robert C. Martin’s guidance)

| Principle | Description |
| --- | --- |
| **Meaningful Names** | Use names that reveal intent. |
| **Small Functions** | Keep functions small and focused. |
| **Avoid Comments as Justification** | Code should be self-explanatory. |
| **Error Handling** | Don’t obscure the logic. Handle exceptions cleanly. |

### Fail Fast Principle

> Detect errors as early as possible.

**Why?**\
Makes debugging easier and improves software reliability.

### Tell, Don’t Ask Principle

> Ask objects to do something instead of asking for their data and doing the work yourself.

## Example:

Bad:

```plaintext
if (car.Engine.IsRunning) {
    car.Engine.Stop();
}
```

Better:

```plaintext
car.StopEngine();
```

## Answers

### Answer by ICSM Computer

There are **many other software design and coding principles** that help guide good programming practices. Here’s a list of **additional important coding principles** that developers often follow:

### DRY (Don't Repeat Yourself)

> **Avoid code duplication**. Extract common logic into reusable methods or modules.

**Why?**\
Helps maintain code. If something changes, you only need to update it in one place.

### KISS (Keep It Simple, Stupid)

> Write **simple and straightforward** code.

**Why?**\
Simple code is easier to read, debug, and maintain.

### YAGNI (You Aren’t Gonna Need It)

> Don’t build something **unless you actually need it**.

**Why?**\
Avoids overengineering and keeps the codebase lean.

### Separation of Concerns (SoC)

> Divide a program into distinct sections, each handling a **specific responsibility**.

**Why?**\
Improves readability, maintainability, and testability.

### Law of Demeter (LoD)

> “**Only talk to your immediate friends**.”

**In Code:**\
A method should call methods only on:

1. Itself
2. Its parameters
3. Its instance variables

**Why?**\
Reduces tight coupling and improves encapsulation.

### Composition Over Inheritance

> Prefer **composing objects** with behavior over inheriting from classes.

**Why?**\
It’s more flexible and avoids deep and fragile inheritance hierarchies.

### Design for Testability

> Write code that is **easy to test** via unit tests.

## How?

1. Use dependency injection
2. Avoid static dependencies
3. Separate concerns

### Principle of Least Astonishment

> Code should behave in a way that **least surprises other developers**.

**Why?**\
Helps make APIs and systems more intuitive to use.

### Clean Code Principles (Robert C. Martin’s guidance)

| Principle | Description |
| --- | --- |
| **Meaningful Names** | Use names that reveal intent. |
| **Small Functions** | Keep functions small and focused. |
| **Avoid Comments as Justification** | Code should be self-explanatory. |
| **Error Handling** | Don’t obscure the logic. Handle exceptions cleanly. |

### Fail Fast Principle

> Detect errors as early as possible.

**Why?**\
Makes debugging easier and improves software reliability.

### Tell, Don’t Ask Principle

> Ask objects to do something instead of asking for their data and doing the work yourself.

## Example:

Bad:

```plaintext
if (car.Engine.IsRunning) {
    car.Engine.Stop();
}
```

Better:

```plaintext
car.StopEngine();
```


---

Original Source: https://www.mindstick.com/interview/34042/understanding-list-of-coding-principle

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
