Use Null Object Pattern in Your Rich Domain Model

preview_player
Показать описание
Ever wondered about the impact of the Null Object design pattern on domain modeling? This video offers a deep dive into this fascinating topic, demonstrating how identifying objects that behave like 'zero' can create a more intuitive and friendly model, even in a complex business domain.
We bring this concept to life through a real-world example, demonstrating the significant influence of 'null objects' in a deep domain model when it comes to implementing essential features. Watch this video to experience this simplifying effect firsthand!
And not just that, we also reveal situations where you might want to avoid using the Null Object pattern by adding a touch of complexity to your classes, but gaining more from their simple and intuitive public interface. Discover why maintaining a simple public interface could be advantageous over polymorphic Null Object implementation.
By the end of this journey, you'll be equipped with the know-how to apply these concepts creatively in your domain modeling, ultimately leading to more structured code.

Thank you so much for watching! Please like, comment & share this video as it helps me a ton!! Don't forget to subscribe to my channel for more amazing videos and make sure to hit the bell icon to never miss any updates.🔥❤️

⭐ Learn more from video courses:

▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
⭐ CONNECT WITH ME 📱👨

▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
👨 About Me 👨
Hi, I’m Zoran, I have more than 20 years of experience as a software developer, architect, team lead, and more. I have been programming in C# since its inception in the early 2000s. Since 2017 I have started publishing professional video courses at Pluralsight and Udemy and by this point, there are over 100 hours of the highest-quality videos you can watch on those platforms. On my YouTube channel, you can find shorter video forms focused on clarifying practical issues in coding, design, and architecture of .NET applications.❤️
▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
⚡️RIGHT NOTICE:
The Copyright Laws of the United States recognize a “fair use” of copyrighted content. Section 107 of the U.S. Copyright Act states: “Notwithstanding the provisions of sections 106 and 106A, the fair use of a copyrighted work, including such use by reproduction in copies or phono records or by any other means specified by that section, for purposes such as criticism, comment, news reporting, teaching (including multiple copies for classroom use), scholarship, or research, is not an infringement of copyright." This video and our youtube channel, in general, may contain certain copyrighted works that were not specifically authorised to be used by the copyright holder(s), but which we believe in good faith are protected by federal law and the Fair use doctrine for one or more of the reasons noted above.

#dotnet #csharp #designpatterns
Рекомендации по теме
Комментарии
Автор

I rarely watch videos twice. This one opened my eyes. I think your videos are reminding us how we should look at the code.

tarsala
Автор

Excellent presentation. Well balanced. None of the "Your doing X wrong!!" hysterics here.

codingbloke
Автор

Great presentation from one of my favorite instructors! Making my development team watch it.

cnaegle
Автор

Essentially creating an algebra by adding an Identity element under the Add binary operator.

Bankoru
Автор

Thank you again Zoran. Brilliant video!

majixx
Автор

Haven’t programmed in C# for a couple of years now, still loving the examples. Good job !

driden
Автор

"There are obviously two kinds of money - Zero and Non-Zero"

Me: "Wait... You guys have non-zero money?"

thygrrr
Автор

8:30 "Money has just become abstract"

... not just...

thygrrr
Автор

"poor man's polymorphism" <3

able
Автор

Thank you for the impressive video, as always.

tpk
Автор

Thank you for not using the default 'Order, product and Order Items' examples. 😊

robertmrobo
Автор

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.

cover
Автор

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.

rmcgraw
Автор

I'm loving your videos! Do you have plans to make content about async programming and synchronization?

malzsmith
Автор

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.

Skaral
Автор

Ming the Merciless retired as a coder?

minline
Автор

Great ideas and insights. Not a big fan of throwing exceptions in this case, thought.

PedroPabloCalvoMorcillo
Автор

"...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.

elraito