Lead Product Evangelist @Kentico, Founding partner @craftbrewingbiz. love to learn / teach web dev & software engineering, collecting vinyl records, mowing my lawn, craft 🍺
Ya, strict constructors, guard clauses, and immutable state (or at least protected invariants) can go a long ways towards evicting null from your codebase (except where it's appropriate, of course).
If we take an Onion architecture approach for our application, and guard against nulls on the outside of our domain, then we can be safe from it within our business logic, which is where we typically have issues with null.
I like that there are many different ways to protect against or at least carefully handle the case of reference types with null values.
That's typically what I gravitate towards - validating on public methods in public classes - then farming things out to private methods or internal classes.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Ya, strict constructors, guard clauses, and immutable state (or at least protected invariants) can go a long ways towards evicting
null
from your codebase (except where it's appropriate, of course).If we take an Onion architecture approach for our application, and guard against nulls on the outside of our domain, then we can be safe from it within our business logic, which is where we typically have issues with
null
.I like that there are many different ways to protect against or at least carefully handle the case of reference types with
null
values.That's typically what I gravitate towards - validating on public methods in public classes - then farming things out to private methods or internal classes.