I think I may have sent an incomplete version of this question a moment ago
(sorry). Here is the complete question:
I'm designing something along the lines of a flash card program. It's mostly
just an exercise in learning Python, but I'd like it to be at least marginally
usable when I'm done. So I'm looking for comments/suggestions on the key pieces
of the
design: the questions and the flash card deck:
Psudo-code of current design:
class Deck():
"""Provides managment and informational functions about a set of
questions to be asked
methods incldue:
__init__(questions) -- takes a list of question and creates a
new deck with these questions.
add_question(self,question) -- Adds a question to the current
deck
remove_question(self,question) -- returns True if the question
was removed, False otherwise
get_question() -- Returns the next unanswered question in the
deck
get_stats() -- returns a tuple containing: number_asked,
number_correct, number_remaining
shuffle_deck() -- shuffles the order of the remaining questions.
Deck Overrived the __len__ function so that the len returned is
the number of questions in the deck."
class Question():
"""Provides questions to be asked
methods:
__init__(self,question,answer) -- question string representing the
question.
answer can
be a text string, a tupple (for multiple correct answers)
or an
object implementing an is_correct() method that returns a boolean
check_answer(self,answer) -- tests to see if the answer is correct and
returns a boolean
"""
Mostly I'm wondering, is this over-kill? The idea is to allow for the deck to
be used for as wide a variety of purposes as possible. Also, I want to make it
easy to write code that generates decks. Is this design over-kill?
Any comments/suggestions welcome.
Thanks,
David
_______________________________________________
Tutor maillist - [email protected]
http://mail.python.org/mailman/listinfo/tutor