From 07a27c8fe62f6679465c11818eaa4b2a840ea9eb Mon Sep 17 00:00:00 2001 From: Julio Biason Date: Wed, 17 Jul 2019 11:05:10 -0300 Subject: [PATCH 1/5] New chapter: Clear units --- content/books/things-i-learnt/_index.md | 1 + .../things-i-learnt/config-file/index.md | 2 +- .../things-i-learnt/optimization/index.md | 3 +- content/books/things-i-learnt/units/index.md | 29 +++++++++++++++++++ 4 files changed, 32 insertions(+), 3 deletions(-) create mode 100644 content/books/things-i-learnt/units/index.md diff --git a/content/books/things-i-learnt/_index.md b/content/books/things-i-learnt/_index.md index 18b6072..df8079a 100644 --- a/content/books/things-i-learnt/_index.md +++ b/content/books/things-i-learnt/_index.md @@ -51,6 +51,7 @@ template = "section-contentless.html" * [Always Use Timezones With Your Dates](use-timezones) * [Always Use UTF-8 For Your Strings](use-utf8) * [Optimization Is For Compilers](optimization) + * [Units Makes Things Clear](units) * Making Things Go * [The Config File Is Friend](config-file) * [Command Line Options Are Weird, But Helpful](command-line-options) diff --git a/content/books/things-i-learnt/config-file/index.md b/content/books/things-i-learnt/config-file/index.md index 692736a..f6884a8 100644 --- a/content/books/things-i-learnt/config-file/index.md +++ b/content/books/things-i-learnt/config-file/index.md @@ -52,4 +52,4 @@ you'll find that you're half-way through it. [^1]: In other words, they have a [time to live](https://en.wikipedia.org/wiki/Time_to_live). -{{ chapters(prev_chapter_link="/books/things-i-learnt/optimization", prev_chapter_title="Optimization Is For Compilers", next_chapter_link="/books/things-i-learnt/command-line-options", next_chapter_title="Command Line Options Are Weird, But Helpful") }} +{{ chapters(prev_chapter_link="/books/things-i-learnt/units", prev_chapter_title="Units Makes Things Clear", next_chapter_link="/books/things-i-learnt/command-line-options", next_chapter_title="Command Line Options Are Weird, But Helpful") }} diff --git a/content/books/things-i-learnt/optimization/index.md b/content/books/things-i-learnt/optimization/index.md index 333e36a..576bb28 100644 --- a/content/books/things-i-learnt/optimization/index.md +++ b/content/books/things-i-learnt/optimization/index.md @@ -35,5 +35,4 @@ Code is written for humans to read. _ALWAYS_. Optimization is what compilers do. So find a smarter way to explain what you're trying to do instead of using shorter words or messing with that your code is saying. -{{ chapters(prev_chapter_link="/books/things-i-learnt/use-utf8", prev_chapter_title="Always Use UTF-8 For Your Strings", next_chapter_link="/books/things-i-learnt/config-file", next_chapter_title="The Config File Is Friend") }} - +{{ chapters(prev_chapter_link="/books/things-i-learnt/use-utf8", prev_chapter_title="Always Use UTF-8 For Your Strings", next_chapter_link="/books/things-i-learnt/units", next_chapter_title="Units Makes Things Clear") }} diff --git a/content/books/things-i-learnt/units/index.md b/content/books/things-i-learnt/units/index.md new file mode 100644 index 0000000..9537884 --- /dev/null +++ b/content/books/things-i-learnt/units/index.md @@ -0,0 +1,29 @@ ++++ +title = "Things I Learnt The Hard Way - Units Makes Things Clear" +date = 2019-07-17 + +[taxonomies] +tags = ["en-au", "books", "things i learnt", "units", "explicit"] ++++ + +You know what's one of the worst function names ever? `sleep()`. + +Sleep for how long? It is seconds or milliseconds? + + + +Now let me ask you this: Would it clearer if the function was called +`sleepForMs()`? Would you understand that the function would make the +application sleep for a number of milliseconds? + +What about `sleepForSecs()`? Do you understand that this will force your +application to sleep for a number of seconds? + +What if, instead of using the function name, you could use `sleep("10s")`? Does +it make clear that you want it to sleep for 10 seconds? + +That's why adding units to the function or parameters make sense. It removes +the ambiguity of what it means and doesn't rely on some specialized IDE/Editor +that display the parameter names. + +{{ chapters(prev_chapter_link="/books/things-i-learnt/optimization", prev_chapter_title="Optimization Is For Compilers", next_chapter_link="/books/things-i-learnt/config-file", next_chapter_title="The Config File Is Friend") }} From 4f022094c7f0e4694c424ea94eb286315120f411 Mon Sep 17 00:00:00 2001 From: Julio Biason Date: Wed, 17 Jul 2019 11:06:17 -0300 Subject: [PATCH 2/5] Added a few examples of styles one could use --- content/books/things-i-learnt/code-style/index.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/content/books/things-i-learnt/code-style/index.md b/content/books/things-i-learnt/code-style/index.md index 62b814c..68124a8 100644 --- a/content/books/things-i-learnt/code-style/index.md +++ b/content/books/things-i-learnt/code-style/index.md @@ -23,4 +23,10 @@ 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. +**TIP**: If you don't have a code style yet, and you're using a language +that's derived from C or C++, use [K&R +Style](https://en.wikipedia.org/wiki/Indentation_style#K&R_style); if you're +working with Python, there is only one style: +[PEP8](https://www.python.org/dev/peps/pep-0008/). + {{ chapters(prev_chapter_link="/books/things-i-learnt/code-formatters", prev_chapter_title="Code Formatting Tools Are Ok, But No Silver Bullet", next_chapter_link="/books/things-i-learnt/google-code-style", next_chapter_title="... Unless That Code Style Is The Google Code Style") }} From 7fac6c51ea2d49fded3f2990119cb26ccf73c740 Mon Sep 17 00:00:00 2001 From: Julio Biason Date: Wed, 17 Jul 2019 11:34:40 -0300 Subject: [PATCH 3/5] New chapter: specialists vs generalists --- content/books/things-i-learnt/_index.md | 2 + .../google-code-style/index.md | 2 +- .../things-i-learnt/specialists/index.md | 43 +++++++++++++++++++ 3 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 content/books/things-i-learnt/specialists/index.md diff --git a/content/books/things-i-learnt/_index.md b/content/books/things-i-learnt/_index.md index df8079a..3299e6b 100644 --- a/content/books/things-i-learnt/_index.md +++ b/content/books/things-i-learnt/_index.md @@ -68,3 +68,5 @@ template = "section-contentless.html" * [Code Formatting Tools Are Ok, But No Silver Bullet](code-formatters) * [Code Style: Follow It](code-style) * [... Unless That Code Style Is The Google Code Style](google-code-style) +* Personal + * [Companies Look For Specialists But Keep Generalists Longer](specialists) diff --git a/content/books/things-i-learnt/google-code-style/index.md b/content/books/things-i-learnt/google-code-style/index.md index 953ef12..db4c93d 100644 --- a/content/books/things-i-learnt/google-code-style/index.md +++ b/content/books/things-i-learnt/google-code-style/index.md @@ -16,4 +16,4 @@ The only reason to use Google Code Style is in case someone less smart than you decided it would be a good idea to use it. Then, I feel sorry for you, but you'll have to follow Google Code Style. -{{ chapters(prev_chapter_link="/books/things-i-learnt/code-style", prev_chapter_title="Code Style: Follow It") }} +{{ chapters(prev_chapter_link="/books/things-i-learnt/code-style", prev_chapter_title="Code Style: Follow It", next_chapter_link="/books/things-i-learnt/google-code-style", next_chapter_title="... Unless That Code Style Is The Google Code Style") }} diff --git a/content/books/things-i-learnt/specialists/index.md b/content/books/things-i-learnt/specialists/index.md new file mode 100644 index 0000000..d0c83d0 --- /dev/null +++ b/content/books/things-i-learnt/specialists/index.md @@ -0,0 +1,43 @@ ++++ +title = "Things I Learnt The Hard Way - Companies Look For Specialists But Keep Generalists Longer" +date = 2019-07-17 + +[taxonomies] +tags = ["en-au", "books", "things i learnt", "jobs", "specialists", "generalists"] ++++ + +If you know a lot about one single language, it may make it easier to get a +job, but in the long run, language usage dies or loses its charms and you'll +need to find something else. Knowing a bit about a lot of other languages +helps in the long run, not to mention that may help you think of better +solutions. + + + +Even if you're in a shop that is mainly in one single language, that's no +excuse to not check other languages. But, then again, learning languages that +are just small changes on the current language would not help you either. + +Alan Perlis, author of the ALGOL language, has one excellent phrase: "A +language that doesn't affect the way you think about programming, is not worth +knowing." + +I still maintain one single rule for programming languages: The language I use +at work must not be the same language I use outside it[^1]. That simple rule +made sure I was always learning something new. + +Learning a new language can also help you understand things in some language +you used before: Rust help me understand how generics works in Java; seeing +how to do dependency injection in C++ help me understand how Spring does it in +Java. + +On top of that, because I was always learning something new, moving between +projects was something that happened a lot. At one point, I was hired to work +with Python, but the contract was taking too long to be signed, and my manager +asked if I could help some other team with their iOS application. Because I +did learn a bit about Objective-C, surely I could help. Later, another project +in C show up and guess who also knew C? + +[^1]: ... which led me into some sad times when I was working with Python. + +{{ chapters(prev_chapter_link="/books/things-i-learnt/google-code-style", prev_chapter_title="... Unless That Code Style Is The Google Code Style") }} From 1d431256bbceb355ed633c323e47f761e86c282d Mon Sep 17 00:00:00 2001 From: Julio Biason Date: Wed, 17 Jul 2019 13:38:13 -0300 Subject: [PATCH 4/5] New chapter: user privacy --- content/books/things-i-learnt/_index.md | 1 + .../books/things-i-learnt/debuggers/index.md | 2 +- .../integration-tests/index.md | 2 +- content/books/things-i-learnt/users/index.md | 35 +++++++++++++++++++ 4 files changed, 38 insertions(+), 2 deletions(-) create mode 100644 content/books/things-i-learnt/users/index.md diff --git a/content/books/things-i-learnt/_index.md b/content/books/things-i-learnt/_index.md index 3299e6b..fe7dbb1 100644 --- a/content/books/things-i-learnt/_index.md +++ b/content/books/things-i-learnt/_index.md @@ -19,6 +19,7 @@ template = "section-contentless.html" * [Learn The Basics of Functional Programming](functional-programming) * [Shortcuts Are Nice, But Only In The Short Run](understand-shortcuts) * [Debuggers Are Overrated](debuggers) + * [Think About The Users](users) * Testing Software * [Unit Tests Are Good, Integration Tests Are Gooder](integration-tests) * [Testing Every Function Creates Dead Code](tests-dead-code) diff --git a/content/books/things-i-learnt/debuggers/index.md b/content/books/things-i-learnt/debuggers/index.md index 5acb618..20b3343 100644 --- a/content/books/things-i-learnt/debuggers/index.md +++ b/content/books/things-i-learnt/debuggers/index.md @@ -37,4 +37,4 @@ Again, I'm not taking the merits of debuggers, but in the long run, they are mostly useless and actually point missing surrounding support to actually understand what's going on. -{{ chapters(prev_chapter_link="/books/things-i-learnt/understand-shortcuts", prev_chapter_title="Shortcuts Are Nice, But Only In The Short Run", next_chapter_link="/books/things-i-learnt/integration-tests", next_chapter_title="Unit Tests Are Good, Integration Tests Are Gooder") }} +{{ chapters(prev_chapter_link="/books/things-i-learnt/understand-shortcuts", prev_chapter_title="Shortcuts Are Nice, But Only In The Short Run", next_chapter_link="/books/things-i-learnt/users", next_chapter_title="Think About The Users") }} diff --git a/content/books/things-i-learnt/integration-tests/index.md b/content/books/things-i-learnt/integration-tests/index.md index 9e0e6ef..d6a2e62 100644 --- a/content/books/things-i-learnt/integration-tests/index.md +++ b/content/books/things-i-learnt/integration-tests/index.md @@ -72,4 +72,4 @@ of moving parts. [^2]: Again, it's pure feeling from my experience. I have no data to back that affirmation up, so take it with a grain of salt. -{{ chapters(prev_chapter_link="/books/things-i-learnt/debuggers", prev_chapter_title="Debuggers Are Overrated", next_chapter_title="Testing Every Function Creates Dead Code", next_chapter_link="/books/things-i-learnt/tests-dead-code") }} +{{ chapters(prev_chapter_link="/books/things-i-learnt/users", prev_chapter_title="Think About The Users", next_chapter_title="Testing Every Function Creates Dead Code", next_chapter_link="/books/things-i-learnt/tests-dead-code") }} diff --git a/content/books/things-i-learnt/users/index.md b/content/books/things-i-learnt/users/index.md new file mode 100644 index 0000000..e89601f --- /dev/null +++ b/content/books/things-i-learnt/users/index.md @@ -0,0 +1,35 @@ ++++ +title = "Things I Learnt The Hard Way - Think About The Users" +date = 2019-07-17 + +[taxonomies] +tags = ["en-au", "books", "things i learnt", "privacy"] ++++ + +Think how the data you're collecting from your users will be used -- this is +more prevalent on these days, where "privacy" is a premium. + + + +I once had a discussion with a CTO about collecting the user IMEI on our +mobile app. Basically, there was no use case for capturing that information +yet but, as he put at the time, "We may want to know if one user uses two +phones, or if two users use the same phone". I raised the fact that we didn't +need this information and, besides that, it felt like we were invading the +users privacy. He still decided to go ahead. My answer: "I'll do it, but I +want to point that I'm not happy with it." + +In the end, the store blocked the app... because we were capturing the IMEI. + +But there are cases and cases. If you really _really_ need to capture user +information, be sure to protect it against unauthorized use, be it by external +forces (someone found a way to attack your data) or internal (some disgruntled +colleague decided to take the data from your users with them). + +And be sure, there _will_ be a leak at some point, it's just a matter of time. +If you can, the best way to protect your users data is to never capture it. +When a flaw on your system is found or when some colleague leaves the company +in bad terms, there will be no data to expose to the world, anyway. You can't +be more secure than this. + +{{ chapters(prev_chapter_link="/books/things-i-learnt/debuggers", prev_chapter_title="Debuggers Are Overrated", next_chapter_link="/books/things-i-learnt/integration-tests", next_chapter_title="Unit Tests Are Good, Integration Tests Are Gooder") }} From d38dab99d75383024ab5dc32c23729808d76d091 Mon Sep 17 00:00:00 2001 From: Julio Biason Date: Wed, 17 Jul 2019 13:52:06 -0300 Subject: [PATCH 5/5] New chapter: stupid bug list --- content/books/things-i-learnt/_index.md | 1 + .../things-i-learnt/specialists/index.md | 2 +- .../things-i-learnt/stupid-bugs-list/index.md | 24 +++++++++++++++++++ 3 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 content/books/things-i-learnt/stupid-bugs-list/index.md diff --git a/content/books/things-i-learnt/_index.md b/content/books/things-i-learnt/_index.md index fe7dbb1..2a62fa5 100644 --- a/content/books/things-i-learnt/_index.md +++ b/content/books/things-i-learnt/_index.md @@ -71,3 +71,4 @@ template = "section-contentless.html" * [... Unless That Code Style Is The Google Code Style](google-code-style) * Personal * [Companies Look For Specialists But Keep Generalists Longer](specialists) + * [Keep A List of Stupid Bugs That Took More Than 1 Hour To Solve](stupid-bugs-list) diff --git a/content/books/things-i-learnt/specialists/index.md b/content/books/things-i-learnt/specialists/index.md index d0c83d0..d5bb30c 100644 --- a/content/books/things-i-learnt/specialists/index.md +++ b/content/books/things-i-learnt/specialists/index.md @@ -40,4 +40,4 @@ in C show up and guess who also knew C? [^1]: ... which led me into some sad times when I was working with Python. -{{ chapters(prev_chapter_link="/books/things-i-learnt/google-code-style", prev_chapter_title="... Unless That Code Style Is The Google Code Style") }} +{{ chapters(prev_chapter_link="/books/things-i-learnt/google-code-style", prev_chapter_title="... Unless That Code Style Is The Google Code Style", next_chapter_link="/books/things-i-learnt/stupid-bugs-list", next_chapter_title="Keep A List of Stupid Bugs That Took More Than 1 Hour To Solve") }} diff --git a/content/books/things-i-learnt/stupid-bugs-list/index.md b/content/books/things-i-learnt/stupid-bugs-list/index.md new file mode 100644 index 0000000..754994f --- /dev/null +++ b/content/books/things-i-learnt/stupid-bugs-list/index.md @@ -0,0 +1,24 @@ ++++ +title = "Things I Learnt The Hard Way - Keep A List of Stupid Bugs That Took More Than 1 Hour To Solve" +date = 2019-07-17 + +[taxonomies] +tags = ["en-au", "books", "things i learnt", "lists", "stupid bugs"] ++++ + +If it took you more than one hour for you to figure out what went wrong, it is +a good idea to put it on list, 'cause these things have the tendency to appear +again. + + + +I must admit that this is one thing that I should be doing, but I keep +forgetting. The worst part: It usually takes me about an hour to figure out +what went wrong, only to realize by the solution that I had the same problem +(with the same solution) before and it took me about one hour to figure out +what went wrong. + +If I just had a list of stupid bugs that took me about 1 hour or more to +solve, I wouldn't be stuck for another hour figuring out what went wrong. + +{{ chapters(prev_chapter_link="/books/things-i-learnt/specialists", prev_chapter_title="Companies Look For Specialists But Keep Generalists Longer") }}