How Important is Clean Code?

Photo by Chris Ried on Unsplash

Some Introduction

Clean Code

Clean Code simple and minimal

Clean Code is self-explaining

// Method to add two integers
def add(int1, int2):
return int1 + int2 // return the result of addition
// Method to multiply two integers
def mul(int1, int2):
return int1 * int2 // return the result of multiplication

Clean Code is free of duplication

Column(
children: [
Text(
'Text 1',
color: Colors.red,
style: TextStyle(fontWeight: FontWeight.bold),
),
Text(
'Text 2',
color: Colors.red,
style: TextStyle(fontWeight: FontWeight.bold),
),
],
)
Widget redBoldedText(String label) {
return Text(
label,
color: Colors.red,
TextStyle(fontWeight: FontWeight.bold)
);
}
Column(
children: [
redBoldedText("Text 1"),
redBoldedText("Text 2"),
],
)

Clean Code passes all tests

Clean Code is free from tightly-coupled dependencies

Refactoring

Source: https://docondev.com

When to refactor?

What to look for?

Refactoring Techniques

Examples

Conclusion

Computer Science Student at Universitas Indonesia