SlideShare a Scribd company logo
1 of 62
Download to read offline
Naming Things
A Definitive Guide to
Nem Nomen
Nemonclatuer
What is code?
Ostensibly for the computer. In reality, it’s a recipe that has to be digested by two audiences: the computer and the developers. You have to encode behaviour and intent.
What is good code?
Good code is efficient. By efficient, I don’t mean efficient for the computer, I also mean efficient for the human mind. To understand that, I want you to focus on an idea:
cognitive overhead.
Why is naming things
important?
It’s our primary tool for communication. It is the artefact left behind of someone’s thoughts and intentions. A good name conveys how to use something and give you a
clear sense of when it should change.
Why is naming things
hard?
Often because when we’re forced to pick a name, we have to articulate a concept. Often it is hard to express a concept in a simple word or two. Ideas can be subtle.
Struggling to name something is actually an important part of of design. Difficulty indicates that the object is doing too much.
Variables
Who can tell me what’s wrong here?
Remove all ambiguity about units!
No context. Hard to search for.
Some developers solve this problem with comments. But why is it you have to explain the code? Why can’t the code explain itself?
Better. But elapsed time for what?
Best. The context is clear.
What does this code do?
Nothing has changed but for your ability to understand this code. To the computer, these expressions are identical. But everything important to you, the developer, has
changed.
Flagged for what?
Ah. Wouldn’t want to mistake that one.
Abbreviations are hard to read. Why `res` instead of `response`?
Better.
Creates confusion. Did the author intend an array here?
If it is meant to be an array, let it be an array.
If it isn’t meant to be an array, avoid numbers. This is a common pattern seen in tests.
This is better. Now you’re articulating why you have two users: one is earlier and one is later.
Type suffixes usually add more context than is necessary, and cause greater churn when you replay one type for another (bigger concern in a dynamic language).
Better.
These properties and methods return booleans. But you wouldn’t know it to look at them.
Better.
Methods
Redundancy.
Better.
Repeated prefixes in a method name or property name often indicate one thing…
You found another object!
Classes
Prefixes: not the worst thing, but consider why this happens. It’s because the author wanted to use the name “File” twice. Consider what would happen if they were
forced to pick another name.
Better.
Perhaps this also hints at an object though?
These names are red flags. Why?
What does a “page manager” do? Any guesses? Well, it manages a page. So anything that could plausibly be considered “managing a page” could easily get added to
this class. These classes quickly balloon out of control.
Here’s an example. Imagine you have a “page formatter”.
By turning this into a formatted page, you are now talking about the end result of what this class does – what you’re trying to achieve. This allows you to think more
clearly about what is and isn’t needed.
Specificity is good, but use your judgement. For instance, it’s probably fine to call a postal address simply an “address”.
However, if your application deals with more than one type of address, you may want to consider increasing its specificity.
Conventions
These methods invite confusion, because you constantly have to ask yourself “is this object add, insert, or append”?
Here, never have to think.
Always consider your domain. For instance, does your business sell to “users”?
Probably not. You should be able to speak the language of the domain.
Avoid patterns in names. Design patterns are implementation details, and encoding the pattern into the name prevents altering that class in the future to not use that
pattern. They’re unnecessary information that usually only adds cognitive overhead.
Better. The API is clear to use, and that’s all that matters.
Naming ergonomics
Directories and their structure are just as important as the file name. Both can add context and lower overhead for finding files or figuring out where to place files. A well-
named directory can be more powerful than a well-named class.
Consider the ergonomics. Folders with too many items take longer to read. A folder with one item is like having a category with one item, which is not a useful category
to have.
Long names are bad, because they often contain too many concepts, indicating an object that has a high cognitive overhead.
They also lead to abbreviations, because typing out “bookings_products_vehicle_types” everywhere is cumbersome. (This is a real world example.)
If necessary, make the name longer. Brevity is good, but the ultimate goal is clarity. Here, the key concept is that we have vehicle types.
When the inevitable shortening happens, it’s easier to do things like this. Not perfect, but far better than “bpvt”.
If you have a term that can be taken multiple ways, that constitutes a pun. A “List” may be an type of object in your system, a “BucketList” may mislead a developer into
thinking it is a type of “List”, when in fact you meant something entirely different.
Better.
What is it you do?
You are a translator for two audiences. You are the bridge between the human and the computer. You need to know how computers work and how humans work – both
the humans which your software serves, and the humans which your software will by changed by. Your primary weapon in your toolbox against ambiguity and cognitive
overhead – the forces that corrode a software’s maintainability – is to name. You name things every day. Be mindful about the words you choose. Software should be
written to be read by another developer.
“Indeed, the ratio of time spent reading versus writing
is well over 10 to 1. We are constantly reading old code
as part of the effort to write new code. ...[Therefore,]
making it easy to read makes it easier to write.”
– Robert C. Martin (Uncle Bob)
A parable about
stones
Marco Polo describes a bridge, stone by stone. "But which is the stone that supports the bridge?" 

Kublai Khan asks. "The bridge is not supported by one stone or another," Marco answers,   

"but by the line of the arch that they form.” Kublai Khan remains silent, reflecting. Then he adds: 

"Why do you speak to me of the stones? It is only the arch that matters to me.” Polo answers: "Without stones there is no arch."
On Exactitude
To my mind exactitude means three things above all:
(1) a well-defined and well-calculated plan for the work in
question;
(2) an evocation of clear, incisive, memorable images;
(3) a language as precise as possible both in choice of
words and in expression of the subtleties of thought and
imagination.
- Italo Calvino

More Related Content

Similar to Naming Things

Untangling spring week8
Untangling spring week8Untangling spring week8
Untangling spring week8Derek Jacoby
 
(E book pdf) thinking in patterns with java
(E book   pdf) thinking in patterns with java(E book   pdf) thinking in patterns with java
(E book pdf) thinking in patterns with javaRaffaella D'angelo
 
E1f14172a91215931ed787d97dee1301fe7d
E1f14172a91215931ed787d97dee1301fe7dE1f14172a91215931ed787d97dee1301fe7d
E1f14172a91215931ed787d97dee1301fe7dKlaus Lieblich
 
C# and java comparing programming languages
C# and java  comparing programming languagesC# and java  comparing programming languages
C# and java comparing programming languagesShishir Roy
 
Low maintenance perl notes
Low maintenance perl notesLow maintenance perl notes
Low maintenance perl notesPerrin Harkins
 
Technical Writing For Consultants
Technical Writing For ConsultantsTechnical Writing For Consultants
Technical Writing For Consultantsrlucera
 
WordCamp US: Clean Code
WordCamp US: Clean CodeWordCamp US: Clean Code
WordCamp US: Clean Codemtoppa
 
Importance Of Being Driven
Importance Of Being DrivenImportance Of Being Driven
Importance Of Being DrivenAntonio Terreno
 
Creativity vs Best Practices
Creativity vs Best PracticesCreativity vs Best Practices
Creativity vs Best PracticesSupun Dissanayake
 
Rethinking Object Orientation
Rethinking Object OrientationRethinking Object Orientation
Rethinking Object OrientationIASA
 
Marketing Your Open Source Project - OSCON 2019_v04.pdf
Marketing Your Open Source Project - OSCON 2019_v04.pdfMarketing Your Open Source Project - OSCON 2019_v04.pdf
Marketing Your Open Source Project - OSCON 2019_v04.pdfAmazon Web Services
 
A smarter way to learn java script
A smarter way to learn java scriptA smarter way to learn java script
A smarter way to learn java scriptAdrianTrasca2
 
A Smarter Way to Learn JavaScript.pdf
A Smarter Way to Learn JavaScript.pdfA Smarter Way to Learn JavaScript.pdf
A Smarter Way to Learn JavaScript.pdfsandipanpaul16
 

Similar to Naming Things (20)

Untangling spring week8
Untangling spring week8Untangling spring week8
Untangling spring week8
 
Clean Code
Clean CodeClean Code
Clean Code
 
A class action
A class actionA class action
A class action
 
(E book pdf) thinking in patterns with java
(E book   pdf) thinking in patterns with java(E book   pdf) thinking in patterns with java
(E book pdf) thinking in patterns with java
 
E1f14172a91215931ed787d97dee1301fe7d
E1f14172a91215931ed787d97dee1301fe7dE1f14172a91215931ed787d97dee1301fe7d
E1f14172a91215931ed787d97dee1301fe7d
 
C# and java comparing programming languages
C# and java  comparing programming languagesC# and java  comparing programming languages
C# and java comparing programming languages
 
Low maintenance perl notes
Low maintenance perl notesLow maintenance perl notes
Low maintenance perl notes
 
Technical Writing For Consultants
Technical Writing For ConsultantsTechnical Writing For Consultants
Technical Writing For Consultants
 
WordCamp US: Clean Code
WordCamp US: Clean CodeWordCamp US: Clean Code
WordCamp US: Clean Code
 
Importance Of Being Driven
Importance Of Being DrivenImportance Of Being Driven
Importance Of Being Driven
 
Creativity vs Best Practices
Creativity vs Best PracticesCreativity vs Best Practices
Creativity vs Best Practices
 
Six of the Best
Six of the BestSix of the Best
Six of the Best
 
Graphql
GraphqlGraphql
Graphql
 
Rethinking Object Orientation
Rethinking Object OrientationRethinking Object Orientation
Rethinking Object Orientation
 
Marketing Your Open Source Project - OSCON 2019_v04.pdf
Marketing Your Open Source Project - OSCON 2019_v04.pdfMarketing Your Open Source Project - OSCON 2019_v04.pdf
Marketing Your Open Source Project - OSCON 2019_v04.pdf
 
A smarter way to learn java script
A smarter way to learn java scriptA smarter way to learn java script
A smarter way to learn java script
 
A smarter way to learn java script
A smarter way to learn java scriptA smarter way to learn java script
A smarter way to learn java script
 
A Smarter Way to Learn JavaScript.pdf
A Smarter Way to Learn JavaScript.pdfA Smarter Way to Learn JavaScript.pdf
A Smarter Way to Learn JavaScript.pdf
 
ScienceBehindUX
ScienceBehindUXScienceBehindUX
ScienceBehindUX
 
Oops Concepts
Oops ConceptsOops Concepts
Oops Concepts
 

Recently uploaded

Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 
Buds n Tech IT Solutions: Top-Notch Web Services in Noida
Buds n Tech IT Solutions: Top-Notch Web Services in NoidaBuds n Tech IT Solutions: Top-Notch Web Services in Noida
Buds n Tech IT Solutions: Top-Notch Web Services in Noidabntitsolutionsrishis
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfAlina Yurenko
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio, Inc.
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureDinusha Kumarasiri
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作qr0udbr0
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odishasmiwainfosol
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWave PLM
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanyChristoph Pohl
 
Xen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfXen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfStefano Stabellini
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Andreas Granig
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesŁukasz Chruściel
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmSujith Sukumaran
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsAhmed Mohamed
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based projectAnoyGreter
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Hr365.us smith
 
What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....kzayra69
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...Technogeeks
 

Recently uploaded (20)

Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 
Buds n Tech IT Solutions: Top-Notch Web Services in Noida
Buds n Tech IT Solutions: Top-Notch Web Services in NoidaBuds n Tech IT Solutions: Top-Notch Web Services in Noida
Buds n Tech IT Solutions: Top-Notch Web Services in Noida
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
 
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort ServiceHot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with Azure
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need It
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
 
Xen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfXen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdf
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New Features
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalm
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML Diagrams
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based project
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)
 
What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...
 

Naming Things

  • 1. Naming Things A Definitive Guide to Nem Nomen Nemonclatuer
  • 2. What is code? Ostensibly for the computer. In reality, it’s a recipe that has to be digested by two audiences: the computer and the developers. You have to encode behaviour and intent.
  • 3. What is good code? Good code is efficient. By efficient, I don’t mean efficient for the computer, I also mean efficient for the human mind. To understand that, I want you to focus on an idea: cognitive overhead.
  • 4. Why is naming things important? It’s our primary tool for communication. It is the artefact left behind of someone’s thoughts and intentions. A good name conveys how to use something and give you a clear sense of when it should change.
  • 5. Why is naming things hard? Often because when we’re forced to pick a name, we have to articulate a concept. Often it is hard to express a concept in a simple word or two. Ideas can be subtle. Struggling to name something is actually an important part of of design. Difficulty indicates that the object is doing too much.
  • 7. Who can tell me what’s wrong here?
  • 8. Remove all ambiguity about units!
  • 9. No context. Hard to search for.
  • 10. Some developers solve this problem with comments. But why is it you have to explain the code? Why can’t the code explain itself?
  • 11. Better. But elapsed time for what?
  • 12. Best. The context is clear.
  • 13. What does this code do?
  • 14. Nothing has changed but for your ability to understand this code. To the computer, these expressions are identical. But everything important to you, the developer, has changed.
  • 16. Ah. Wouldn’t want to mistake that one.
  • 17. Abbreviations are hard to read. Why `res` instead of `response`?
  • 19. Creates confusion. Did the author intend an array here?
  • 20. If it is meant to be an array, let it be an array.
  • 21. If it isn’t meant to be an array, avoid numbers. This is a common pattern seen in tests.
  • 22. This is better. Now you’re articulating why you have two users: one is earlier and one is later.
  • 23. Type suffixes usually add more context than is necessary, and cause greater churn when you replay one type for another (bigger concern in a dynamic language).
  • 25. These properties and methods return booleans. But you wouldn’t know it to look at them.
  • 30. Repeated prefixes in a method name or property name often indicate one thing…
  • 31. You found another object!
  • 33. Prefixes: not the worst thing, but consider why this happens. It’s because the author wanted to use the name “File” twice. Consider what would happen if they were forced to pick another name.
  • 35. Perhaps this also hints at an object though?
  • 36. These names are red flags. Why?
  • 37. What does a “page manager” do? Any guesses? Well, it manages a page. So anything that could plausibly be considered “managing a page” could easily get added to this class. These classes quickly balloon out of control.
  • 38. Here’s an example. Imagine you have a “page formatter”.
  • 39. By turning this into a formatted page, you are now talking about the end result of what this class does – what you’re trying to achieve. This allows you to think more clearly about what is and isn’t needed.
  • 40. Specificity is good, but use your judgement. For instance, it’s probably fine to call a postal address simply an “address”.
  • 41. However, if your application deals with more than one type of address, you may want to consider increasing its specificity.
  • 43. These methods invite confusion, because you constantly have to ask yourself “is this object add, insert, or append”?
  • 44. Here, never have to think.
  • 45. Always consider your domain. For instance, does your business sell to “users”?
  • 46. Probably not. You should be able to speak the language of the domain.
  • 47. Avoid patterns in names. Design patterns are implementation details, and encoding the pattern into the name prevents altering that class in the future to not use that pattern. They’re unnecessary information that usually only adds cognitive overhead.
  • 48. Better. The API is clear to use, and that’s all that matters.
  • 50. Directories and their structure are just as important as the file name. Both can add context and lower overhead for finding files or figuring out where to place files. A well- named directory can be more powerful than a well-named class.
  • 51. Consider the ergonomics. Folders with too many items take longer to read. A folder with one item is like having a category with one item, which is not a useful category to have.
  • 52. Long names are bad, because they often contain too many concepts, indicating an object that has a high cognitive overhead.
  • 53. They also lead to abbreviations, because typing out “bookings_products_vehicle_types” everywhere is cumbersome. (This is a real world example.)
  • 54. If necessary, make the name longer. Brevity is good, but the ultimate goal is clarity. Here, the key concept is that we have vehicle types.
  • 55. When the inevitable shortening happens, it’s easier to do things like this. Not perfect, but far better than “bpvt”.
  • 56. If you have a term that can be taken multiple ways, that constitutes a pun. A “List” may be an type of object in your system, a “BucketList” may mislead a developer into thinking it is a type of “List”, when in fact you meant something entirely different.
  • 58. What is it you do? You are a translator for two audiences. You are the bridge between the human and the computer. You need to know how computers work and how humans work – both the humans which your software serves, and the humans which your software will by changed by. Your primary weapon in your toolbox against ambiguity and cognitive overhead – the forces that corrode a software’s maintainability – is to name. You name things every day. Be mindful about the words you choose. Software should be written to be read by another developer.
  • 59. “Indeed, the ratio of time spent reading versus writing is well over 10 to 1. We are constantly reading old code as part of the effort to write new code. ...[Therefore,] making it easy to read makes it easier to write.” – Robert C. Martin (Uncle Bob)
  • 60.
  • 61. A parable about stones Marco Polo describes a bridge, stone by stone. "But which is the stone that supports the bridge?"  Kublai Khan asks. "The bridge is not supported by one stone or another," Marco answers,    "but by the line of the arch that they form.” Kublai Khan remains silent, reflecting. Then he adds:  "Why do you speak to me of the stones? It is only the arch that matters to me.” Polo answers: "Without stones there is no arch."
  • 62. On Exactitude To my mind exactitude means three things above all: (1) a well-defined and well-calculated plan for the work in question; (2) an evocation of clear, incisive, memorable images; (3) a language as precise as possible both in choice of words and in expression of the subtleties of thought and imagination. - Italo Calvino