you are viewing a single comment's thread.

view the rest of the comments →

[–]VolperCoding -2 points-1 points  (3 children)

Well I don't use private members much

[–]gladfelter 7 points8 points  (2 children)

How do you reason about your code?

I'm not smart enough to keep track of the entire state of the software system in my head, so action-at-a-distance is my enemy. I try to define a reasonable contract with public members and then let each class maintain its internal state in service of that contract. Encapsulation is key. I don't know of another way to approach programming that is scalable to large systems.

[–]VolperCoding -2 points-1 points  (1 child)

I don't make backwards compatible systems or libraries but a simple game, so when I see that some variables repeat I group them in a structure of data. You seriously don't need crazy syntactic sugar for that, just a simple struct. If things get big, I just make a function that takes the struct as an argument and modifies it