DEV Community

Discussion on: Why should one use multiple Variables when you could store everything in an array?

Collapse
 
technoplato profile image
Michael Lustig - halfjew22@gmail.com

Hey Morris, I'm loving Tyler's analogy about cleaning your room.

Another approach I find helpful before I've really developed a deep understanding of a concept is to just try out what I'm thinking. I find it's the best way to learn. Make the mistakes yourself, and the lessons will stick around in your memory much longer than if someone explains them to you.

So, give arrays a try. Try creating one array per program and see how it feels and works for you.

Perhaps even look into "functional" programming where (WARNING: HAND WAVY EXPLANATION UPCOMING) the program runs as an "array" of commands one by one.

Write back in a week with some of your thoughts about just using arrays. It's definitely an interesting idea, and isn't too far from what the computer is doing underneath the covers. Most would likely just find it easier to take the time and sort everything into its proper spot, but you could be different!