From 6e19d717e9c0209bd9e516de3bdf8897194f429a Mon Sep 17 00:00:00 2001 From: Julio Biason Date: Tue, 16 Jul 2019 12:36:31 -0300 Subject: [PATCH] New chapter: code style --- content/books/things-i-learnt/_index.md | 1 + .../things-i-learnt/code-formatters/index.md | 2 +- .../books/things-i-learnt/code-style/index.md | 26 +++++++++++++++++++ 3 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 content/books/things-i-learnt/code-style/index.md diff --git a/content/books/things-i-learnt/_index.md b/content/books/things-i-learnt/_index.md index e16cc49..5eb08fe 100644 --- a/content/books/things-i-learnt/_index.md +++ b/content/books/things-i-learnt/_index.md @@ -65,3 +65,4 @@ template = "section-contentless.html" * [The Right Tool Is More Obvious Than You Think](right-tool-obvious) * [Code Reviews Are Not For Style](code-reviews-style) * [Code Formatting Tools Are Ok, But No Silver Bullet](code-formatters) + * [Code Style: Follow It](code-style) diff --git a/content/books/things-i-learnt/code-formatters/index.md b/content/books/things-i-learnt/code-formatters/index.md index 75c54b5..3796e84 100644 --- a/content/books/things-i-learnt/code-formatters/index.md +++ b/content/books/things-i-learnt/code-formatters/index.md @@ -46,4 +46,4 @@ have the maturity and responsibility to watch yourself and be willing to fix and take responsibility for other people's code when the formatter changes their code. -{{ chapters(prev_chapter_link="/books/things-i-learnt/code-review-styles", prev_chapter_title="Code Reviews Are Not For Style") }} +{{ chapters(prev_chapter_link="/books/things-i-learnt/code-review-styles", prev_chapter_title="Code Reviews Are Not For Style", next_chapter_link="/books/things-i-learnt/code-style", next_chapter_title="Code Style: Follow It") }} diff --git a/content/books/things-i-learnt/code-style/index.md b/content/books/things-i-learnt/code-style/index.md new file mode 100644 index 0000000..75d25fa --- /dev/null +++ b/content/books/things-i-learnt/code-style/index.md @@ -0,0 +1,26 @@ ++++ +title = "Things I Learnt The Hard Way - Code Style: Follow It" +date = 2019-07-16 + +[taxonomies] +tags = ["en-au", "books", "things i learnt", "code style"] ++++ + +If your project have a defined code style, you must follow it. Sometimes it +may not be clear ("this struct/class should be singular or plural"?), but do +your best to follow it. + + + +If your project doesn't have a style, maybe it's time to pick one. There are +well established styles for almost every language today, so you can start with +that. You can even make your changes, but you need to realize that since it's +been established for a while, a lot of other people are using that style and, +thus, if you keep as is, your code will mesh better with the rest of the +ecosystem. + +And remember that even your stupid code is [part of the ecosystem of the +language](/books/things-i-learnt/languages-are-more) and the better you +interact with the ecosystem, the better citizen in the ecosystem you are. + +{{ chapters(prev_chapter_link="/books/things-i-learnt/code-formatters", prev_chapter_title="Code Formatting Tools Are Ok, But No Silver Bullet") }}