You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Some of the most-often repeated programming advice, especially to beginner programmers, is that they should be writing "clean" code. That moniker is accompanied by a long list of rules that tell you what you should do in order for your code to be "clean".
A large portion of these rules don't actually affect the runtime of the code that you write. These sorts of rules cannot be objectively assessed, and we don't necessarily have to because they're fairly arbitrary at that point. However, several "clean" code rules - some of the ones most emphatically stressed - are things we can objectively measure because they do affect the runtime behavior of the code.
If you look at a "clean" code summary and pull out the rules that actually affect the structure of your code, you get:
Prefer polymorphism to "if/else" and "switch"
Code should not know about the internals of objects it’s working with
Functions should be small
Functions should do one thing
"DRY" - Don’t Repeat Yourself
These rules are rather specific about how any particular piece of code should be created in order for it to be "clean". What I would like to ask is, if we create a piece of code that follows these rules, how does it perform?
speaker: Casey Muratori
topic: "Clean" Code, Horrible Performance
video: https://www.youtube.com/watch?v=tD5NrevFtbU
length: 22:40
Some of the most-often repeated programming advice, especially to beginner programmers, is that they should be writing "clean" code. That moniker is accompanied by a long list of rules that tell you what you should do in order for your code to be "clean".
A large portion of these rules don't actually affect the runtime of the code that you write. These sorts of rules cannot be objectively assessed, and we don't necessarily have to because they're fairly arbitrary at that point. However, several "clean" code rules - some of the ones most emphatically stressed - are things we can objectively measure because they do affect the runtime behavior of the code.
If you look at a "clean" code summary and pull out the rules that actually affect the structure of your code, you get:
These rules are rather specific about how any particular piece of code should be created in order for it to be "clean". What I would like to ask is, if we create a piece of code that follows these rules, how does it perform?
Follow-up: https://github.com/cmuratori/misc/blob/main/cleancodeqa.md
The text was updated successfully, but these errors were encountered: