The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

litendavid (3) [Avatar] Offline
On page 31, the first step in the purifying process, the invoice methods add and issue become static methods in a new class. The usage code then reads:

Invoice i = new Invoice(...);

But on page 33, exercise review #3, a very similar example is solved through a non-static class, which feels very unnatural. The usage code reads:

Invoice i = new Invoice(...);
Customer c = new Customer(...);
ProcessCustomer pc = new ProcessCustomer();
pc.issueInvoice(c, i);

I see no reason for not making ProcessCustomer static like before. Is this simply an oversight, or am I missing something? I see you're accessing "this" in issueInvoice in order to call adjustBalance, but that call could be made static too, right?

Finding the book really excellent so far, great job, Aslan! Being a teacher of programming, maths and language, I ask you to wear my approval as a badge of honour. smilie
aslam.khan (50) [Avatar] Offline
Re: static classes
Hmmm, I didn't see that inconsistency. Thanks for pointing it out. I will rework to make it more consistent.

And thanks for your kind words. I will wear your badge with honour smilie

-- Aslam