I am designing a module to perform some actions for a library database application. The methods are not implemented yet but I was wondering what you all think about nested classes in this situation.
Design One
#!/usr/bin/env python
# File: .py
# Author: shadytyrant@gmail.com
# Date: 2009-11-25
# Notes:
#--------------------------------------------
class Library:
def __init__(self):
# Just for reference at this point
id = 'NULL'
seriesIndex = 1
title = ''
author = ''
genra = ['fiction', 'non-fiction', 'science fiction', 'technical', 'reference']
publisher = ''
#--------------------------------------------
def AllBooks(self):
pass
def SearchById(self):
pass
def SearchByTitle(self):
pass
def SearchByAuthor(self):
pass
def SearchByGenra(self):
pass
def SearchByPublisher(self):
pass
#--------------------------------------------
def AddBook(self):
pass
def RemoveBook(self):
pass
def EditSeriesIndex(self):
pass
def EditTitle(self):
pass
def EditAuthor(self):
pass
def EditGenra(self):
pass
def EditPublisher(self):
pass
Design Two
#!/usr/bin/env python
# File: .py
# Author: shadytyrant@gmail.com
# Date: 2009-11-25
# Notes:
#--------------------------------------------
class Library:
def __init__(self):
# Just for reference at this point
id = 'NULL'
seriesIndex = 1
title = ''
author = ''
genra = ['fiction', 'non-fiction', 'science fiction', 'technical', 'reference']
publisher = ''
#--------------------------------------------
class Search:
def AllBooks(self):
pass
def ById(self):
pass
def ByTitle(self):
pass
def ByAuthor(self):
pass
def ByGenra(self):
pass
def ByPublisher(self):
pass
#--------------------------------------------
class Edit:
def Add(self):
pass
def Remove(self):
pass
def SeriesIndex(self):
pass
def Title(self):
pass
def Author(self):
pass
def Genra(self):
pass
def Publisher(self):
pass