2
Craig Larman (Using UML and Standards, p. 352) proposes the following design problem:
Who is responsible for creating a Payment instance?
By the GRASP Creator standard, candidates are the Registrar class and the Sale class.
In the case of the Sale class, he justifies that she is a candidate for being "reasonable to think that she uses Payment in a near".
I couldn’t figure out where he gets it from. I thought of two possibilities:
After a Full Sale comes a Payment.
After a Payment will be returned change, and the calculation of that change comes from the difference between the total of the Sale and the amount provided in the Payment.
Is there any other relationship between Sale and Payment that I can’t see?
Call it here :D Have you read all or have you only seen this passage? Does it not justify? Throw it away :D
– Maniero
I read everything. Will I have to play? : I thought I was missing something obvious, but if more people didn’t understand too, at least I don’t stay the only one. :)
– Piovezan
Publication date?
– Maniero
The book is from October 2004.
– Piovezan
To tell the truth anything that has UML in the name I discard, everything is fundamentally wrong, anyone who dedicates himself to writing it does not have much credibility with me. It may be that today the person has changed his mind, but the author at that time believed in something that adds nothing very useful, brings new problems, and today there are those who already see it.
– Maniero
He seems like a theoretical guy who’s never done a real system, but he just seems like, I don’t know, it might just be someone who can’t give good definitions. If it’s about selling, there should be a receipt, not a payment. Usually the receipt has to do with the financial doesn’t go through the sale, but I don’t know the context, he might be right. It is what I say, there is no book that teaches modeling right, nor the abstract base, imagine when you need to do something concrete. I wanted someone to give a coherent explanation, but I don’t think even the author can. Is it possible to contact him? Put on Soen and call him
– Maniero
It’s a PDV project for selling products in a supermarket or something, you’re referring to the buyer paying cash for the purchase. I don’t think the author is contactable, I have at least tried to talk to him and failed to.
– Piovezan
From the point of view of the company that made the sale, it receives, because if you look at the customer’s point of view, it is already wrong because the system is not for him, but if he does this, the payment must be made in a purchase. I still think it’s something poorly structured, and there’s probably no direct connection between things. Maybe there were so many people complaining about the book that he disappeared :)
– Maniero
Either that, or he just doesn’t bother to answer emails with random questions. : P but gives a credit for the book, it is well recommended by Martin Fowler and Alistair Cockburn, if their recommendation is worth anything. : P
– Piovezan
Fowler has his ups and downs, a lot of what he says is marketing, you never know when that’s all. And I don’t know if he hasn’t changed his mind over time, he’s the one who’s preached things that he doesn’t preach anymore, but he stays quiet. I don’t know what he did, I don’t know if it looks good. The other you can read my link in chat (on Linkedin) what I think about Agile, so I won’t even comment.
– Maniero
There’s Vlissides too. : ) the case is that if you exclude the approaches with UML you don’t have any, all the ones I found use (after-97 at least).
– Piovezan
@Maniero I think I had not spoken before, but the Sale is probably not a Purchase because the use case is from the cashier’s point of view (clerk).
– Piovezan