0⃣ Clean Code Series: Variables📒🧑‍💻

It's a guide to producing readable, reusable, and refactorable software in #php #ruby #javascript #python #java, etc. - Software engineering principles, from Robert C. Martin's book "Clean Code"

(code: github.com/jupeter/clean-…)

Thread (9)🧵👇 Image
1⃣ Clean Code Series: Variables📒 🧑‍💻

☑️ Use meaningful and pronounceable variable names Image
2⃣ Clean Code Series: Variables📒 🧑‍💻

☑️ Use the same vocabulary for the same type of variable Image
3⃣ Clean Code Series: Variables📒 🧑‍💻

☑️ Use searchable names (part 1)

💡We will read more code than we will ever write. By not naming variables that end up being meaningful for understanding our program, we hurt our readers. Make your names searchable. Image
4⃣ Clean Code Series: Variables📒 🧑‍💻

☑️ Use searchable names (part 2) Image
5⃣ Clean Code Series: Variables📒 🧑‍💻

☑️ Use explanatory variables Image
6⃣ Clean Code Series: Variables📒 🧑‍💻

☑️ Avoid nesting too deeply and return early (part 1)

💡Too many if-else statements can make your code hard to follow. Explicit is better than implicit. Image
7⃣ Clean Code Series: Variables📒 🧑‍💻

☑️ Avoid nesting too deeply and return early (part 2) Image
8⃣ Clean Code Series: Variables📒 🧑‍💻

☑️ Avoid Mental Mapping

💡Don’t force the reader of your code to translate what the variable means. Explicit is better than implicit. Image
9⃣ Clean Code Series: Variables📒 🧑‍💻

☑️ Don't add unneeded context

💡If your class/object name tells you something, don't repeat that in your variable name. Image
That's all for the first part of clean-code.
In the next Thread, I will add functions & classes.

If you like this thread,
✅ Follow me @rajkbnp
💕 Like it
🔀 Retweet it

Thanks 🙏
📢The second part of the Clean Code Series: Comparison is also available now👇

#tdd #ddd #solid #cleancode #refactor
More on the way (next: functions)

• • •

Missing some Tweet in this thread? You can try to force a refresh
 

Keep Current with ⚡️ Raj KB ⚡️

⚡️ Raj KB ⚡️ Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @rajkbnp

Feb 1
0⃣Clean Code Series: Comparision 📒💻

A guide to producing readable, reusable, and refactorable software in #php (#laravel #symfony) #javascript #python, etc.

- Software engineering principles, from Robert C. Martin's book "Clean Code"

🔽 github.com/jupeter/clean-…

Thread 🧵👇 Image
1⃣Clean Code Series: Comparision 📒💻

☑️ Use identical comparison Image
2⃣Clean Code Series: Comparision 📒💻

☑️ Null coalescing operator Image
Read 5 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Don't want to be a Premium member but still want to support us?

Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal

Or Donate anonymously using crypto!

Ethereum

0xfe58350B80634f60Fa6Dc149a72b4DFbc17D341E copy

Bitcoin

3ATGMxNzCUFzxpMCHL5sWSt4DVtS8UqXpi copy

Thank you for your support!

:(