DEV Community

Sergiu Mureşan
Sergiu Mureşan

Posted on • Edited on

Why are you actually using variables?

When to use variables? It feels natural to instantiate a variable when needed, but we usually don't think of the reason behind it. I am presenting 4 most prevalent reasons:

  • Readability
  • Abstraction
  • Performance
  • Maintainability

I know this subject is a little sensitive but, in order for us to be able to create good coding standards we need to understand the reason behind it.

If you don't agree with any of the answers in this video, you think I missed some more important ones or you have some suggestions to better exemplify them please do comment down below.

Shout out to

for suggesting we use an IDE for presentation, I really like the way it turned out (What do you guys think?)

Top comments (7)

Collapse
 
codevault profile image
Sergiu Mureşan

Of course. I can't possibly be considering every single language in existence when discussing about such topics therefore I am limiting them to the top few that are being used in the industry.

Collapse
 
codevault profile image
Sergiu Mureşan

Sorry if it came out that way.

I made this video because I saw that many programmers were using variables haphazardly in a manner that made code overly complicated.

The video is made for the purpose of thinking more deeply when creating new variables. "How can I pass this data around?", "Oh, nevermind, I will just make a variable for it". No. That's not how you should do it.

In this video I am giving 4 valid reasons to use variables (surely there are more, but these should encompass most of the use cases).

Collapse
 
dhnaranjo profile image
Desmond Naranjo

What a weird reply.

It feels natural to keep your phone in your pockets.

"If your clothes have pockets, that is."

Yes. Definitely.

 
codevault profile image
Sergiu Mureşan • Edited

Sure...

  • Readability
  • Abstraction
  • Performance
  • Maintainability

I added them to the post as well.

I don't understand what is wrong with the video though. Can you explain, please?

Thread Thread
 
defman profile image
Sergey Kislyakov

There's nothing wrong with videos, some human beings just don't have enough time to watch them and prefer the transcription of the video (myself as well).

Thread Thread
 
codevault profile image
Sergiu Mureşan

Alright, I will implement a summary of the video in my posts from now on. The more people understand how important clean code is, the better.

Thanks for the feedback!