views:

141

answers:

6

Hi,

I am working on a project to develop a poker bot, I have to store the state of every hand that is played. I wanted to do this via an object - however Players can only read from the state and the Dealer is allowed to write to the state. I thought a good way to solve this would be to make the HandState object implement 2 interfaces (one for Players and one for the Dealer) however I am having trouble naming them as I cant think of logical names other than IHandState - is there some kind of convention to deal with these things? Has anyone experienced something similar?

Thanks

+1  A: 

What about DealerState and PlayerState?

Kevin
+3  A: 

PlayerActions and DealerActions

or

PlayerAware and DealerAware

Bozho
I prefer the `actions` versions of the interfaces.
Len Holgate
+3  A: 

PlayerStateHandler and DealerStateHandler

As a convention, my Interfaces either contain -er or -able

Anthony Forloney
A: 

uasually interface will have an adjective names. so i prefer IStateable

GK
+1  A: 

To answer your problem, not your question: Prefer composition over inheritance (including of inheritance of interface).

Also I get the impression that you have poor encapsulation by using getters and setters, instead of meaningful operations. If you get improve the abstractions, things should become clearer.

Tom Hawtin - tackline
+1  A: 

You have one state object, name it's class HandState.

Make it implement the two interfaces. Call them IWriteable and IReadable

Then create the player, it has access to an object of type HandState, however accesses it through the IReadable interface. Similarly, the dealer, it accesses the HandState through the IWriteable Interface.

Marcel