I think it would be better to have the coding discussions separate from the concept discussions, because that way the people, who just care about the ideas, and do not want to concern themselves with the specifics of code, do not have to sort through the technical posts.
First of all, I would like to respond in more detail to Laurent:
OK, I have thought about it, and here is how I think it is going to work:
There will be a certain abstract class DiplomaticStatus, which will contain constant definitions for the name of the diplomatic status and the weight, or strength, of it, and possibly a short description. It will also have definitions for accessors (getters, I think they are also called) for these fields. It will also have subclasses, which will actually have the constants initialized to specific values. That way, we have diplomatic statuses represented as objects, and yet preserve the wieghts. The structure will also be the same for attitudes.
As a little side note: I think that weights are, in fact, important for such a model because that would make the coding of other things much simpler. For instance: let us say I am coding some method gaveGift(), which will handle the attitude of one nation towards another if the latter gave the former a big gift of whatever. In the code I really don't want to say something like:
That is ugly, annoying, and if we choose to add / remove an attitude, I would have to edit the code. Note also, that since there will be more than one method that affects attitude, I would have to edit this stuff in each and every one of them. In addition to me being lazy, there is another reason for not doing things that way: you can easily miss stuff, when editing code like that. And that would lead to nasty bugs, that will be really hard to track. What I really want to say is:
That is more robust, less code, and I don't have to edit it any more if we choose to redefine the attitudes.
That's how I see the attitudes and diplomatic status implemented. What do you think of such model, Laurent? (I would certainly appreciate comments from other people, too, if you are interested.)
First of all, I would like to respond in more detail to Laurent:
Originally posted by LDiCesare
Having attitudes/status ranked between -10 and 10 is OK if we need figures, but objects might be more appropriate.
Having attitudes/status ranked between -10 and 10 is OK if we need figures, but objects might be more appropriate.
There will be a certain abstract class DiplomaticStatus, which will contain constant definitions for the name of the diplomatic status and the weight, or strength, of it, and possibly a short description. It will also have definitions for accessors (getters, I think they are also called) for these fields. It will also have subclasses, which will actually have the constants initialized to specific values. That way, we have diplomatic statuses represented as objects, and yet preserve the wieghts. The structure will also be the same for attitudes.
As a little side note: I think that weights are, in fact, important for such a model because that would make the coding of other things much simpler. For instance: let us say I am coding some method gaveGift(), which will handle the attitude of one nation towards another if the latter gave the former a big gift of whatever. In the code I really don't want to say something like:
Code:
if currentAttitude == DeepHatered setAttitude(Fury) else if currentAttitude == Fury setAttitude(Anger) ... else if currentAttitude == Philantropy setAttitude(BrotherlyLove)
Code:
setAttitude(currentAttitude.getStrength() + 2)
That's how I see the attitudes and diplomatic status implemented. What do you think of such model, Laurent? (I would certainly appreciate comments from other people, too, if you are interested.)
Comment