2. Why Writing Clean Code Matters
• Code is like a joke, if you have to explain it, it´s bad;
• “Any fool can write code that a computer can understand, good
programmers write code that humans can understand” (Martin Fowler)
3. Reason to Write Clean Code
• Clean Code practices will get you to the point that you are both, clean and
fast in your development;
4. Developers are Authors
• Definition of an author most certainly includes developers and great
authors are know for writing books that tell a clear, compelling history.
They use tools like chapters, headings, and pharagraphs to clearly
organize their thoughts and painlessly guide their reader, there are many
parallels for developers who work in a rather comparable system, but with
different jargon of namespaces, classes and methods ;
5. Principles for selecting the right tool for the job
• Boundaries matter, stay native!: each technology has a specific porpouse;
• Every tech is potentially evil: every technology has its niche and limits;
• Maximize signal to noise: The code should not be excessivively wordy,
expressive. It´s clear what the code is trying to do, and finally, the code should
do one thing, it should have clear responsability and should do one thing well;
• DRY: don´t repeat yourself !
• Self-document code: Documentation is all about code in such an expressive
and clear style that the author´s intent is obvious, so obvious that new
developers joining the team can easily navigate and read the code to get up to
speed;
6. Key factors for writing Clean Code
• Naming;
• Avoid side effects;
• Avoid abreviations;
• Naming Variables;
• Strive for symmetry;
7. Writing Conditionals That Convey Intent
Best Practices
• Boolean comparisons;
• Boolean assignments;
• Prefer positive Conditionals;
• Ternaries are beautiful;
• Be strongly typed;
• Avoid magic numbers;
• Handling complex numbers;
• Prefer polymorphism over Enums;
• Be declarative;
• Table Driven Methods;