Тёмный

Is Maybe an Option? How to Model Nothing - Marco Heimeshoff - DDD Europe 2022 

Domain-Driven Design Europe
Подписаться 30 тыс.
Просмотров 5 тыс.
50% 1

Domain-Driven Design Europe 2022
dddeurope.com - / ddd_eu - newsletter.dddeurope.com/ / domain-driven-design-e...
Organised by Aardling (aardling.eu/)
Null is used to model a variety of states within an application. Be it to model the absence of a field in a database table, the return value when parsing something unparsable, an unsuccessful API call or to initialize some fields empty because the “ORM expects it that way”. The problem with null is that it is never completely clear to the developer whether something can or should be null at some point of the application and what null means in a specific case. Most statically typed functional programming languages avoid the problem completely by not allowing null at all. They introduce a new data type called Option or Maybe which allows us to lean on the compiler to check whether we forgot to handle the unexpected absence of a value. This leads to a greater trust in our applications and reduces runtime errors tremendously. Options can also be used to help modelling our domain but often they lack clear semantics of why a value is absent in a specific situation. Luckily options are just a small subset of the beautiful concept of sum types. Those sum types allow us to model different states of our application with ease and great expressiveness. Furthermore they allow us to get rid of many errors that are usually modelled with exceptions by taking care of them in our domain model. This talk will give you the ability to get rid of nulls with options and abstract over this concept with the help of sum types to make your code more expressive and your domain model easier to comprehend for your team and for the business.
About Marco Heimeshoff
Marco Heimeshoff is a trainer, speaker and software developer from Germany. He organizes KanDDDinsky, a conference about Domain-driven Design and the art of business software and co-founded the german DDD community in 2013 and VirtualDDD.com in 2019. Between consulting companies around the globe and his day job in building health care software, you'll find him speaking at conferences about DDD, socio-technical systems and first principles. With over a decade of experience, he is helping teams to change and learn in all things from code to culture and to master Domain-Driven Design, agile software development, functional programming and CQRS with event sourcing.

Наука

Опубликовано:

 

13 фев 2023

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 6   
@slipperydippery
@slipperydippery Год назад
One of the best talks during the foundations session. Glad to be able to watch it again!
@arti1115
@arti1115 Год назад
A very good talk, thank you.
@jacquesdemolay2699
@jacquesdemolay2699 Год назад
in the future decades some people connecting to that video will think: "co-vead ? what the heck is he talking about?"
@petropzqi
@petropzqi Год назад
Not sure I follow, all value types in C# has a default value. I suggest to use the default value for value types and null for reference types. We used an optinal implementation for our PUT routes and this has open a huge can of worms, such as silent errors when wrong datatype are passed in. Note that we used optional and not option type not sure if there is a difference
@arrangemonk
@arrangemonk Год назад
whenever i make enums i always add invalid as default value
@obinnaokafor6252
@obinnaokafor6252 Год назад
Knowing how to write clean and modern C# is a requirement before making comparison. Lol
Далее
Fast and Furious: New Zealand 🚗
00:29
Просмотров 17 млн
NOOOOO 😂😂😂
00:15
Просмотров 3,5 млн
Domain Logic: Where does it go?
12:01
Просмотров 20 тыс.
НЕ БЕРУ APPLE VISION PRO!
0:37
Просмотров 348 тыс.