I am having design problems in my project and I hope to get some help. I came up with an example that I think describes the problem I am facing. I'm new to software development, so forgive me if I completely missed something.
This example says that I have:
struct Book {
std::string author_first_name;
std::string author_last_name;
int year_published;
double price_in_dollars;
};
class BookCase {
std::vector<Book> all_books;
}
I read in all books from a file or more than one file and save them in BookCase. Then I want to do a bunch of BookCase operations defined at runtime, and that's where I got stuck.
Say that the user wants to sort books by author and then export, next time sort by name or price, or wants to add a new operation, perhaps delete books published before year X.
:
. BookCase:
class BookCase {
void SortByLastNameAscending();
void SortByLastNameDescending();
void SortByPriceAscending();
, , , , , . - "BookCaseProcessor", . - , , , .
-. , RemoveBooksBeforeYear(), RemoveBooksThatCostLessThan(), SortByLastNameDescending(). , , , 10 . , , if.