Tanelxen Posted July 4, 2013 Share Posted July 4, 2013 Why all the members of Leadwerks classes are placed in the public section? What about encapsulation? Quote Link to comment Share on other sites More sharing options...
Josh Posted July 4, 2013 Share Posted July 4, 2013 When I put things in the private section, I usually end up needing them somewhere else in the engine sooner or later, so I just make everything public. It's based on the assumption the programmer isn't going to go changing random members for fun, Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
ZioRed Posted July 4, 2013 Share Posted July 4, 2013 It's based on the assumption the programmer isn't going to go changing random members for fun, ehm.... I'm sorry for what I'm saying now, but your sentence is just bad programming and I bet you know (especially talking about C++ programming) You should never trust the developer who will use the library, it's definitely evil and a robust library will never allow the developer to mess its functions. You should make better use of getter (and setter where appliable) methods if you need access from elsewhere (or protected members to be used in the inherited classes)... PS: notice, I'm not saying you're a bad programmer, I'm saying this particular sentence is very bad programming. However I agree with Tanelxen about this topic. 1 Quote ?? FRANCESCO CROCETTI ?? http://skaredcreations.com Link to comment Share on other sites More sharing options...
Tanelxen Posted July 4, 2013 Author Share Posted July 4, 2013 Well... It's not bad for the developer of engine. He knows how it works. But it can be a nightmare for a programmer who has purchased a license. Quote Link to comment Share on other sites More sharing options...
Josh Posted July 4, 2013 Share Posted July 4, 2013 I think that's more than a little exaggeratory. Follow the documentation and you'll be fine. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
AggrorJorn Posted July 6, 2013 Share Posted July 6, 2013 Well... It's not bad for the developer of engine. He knows how it works. But it can be a nightmare for a programmer who has purchased a license. How so? I agree with encapsulation as much as possible tough. I think it looks more professional, but everyone is free to use however they want. Take the volume member for instance: You can use SetVolume() and GetVolume, but you might as well just use the Sound.volume member. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.