topic proposal: variables: globals, shared, private

Forum for discussion about the documentation project.
Post Reply
speedfixer
Posts: 606
Joined: Nov 28, 2012 1:27
Location: CA, USA moving to WA, USA
Contact:

topic proposal: variables: globals, shared, private

Post by speedfixer »

New programmer:
Everything declared in the main, everything shared. Simple.

Textbook programmer:
Everything encapsulated, nothing shared, everything referenced. SO MUCH to remember.

Enthusiastic programmer:
Everything pointered @. Can get to anything, anywhere, easily. So easy to segfault.

None of these are real-world for a decent sized program beyond a use-case test.

Every OS has a method to inject a variable into the global space. Globals are required.
Accessing root files from anywhere is just stupid.

What would be the rules one *could* use to find a balance?
Globals make life easier, but one shouldn't have to worry about every detail, all the time.

david
Post Reply