DEV Community

Discussion on: Why are global variables bad?

Collapse
 
craser profile image
Grumpy

I think others have done a great job of talking about why global variables are bad, so I won't pile on.

But I do see a few "big picture" aspects of your question that are worth thinking about.

You seem to understand that you can get away with bad practices in small applications, but that they'll cause trouble in big ones. That's great. The next step is to remember always that every big application is a small application that grew, and every small application may one day be the old version of something huge. Healthy small applications grow into healthy big applications. Write your small applications so that they can grow strong and healthy.

Also, it seems you're early in your career. I enjoyed your post about why you love JavaScript. I love it too. :) For now, I urge you to become very fast and very good at doing things the right way. Seek tools that have good refactoring functionality built in, and study OOP Patterns and techniques nso that you'll have a toolbox of solutions handy and won't have to re-invent them each time you're faced with a complex problem.

I love that you're here, asking questions and really listening to the answers. Your enthusiasm and curiosity and openness will take you far!

Collapse
 
mervinsv profile image
Mervin

Thank you so much. I already have a year of experience in real projects and I'm still learning about refactoring and OOP patterns. I know that this topics are not easy to learn and that's why I'm here. Because I want to learn and get inputs from other developers.

Are there any tutorials or resources about refactoring and OOP Patterns that you could recommend?

Collapse
 
craser profile image
Grumpy

The classic Patterns book is Design Patterns: Elements of Reusable Object-Oriented Software. It's by no means exhaustive, but it's a great start.

And Twitter is a great place to find and follow great devs working on stuff you're interested in. Dig around, find a few people, follow them, see what they talk about and who they retweet, follow those people, repeat. Before long, you'll find amazing stuff in your timeline with links to CodePen, GitHub, etc, where you can see how people are doing things.

Cheers!