Excellent presentation. Well balanced. None of the "Your doing X wrong!!" hysterics here.
@zoran-horvat Жыл бұрын
The greatest secret of software design is that every decision is a tradeof.
@tarsala1995 Жыл бұрын
I rarely watch videos twice. This one opened my eyes. I think your videos are reminding us how we should look at the code.
@zoran-horvat Жыл бұрын
Thank you for your comment. I am glad to hear the video was helpful.
@thygrrr7 ай бұрын
"There are obviously two kinds of money - Zero and Non-Zero" Me: "Wait... You guys have non-zero money?"
@cnaegle Жыл бұрын
Great presentation from one of my favorite instructors! Making my development team watch it.
@driden1987 Жыл бұрын
Haven’t programmed in C# for a couple of years now, still loving the examples. Good job !
@thygrrr7 ай бұрын
8:30 "Money has just become abstract" ... not just...
@Bankoru Жыл бұрын
Essentially creating an algebra by adding an Identity element under the Add binary operator.
@tplummer217 Жыл бұрын
Another excellent video sir!
@majixx Жыл бұрын
Thank you again Zoran. Brilliant video!
@t304pk Жыл бұрын
Thank you for the impressive video, as always.
@rmcgraw7943Ай бұрын
I see you chose the singleton NoMoney class implementation, which is fine. I am curious if you considered making the NoMoney a readonly struct, or even readonly record struct? i can think of reasons to do it both ways, and reason why both ways might not be ideal in certain situations; howeverI was curious what your thoughts are regarding singleton class vs struct.
@zoran-horvatАй бұрын
@@rmcgraw7943 Structs cannot be used in the context of polymorphism other than through interface implementation, in which case you probably lose all performance gains of the struct allocation.
@robertmrobo8954 Жыл бұрын
Thank you for not using the default 'Order, product and Order Items' examples. 😊
@zoran-horvat Жыл бұрын
Of course :)
@5cover Жыл бұрын
IMO there's a flaw in your current implementation, as it is possible create a Money object with Currency.Empty and a non-zero amount. So it is possible to handle money without a currency. A possible solution is to throw an exception in the constructor if currency equals Currency.Empty. Also I would rename Currency.Empty to Currency.None, as there's no such thing as an "empty" currency.
@zoran-horvat Жыл бұрын
Good observations.
@10199able Жыл бұрын
"poor man's polymorphism"
@zoran-horvat Жыл бұрын
Oh yes, you can find it everywhere.
@josebarria3233 Жыл бұрын
That makes you wonder which one is rich man polymorphism
@zoran-horvat Жыл бұрын
@@josebarria3233 Just polymorphism.
@7th_CAV_Trooper9 ай бұрын
omg, a list of my favorite books.
@Skaral24 ай бұрын
How do you make the null object pattern work with Entity Framework? I had an entity with a navigation property to another entity ( Product 1:1 ProductPicture in separate tables), but it was possible for it to be NULL. I would like to replace the NULL with the null object, but I can't save it into the database since that'd create a duplicate.
@zoran-horvat4 ай бұрын
@@Skaral2 EF Core does not support null objects out of the box. Custom mappings do not work because EF Care does not invoke it when the database field is null. Therefore, you cannot map a database null into a non-mull object in the application. There are at least two workarounds. One is to persist a private nullable field. The public getter would coalesce null into a null object. That is an easy solution, which avoids the complexities associated with persisting a hierarchy. The private field could be of the concrete type that acts as the non-mull case. A more engaged option is to have a null object persisted with a well-known ID value which is then also used in the application's null object instance. In that case, you can read and write objects as usual. There are a few details to work out in either case, but both options generally work well in practice.
@m4inline Жыл бұрын
Ming the Merciless retired as a coder?
@malzsmith Жыл бұрын
I'm loving your videos! Do you have plans to make content about async programming and synchronization?
@zoran-horvat Жыл бұрын
I have one video in the queue that talks about asynchronous programming, which I might record in the near future.
@malzsmith Жыл бұрын
@@zoran-horvat glad to hear it, thank you!
@PedroPabloCalvoMorcillo Жыл бұрын
Great ideas and insights. Not a big fan of throwing exceptions in this case, thought.
@zoran-horvat Жыл бұрын
There is a more complex design where Money separates "strict" addition from that with mixed currencies. However, subtraction can never be with mixed currencies, except for subtracting a zero... For a 100% safe and sound solution, we would need to return an Either monad from all strict methods. But with no syntactic support for errors in C#, the implementation and its use would become significantly more complex and less readable.
@elraito4 ай бұрын
"...lets add a touch of human. That is when we have no money" Look. It is illegal to make both excellent jokes and excellent video at the same time. Stop it.