Best Practices / Clean Code Tips / micropost

Clean Code Tips (Week 2)

Hello again! The Clean Code tips for the current week are…

The first rule of functions is that they should be small. This implies that the blocks within if statements,else statements,while statements, and so on should be one line long.

The smaller and more focused a function is, the easier it is to choose a descriptive name.

If a function is divided into sections this is an obvious symptom of doing more than one thing. Functions that do one thing cannot be reasonably divided into sections.

Don’t be afraid to make a name long. A long descriptive name is better than a short enigmatic name. A long descriptive name is better than a long descriptive comment.

I hope it helps in your daily work!

All tips have been taken from Robert Martin’s Clean Code book

Stay tuned for the next week.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s