A lot of overcomplicated answers here…
Example:
I give you a box and ask you to deliver it to the house across the street. You can either A) just walk across the street with the box, or B) you can spend a bunch of time to find car keys, load the box into the car, drive the car across the street, and finally unload the box.
Option A is faster and easier to accomplish, because it’s just one box. Now imagine the same scenario but with ten boxes. Since you can load all ten boxes into the car at one time, option B becomes faster than walking across the street 10 times, even though option B is more complicated.
>Are people sitting there changing lines of code to more “optimal” ones?
In short: Yes
Programmers may start with poorly optimized code which is easy to write, and then later go back and make highly optimized code which is harder to write.
Latest Answers