I am trying to make an invoice management system for our company. I am a little bit confused because of design principles. SOLID
Lets say that a class takes care of invoices: InvoiceProcessor
InvoiceProcessor ip=new InvoiceProcessor(DraftHTML);
ip.Customer=theCustomer;
ip.Order=theOrder;
ip.Prepare();
After this, which approach is better? And why?
A)
ip.SaveToFile(fileName);
ip.SendToCustomer();
ip.DBConnection=myActiveConnection;
ip.LoadFromDB(invoiceID);
ip.SaveToDB();
B)
SaveToFile(fileName,ip.GetHTML());
SendEmail(ip.Customer,ip.GetHTML());
ip.InvoiceInfo=LoadFromDB(invoiceID);
SaveToDB(ip.InvoiceInfo);