Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Casey Muratori - "Clean" Code, Horrible Performance #231

Open
attilamagyaroi opened this issue Mar 6, 2023 · 0 comments
Open

Casey Muratori - "Clean" Code, Horrible Performance #231

attilamagyaroi opened this issue Mar 6, 2023 · 0 comments

Comments

@attilamagyaroi
Copy link

attilamagyaroi commented Mar 6, 2023

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:

  • 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?

Follow-up: https://github.com/cmuratori/misc/blob/main/cleancodeqa.md

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant