How to write clean code?

SweetSoft
1 min readMay 30, 2022

Hey, friends. Let’s start this week with some helpful development tips.

Use meaningful names

The name tells why it exists, what it does, and how it’s used. If the name requires additional comments, it does not display its intent.

Apply SRP — single responsibility principle

All classes, modules, and functions should do only one thing and should do it well.

Don’t write unnecessary comments

Try to improve your code so that others can understand it. Try to make it “self-documenting”.

Know language conventions

Be aware of your language conventions regarding spacing, comments, and naming. For example, camelCase in JavaScript, but snake_case in Python.

Keep your code dry

Did you know about 2 types of code? WET (Write Everything Twice) and DRY (Don’t Repeat Yourself). So if one component can be reused, don’t repeat it again.

Order software services from SweetSoft and help Ukraine.

Contact us any way you like.

https://sweetsoft.biz

https://sweetsoft.dev

https://sweetsoft.me

@sweetsoft_inc

--

--