This content originally appeared on DEV Community and was authored by DEV Community
You can use code whenever you want. Programmers often joke that they’ll take 20 hours to code something that would have taken them only 20 minutes to do. Imagine the person who programmed the robot vacuum.
Does it make sense, timewise?
Personally, I’d count how often I do it, estimate how long it would take to automate or code the thing, then see if the hours programming is going worth the effort. For example, if it takes 10 minutes to do dishes and you have to do it every day that would be 3650 hours per year. Would 100s hours of programming be worth coaxing a computer to do dishes for you?
Xkcd.com made this chart to show how much time is saved by automating something. Let’s look at making an automatic cat snack dispenser. Let’s say it takes 5 seconds to open a bag of treats and give them to the cat. We’ll also say you give the cat some snacks 1 time per week. The snack dispenser would cut 5 seconds from your snack process because you don’t have to do it anymore. This chart shows that over 5 years, our cat snack dispenser would only save 2 hours. Is it worth it? That’s up to you. It probably depends on how long it would take to code the snack dispenser and how demanding your cat is.
Going back to the dishes example, after programming a computer to do dishes, it now only takes 5 minutes. So, 5 minutes have been shaved off of the time it takes to do the daily task. This would save 6 days over 5 years. Is it worth it? That’s up to you. Though, it may depend on how long it takes to code this automatic dish washing machine.
Typically, when the gain from your code is more than your loss, get to coding.
An exception to the rule
When we are learning, this may be a little different. You’re also gaining a better understanding of code every time you use code to do something. In this case, you would gain the benefit of the code and the knowledge on how to do the things you learned to build that code. So, it may very well be worth building that automatic cat snack dispenser even if it doesn’t fit my gain > loss
rule. The cat would really appreciate it.
This content originally appeared on DEV Community and was authored by DEV Community
DEV Community | Sciencx (2021-11-12T21:12:39+00:00) When should I use code?. Retrieved from https://www.scien.cx/2021/11/12/when-should-i-use-code/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.