Skip to content

u/Quick_Humor_9023

In this archive from Mar 2023 to Jul 2025

0
posts
12
comments
0
media
49
score

Next you are going to tell me gotos are bad 😀

Ofcourse it’s nonsense, it’s school practise, the idea is to learn something. I was trying to point out you can even pretty much use same mental model by just using structs, which I assumed were allowed, and only basically lose encapsulation, which in a project like this doesn’t even matter much.

And the hill I die on: use whatever possibilities the language offers when that feature is the best way to do something. This includes globals, gotos, and multiple inheritance (for which I can’t even think an example where it would be the best solution, but there has to exist one, right?)

1 points

You’d hopefully only pass pointers anyways. Or skip even that and have a global datastructure with pointers to game obj.. umm data.

Or just have a global datastructure that models the whole game state, and functions to modify its state and to draw it.

Sure objects are usually pretty good fit for especially games, but they are hardly the only mental model you could use. They also hide state inside them, which isn’t purely a good thing. Also most of the benefits of encapsulation really only shine with teams of devs, when you have to protect your code from others who use it without knowing it.

1 points

End of this list.

Back to top

Keyboard shortcuts

Move and act

jork
Next / previous post or comment
Enteroro
Open the post
f
Open the media viewer
s
Save
h
Hide (the toast has Undo)
Tab
Right after an action: the toast's Undo
x
Collapse the comment
v
Next layout: cards, compact, grid

Go to

/
Search
gthenh
Home
gthena
All
gthens
Subreddits
gthenl
Library
?
This list
Esc
Close a menu or this list

In the viewer

←or→
Previous / next file
↑or↓
Previous / next post
korj
Previous / next post
Space
Play / pause
m
Mute
z
Zoom
s
Save
o
Open the post (on its own page: back to it)
Esc
Close

Keys do nothing while you type in a box.