Imperative vs Declarative
There are these two different approaches to writing programs. Imperative and declarative.
I keep forgetting what they are, so I’m going to make an easy example for myself.
Stick your right arm out in front of you. Bend your elbow 45 degrees. To the left. Now turn your wrist about 45 degrees towards yourself. I you have a watch. Please tell me the time.
That is imperative programming.
Hey, you. Please tell me the time. Thank you.
And thats Declarative.
Which one would you prefer to see when you read code? And what about 6 months later, when you come back?