You shouldn't use global variables! programming practices to avoid (1) #shorts

preview_player
Показать описание
LOL variables provide sleeker code and improved readability 📜✨
But don't count global variables out just yet! 🤨
⠀⠀⠀⠀⠀⠀⠀⠀
🔍 Global variables have their purpose, but if you're not careful when using them, there are potential pitfalls such as unintended side effects, name clashes, reduced readability, debugging complexity, testing difficulties, scalability and maintainability, thread safety, and difficulty in refactoring.

Experience the power of practical learning, gain career-ready skills, and start building real applications!
This is a step-by-step course designed to take you from beginner to expert in no time!
💰 Here is a coupon to save 10% on your first payment (CODEBEAUTY_YT10).
Use it quickly, because it will be available for a limited time.

📚 Learn how to solve problems and build projects with these Free E-Books ⬇️

Add me on other platforms for more educational content:
Рекомендации по теме
Комментарии
Автор

📚 Learn programming with these Free E-Books ⬇
Experience the power of practical learning, gain career-ready skills, and start building real applications!
This is a step-by-step course designed to take you from beginner to expert in no time!
💰 Here is a coupon to save 10% on your first payment (CODEBEAUTY_YT10).
Use it quickly, because it will be available for a limited time.

CodeBeauty
Автор

In embedded systems programming, using global variables is a more advantageous approach as it allows for greater efficiency with limited RAM, as long as variable names are kept distinct.

abdullahozdemir
Автор

For someone with experience its dangerous to blindly follow what someone tells you on a youtube short. Its depends on the context and real world code is different from an academic exercise.

mondo
Автор

you can combine any globals needed into a single global struct or class. you can then make special methods to read or modify the globals. globals are needed and more efficient in many cases. you just need to learn how to use them

mazthespaz
Автор

Your voice remember me of first days of learning c++. THANK YOU SO MUCH

medmath
Автор

I have always heard this, but when I looked under the hood of a SNOW page, the JS started with a header that was at least 50 Var gWhatEver in a row. And this is a major program in Telecommunications.

trlavalley
Автор

I usually keep settings for my application in global variables. They are used all the time, but the only time they are change is if you go to my application settings GUI. Depending on what the application is doing, I may provide a warning about making changes to settings.

colinmaharaj
Автор

"unexpected results" aka I don't know what I am talking about so here is some fud.

Never listen to someone who tells you what you want to do if they can't give you a specific reason that affects you.

redavni
Автор

Loving your content saldina ❤️❤️,
I wanna ask u when your practical programing course will be launched?
i am waiting impatiently...🥰

NayaEmail-bnup
Автор

Well, this is not very detailed as global variables have their use cases. And i think you might be talking about language specific practices.

realSeyitan
Автор

In the screenshot it looks like c# and c# variables cannot be defined outside of a class so these aren't global variables they are class variable... Which are totally ok to use.

They would need the static keyword to be global.

Marc-gjvx
Автор

Can you post this as a short instead of a regular video?

garcj
Автор

in some cases it is not possible to avoid global variables e.g. Microcontroller programming handling Interrupts

derkeiler
Автор

*Global variables are declared outside functions - potentially unexpected behaviours. ALWAYS use Local variables. Good note*
*anymore tips for C++ programmers or programming in general? (to avoid unexpected errors/glitches) thx*

TAREEBITHETERRIBLE
Автор

I get you Saldina, thanks for your tutorials 😍👍

kennedymbwambo
Автор

Here I come across your channel again. Thanks you so very much Saldina. Words can not express how thankful I am to you. About two years ago I watched your learn c++ in 8 hours video and since then I've done many things that I had always wanted to do for long. I don't know where I would've been if I hadn't came across that video of yours. Thanks alot, god bless you :).

greatplays
Автор

Good practice overall. But there's no always or never in programming. Globals are sometimes the only option that we have. One example is when you want to register a function that needs to be called before exiting the program (using std::atexit()) and the function that is passed to std::atexit() cannot take any arguments so if you want to access some data like an error code from within that function there's no other way of doing it than extern variables.

ohwow
Автор

How about global state and db? This is literally the same

pepperonin
Автор

Kindly make a complete python programming course from zero to master level!

mohibullah
Автор

Please make video on DBMS with animation

Relaxingmusic-nkpy