Making Error States Unrepresentable Is A Mistake

I have been seeing some discussions about overuse of type safety and suggestions that you should make wrong states unrepresentable in the code that you write. This sounds like a good idea on the surface.

However in the real world data needs to travel across a network and between systems. The perfect type system stops at a network boundary. Recently I have been dealing with data validation and the reporting of the detected errors. If you don’t represent the error states then you can’t accurately report problems. You have to handle errors at the edge at least. This will create another translation boundary (which is another edge).

This gets especially difficult when you need an always on system that needs to cope with being deployed to without downtime. You need to cater for version N and N – 1 of a system. All those tight constraints can’t apply without causing an outage.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s