When Your Cheap Sensor Breaks Everything: Understanding LSP
dev.to·2d·
Discuss: DEV
⏲️Time Synchronization
Preview
Report Post

Part 3 of the SOLID Principles for Scientific Programmers series

The Sensor Swap Disaster

You’ve built a data acquisition system that works perfectly with your lab’s standard temperature sensor. The code collects data, applies calibration corrections, and flags readings outside the valid range. Everything is tested and working.

Then you need to swap in a different sensor model—maybe the original is broken, or you’re using equipment at a collaborator’s lab. The new sensor is also a temperature sensor, so you create a CheapTemperatureSensor subclass. The code runs without errors.

But then you notice something wrong: your analysis is giving bizarre results. After hours of debugging, you discover the cheap sensor returns values in Fahrenheit instead of Celsius. Your results …

Similar Posts

Loading similar posts...

Keyboard Shortcuts

Navigation
Next / previous item
j/k
Open post
oorEnter
Preview post
v
Post Actions
Love post
a
Like post
l
Dislike post
d
Undo reaction
u
Recommendations
Add interest / feed
Enter
Not interested
x
Go to
Home
gh
Interests
gi
Feeds
gf
Likes
gl
History
gy
Changelog
gc
Settings
gs
Browse
gb
Search
/
General
Show this help
?
Submit feedback
!
Close modal / unfocus
Esc

Press ? anytime to show this help