Explicit is better than implicit
The article highlights that explicit coding enhances readability and maintainability, reduces confusion, and improves collaboration by clearly defining variables and access controls, ultimately leading to better code quality.
Read original articleThe article emphasizes the importance of explicitness in coding, arguing that clear and well-defined code enhances readability and maintainability. The author, Trevor Lasn, illustrates how implicit coding can lead to confusion and increased difficulty in understanding code, particularly when hidden details are not clearly defined. For instance, using a hard-coded value like "10" without explanation can leave future developers puzzled about its purpose. In contrast, defining variables explicitly, such as using a "bonus" variable, clarifies the code's intent. The article also discusses access control in systems, highlighting how implicit permissions can create ambiguity. By using an explicit mapping of roles and permissions, developers can avoid confusion and make the code easier to manage. Lasn concludes that prioritizing explicitness over conciseness leads to better code quality, as it allows developers to understand the code's intentions more easily, facilitating collaboration and future updates.
- Explicit coding improves readability and maintainability.
- Implicit details can lead to confusion and increased difficulty in understanding code.
- Clear variable definitions enhance code clarity and intent.
- Explicit role and permission mappings prevent ambiguity in access control.
- Prioritizing explicitness fosters better collaboration among developers.
Related
Programmers Should Never Trust Anyone, Not Even Themselves
Programmers are warned to stay cautious and skeptical in software development. Abstractions simplify but can fail, requiring verification and testing to mitigate risks and improve coding reliability and skills.
Self Documenting Code Is Bullshit
Klaus Breyer challenges self-documenting code, advocating for external documentation to enhance precision and abstraction. He emphasizes the need for detailed information like variable units and invariants, promoting a balanced approach for code clarity.
Beyond Clean Code
The article explores software optimization and "clean code," emphasizing readability versus performance. It critiques the belief that clean code equals bad code, highlighting the balance needed in software development.
The Documentation Tradeoff
Kent Beck's article discusses the complexities of software documentation, emphasizing effective communication over excessive documentation. He critiques "self-documenting code" and the neo-waterfall approach, advocating for alternatives like discussions and tests.
The human typewriter, or why optimizing for typing is short-sighted
The article highlights the drawbacks of optimizing code for typing speed, advocating for readability and clarity over efficiency, as obfuscated code increases mental strain and confusion among developers.
You can certainly make that design decision, but I think my take of “explicit is better than implicit” is to let the server logs complain about invalid roles (and then rejecting access, even if a guest would’ve had access).
Related
Programmers Should Never Trust Anyone, Not Even Themselves
Programmers are warned to stay cautious and skeptical in software development. Abstractions simplify but can fail, requiring verification and testing to mitigate risks and improve coding reliability and skills.
Self Documenting Code Is Bullshit
Klaus Breyer challenges self-documenting code, advocating for external documentation to enhance precision and abstraction. He emphasizes the need for detailed information like variable units and invariants, promoting a balanced approach for code clarity.
Beyond Clean Code
The article explores software optimization and "clean code," emphasizing readability versus performance. It critiques the belief that clean code equals bad code, highlighting the balance needed in software development.
The Documentation Tradeoff
Kent Beck's article discusses the complexities of software documentation, emphasizing effective communication over excessive documentation. He critiques "self-documenting code" and the neo-waterfall approach, advocating for alternatives like discussions and tests.
The human typewriter, or why optimizing for typing is short-sighted
The article highlights the drawbacks of optimizing code for typing speed, advocating for readability and clarity over efficiency, as obfuscated code increases mental strain and confusion among developers.