0

I know that subclasses can implement (almost) any additional methods, but is that 'proper' practice in regards to ndb/db.Model sublcasses? For example, I'm developing a Boggle game (for practice - not because I feel there's a shortage), and I'd like for my Game class to provide the expected methods a Boggle Game class would provide. After each operation is done on the game, I'd like to simply call the .put() method to store it.

Is there anything wrong with doing this? All the online tutorials I've seen seem to only use these sublcasses for storing data.

Thanks!

Guy Coder
  • 24,501
  • 8
  • 71
  • 136
yts
  • 1,890
  • 1
  • 14
  • 24
  • Why should there be anything wrong with it? That's exactly what you should do: any model-specific logic belongs as custom methods on the model. – Daniel Roseman Nov 13 '13 at 21:57
  • @DanielRoseman No reason that I could think of, I just wanted to make sure. And what about having the Game class reference other Model sublcasses? Games contain a list of Rounds, each of which are also entities. Using hooks, getting and putting the Game will populate the list with rounds and store the rounds, respectively. I'm completely new to this, so I appreciate your insights :) – yts Nov 13 '13 at 22:12

0 Answers0