💾 Archived View for heavysquare.com › notes › FFD9-compile-time-conveniences.txt captured on 2022-04-29 at 12:24:45.
⬅️ Previous capture (2021-12-03)
-=-=-=-=-=-=-
~~ 2021-05-18T10:02:14+02:00 Let's say you have a big system, already written. It's a web app. Users register, get invited, etc. It has end to end tests (tests that actually fire up the site in a browser and do stuff with it). These tests generate coverage reports. There's an ongoing effort to add coverage. Suspicion develops that a certain class/type could/should not be in a certain state, but there are code dispatching on that state, checking if a parameter is in that state and doing something differently. With a proper type checker (compiler), you should be able to express your suspicion in a way so that the whole system is guaranteed not to create such objects, in that supposedly unused state (you make that state impossible via types). 1) Java's DTO idiom is completely frustrating here. DTO as in classes that has bunch of fields and setters/getters on the fields. Code could pass such objects around and set bits of it here and there. It's a nightmare. I quickly thought about dynamic languages. How to have these kind of compile time guarantees there? Like.. in common lisp or python..