Comments (3)
I believe it would be wrong design to do that.
Please see positron96@6192c88#commitcomment-2457504 , it is very exemplary. This issue shows the weak point of the GetAttribute approach - it is implementation-specific, it takes the value from table entity_attriutes
and that's all. If, for some reason, the needed attribute is in another place, this method will not succeed.
Specific methods, on the other hand, can do whatever code they want, read other database tables, calculate the values on the fly, use some cache mechanism. Specific setter methods can enforce additional checks on the data that user want to store, that would not be appropriate in general SetAttribute method.
Code that uses those specific methods does not care about where are those attributes and how are they obtained, it just calls quanity() and let the method do its magic.
This specific quantity() method cannot be switched to GetAttribute because quantity is not in the attributes table, it's in entity table, as are many properties of other objects.
Generally, that is the whole point of object-oriented language - to hide incapsulated implemetation details and let using code get abstracted from that implementation.
Actually, I've started doing quite the opposite: I'm rewriting Skill
class to contain methods like uint8 GetLevel()
in positron96@dda76b3 . The only thing it does is call GetAttribute(attrSkillLevel), but it improves usage pattern of the class, makes the code more readable, and, as I said, removes implementation-bindind from code that uses it. I could insert checks in SetLevel() method to make sure level is correct, <=5 for example. I could not do that with SetAttribute approach.
from evemu_server.
I think positron has a VERY good point here and I've felt this for quite a while, just never was able to put it in such stark descriptive words as this implementation-binding exposure, but he's right. Requiring or even exposing the SetAttribute or GetAttribute exposes access directly to the attributes of an item. What that does is take from the owning class the ability to control access to those attributes and manage them internally whilst providing item type appropriate direct calls, as he suggested with SetLevel() on a skill object.
We need more discussion on this to consider possibly expanding the direct calls on all objects and forever hiding the direct Set/Get Attribute access calls that can be made from outside the item class. Perhaps they should be internally accessible only.
-- Aknor
from evemu_server.
this has been updated as part of the major rewrite.
any further discussion should open a new ticket.
from evemu_server.
Related Issues (20)
- Agents, Missions and Creating Characters HOT 4
- Need Advice with error C1189 compiling with MVSC++2013. HOT 6
- I want to contribute. HOT 5
- eve-collector HOT 3
- Revamp singletons HOT 1
- Communication needed. HOT 1
- Cannot compile on FreeBSD 10.3 HOT 8
- EVEmu Wiki migration to wikia.com HOT 6
- compile error 145-147 ConfigDB.cpp HOT 2
- What happened to this project? HOT 11
- Buy items on the market not being delivered HOT 3
- Cmake: Lua51 version not detected HOT 4
- Cmake: UTF8CPP not found HOT 5
- Boost: Build fails with boost version 1.72.0 HOT 1
- dead or what? HOT 1
- [ORG] Convert evemuproject to Organization HOT 9
- Warning in current build HOT 2
- Information about additional bugs not in this list. Those testing this branch should read. HOT 1
- seed market script needs work HOT 1
- Message not found window error HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from evemu_server.