2 ms·
> And you will get phantom code of RequestWithZ that isn't actually valid anymore It is the opposite. My IDE will show "no usages of RequestWithZ". I will no
by mrkeen 3y ago
> And you will get phantom code of RequestWithZ that isn't actually valid anymore
It is the opposite. My IDE will show "no usages of RequestWithZ". I will not get any such help if it was encoded as Request.get("z").
- majormajor 3y agoNah, your IDE will show all the usages of RequestWithZ, but won't tell you anything about how the thing that sent RequestWithZ has been gone for two years. You'd still need instrumentation with that.
- taeric 3y agoAs the sibling post said, you probably have a ton of code that deals with what happens when a RequestWithZ appears. The thing that changed is that that isn't a thing that can actually be sent to you. Now, you are right that you can contrive a situation where you can choke off all parts that trim this down. And then you can use the type system as a tool to help delete dead code. When it works, it is a great tool. Just like the example in the original article. Please don't take my point as a complete teardown of the idea. Just don't oversell it, either.
- tharkun__ 3y agoExactly! And good tests would be of the type "should accept RequestWithZ under circumstance Y" and in many cases you'll be able to say "Oh, circumstance Y hasn't been current for like 2 years now, we can delete this code!"