Advertisement Jump to content
Sign in to follow this  
nilkn

Is this OK practice?

This topic is 4907 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I wrote a hangman game the other day when I had nothing better to do, and I did something about which I'm unsure as to it's general acceptability. I wrote the game in C#, and essentially did it in two classes, one pertaining to the game logic, the other to the game interface. The game logic class had such public methods as CheckForWin, EnterUserInput, StartNewGame, and ChangeDict. There was no all inclusive Run method. Certain properties were also exposed, the more important of which being CurrentWord, RevealedWord, WrongLetters, Misses, NumGuessesThisRound, and RoundNum. So basically the game logic class was not totally self-contained -- the game couldn't be played without additional coding, namely the interface. It was also left to sort of "manage" the game class, since, because it was responsible for getting user input, it had to call such methods as those listed above explicitly. Ultimately this has the advantage of additional flexibility in design, such that the game logic is portable without modification between different interfaces. In other words, I could easily change the interface without needing to modify game logic. This seems good to me -- however, is the method about which I went to accomplish this as acceptable? Namely, are there better methods which in this case could be applied such that more elegance is gained, by way of perhaps fewer public interface components (methods, properties, etc.) being exposed? Are there general methods which are often applied to solve such problems as these?

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
Well... if you do not code it at all it will be maximum flexibility. User can recode game by his needs.

I mean... every stick got 2 ends

Share this post


Link to post
Share on other sites
Quote:
Original post by Anonymous Poster
Well... if you do not code it at all it will be maximum flexibility. User can recode game by his needs.

I mean... every stick got 2 ends


My question was about methods by which the flexibility in design could be achieved. Specifically, I asked for methods better than the one I've already employed. Yours clearly does not satisfy this latter criterion.

If you're implying that such flexibility is bad in the first place, however, perhaps you could elaborate?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!