Hey Alex,
Thanks for the extensive reply indeed. About your question on static class members, the fact of declaring them static doesn’t mean that their values will remain constant at all. Static fields are (when declared public, which is an OOP horror as this exposes data directly to the outside word, hence breaking up encapsulation) accessible without having to create instances of the originating class. Plus, it’s worth mentioning they maintain their state across multiple instances.
If you ever need to make your fields constant, then just use constants or simply appeal to plain old instance-level properties. As a rule of thumb, try to stay away from any “static” thing. OOP is all about objects, which means working with actual instances, not with classes, which are mere blueprints of them. Keep up the good work :)
↧
By: Alex Gervasio
↧