Day 54 / 100 Days of Code: Lessons on Scope

Sat, August 24, 2024

Today’s lesson was all about scope, which is incredibly important in programming. We definitely don’t want our data to be unintentionally rewritten by a function!

A conversation with a senior developer got me thinking about the u…


This content originally appeared on DEV Community and was authored by Jacob Stern

Sat, August 24, 2024

Today’s lesson was all about scope, which is incredibly important in programming. We definitely don’t want our data to be unintentionally rewritten by a function!

A conversation with a senior developer got me thinking about the use of global variables. He'd mentioned that there are times when he uses them, which piqued my curiosity. So, I asked Perplexity AI about how often software companies follow best practices regarding local or block scope. It turns out global variables are sometimes used in legacy code, quick prototyping, to avoid refactoring complex code structures, for configuration variables, and for thread-safe storage. These insights were really insightful!

Even better, the AI discussed the tradeoffs and concerns associated with using global variables. One interesting point was about code reviews. I learned that code reviews are nearly continuous and performed at all levels as part of ongoing quality control. They can be very comprehensive, which makes sense intuitively but was new to me.

Despite some unrelated tasks that popped up, I managed to stay productive. Overall, it was a great day of learning!

backend developers meme


This content originally appeared on DEV Community and was authored by Jacob Stern


Print Share Comment Cite Upload Translate Updates
APA

Jacob Stern | Sciencx (2024-08-24T07:56:32+00:00) Day 54 / 100 Days of Code: Lessons on Scope. Retrieved from https://www.scien.cx/2024/08/24/day-54-100-days-of-code-lessons-on-scope/

MLA
" » Day 54 / 100 Days of Code: Lessons on Scope." Jacob Stern | Sciencx - Saturday August 24, 2024, https://www.scien.cx/2024/08/24/day-54-100-days-of-code-lessons-on-scope/
HARVARD
Jacob Stern | Sciencx Saturday August 24, 2024 » Day 54 / 100 Days of Code: Lessons on Scope., viewed ,<https://www.scien.cx/2024/08/24/day-54-100-days-of-code-lessons-on-scope/>
VANCOUVER
Jacob Stern | Sciencx - » Day 54 / 100 Days of Code: Lessons on Scope. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2024/08/24/day-54-100-days-of-code-lessons-on-scope/
CHICAGO
" » Day 54 / 100 Days of Code: Lessons on Scope." Jacob Stern | Sciencx - Accessed . https://www.scien.cx/2024/08/24/day-54-100-days-of-code-lessons-on-scope/
IEEE
" » Day 54 / 100 Days of Code: Lessons on Scope." Jacob Stern | Sciencx [Online]. Available: https://www.scien.cx/2024/08/24/day-54-100-days-of-code-lessons-on-scope/. [Accessed: ]
rf:citation
» Day 54 / 100 Days of Code: Lessons on Scope | Jacob Stern | Sciencx | https://www.scien.cx/2024/08/24/day-54-100-days-of-code-lessons-on-scope/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.