News for hackers. Stuff that matters.
Re:Learning from Ada by nostrademons on Sunday August 21, 2016 @06:45PM (#12333072)
The advantage of "let it break" is that you can continue to run the portion of the program that remains coherent. It's letting the user (who is often just yourself, or a small group of beta testers) into the system; if the user continues to find value in the program even when it's broken, the part that's broken must not have been that important. It's not unusual for programmers to overspecify the requirements when the requirements are unknown; you have to make a number of (often arbitrary) decisions just to get a program working end-to-end, and there's no guarantee that those decisions align with how a user will get the most value from the system.
Re:Learning from Ada by nilkn on Sunday August 21, 2016 @10:13PM (#12333712)
And the disadvantage of that is that you possibly don't even know what's broken! It will come down entirely to how vigilant you've been with testing. Your argument is that if it's broken but you don't notice, then it must not be all that important. But I think there are tons of exceptions to that, and that's putting a huge amount of faith in yourself and beta testers to reliably test all important aspects of the software. Besides, if you do more or less figure out what's broken and what's not important, you still have to engage in a flimsy surgery of the codebase to excise the broken pieces.

I'm not arguing universally against what you're proposing by any means, but it doesn't seem like a clearly superior approach to me. The bottom line is that "let it break" takes many forms. There's your version, there's my type coherence version, there's Erlang's version with supervisor trees, etc. I think it's hard to argue that any of these is universally superior to the others.

Re:Learning from Ada by nostrademons on Sunday August 21, 2016 @10:54PM (#12333803)
It's superior for a certain problem domain, one in which the desired feature set is unknown, the desired feature set is simple, and the consequences of failure are limited. Consumer web & mobile startups, basically, as well as some limited small-business B2B software where the alternative is an error-prone manual process. It's probably not appropriate for enterprise software, and is certainly not appropriate for embedded, regulated, or safety-critical software.

This is far from the whole software industry, but it's a segment that tends to be of disproportionate interest to HN readers, given the startup-focused origins of this site.

Re:Learning from Ada by coolsunglasses on Sunday August 21, 2016 @07:45PM (#12333282)
>The advantage of "let it break" is that you can continue to run the portion of the program that remains coherent.

This works fine in Haskell, thanks in part to laziness. There needn't be a tradeoff here.

Re:Learning from Ada by nostrademons on Sunday August 21, 2016 @07:54PM (#12333314)
Even if it fails to typecheck? Has the Haskell compiler gotten smart enough that it can stub out portions of the code with type errors and fail at runtime?
Re:Learning from Ada by pinkythepig on Sunday August 21, 2016 @10:44PM (#12333774)
Actually yes, you can pass a compiler flag, -fdefer-type-errors, which makes type errors turn from compilation errors to simply warnings. That said, any code that does not type check will also not run and instead will throw an exception at runtime if called (laziness is key here). But if Part B was giving type errors and you only cared about testing Part A, then you are good to go.
Re:Learning from Ada by coolsunglasses on Sunday August 21, 2016 @11:14PM (#12333879)
Yep. It's easier to implement and makes more sense in a lazy language than what you're describing though. I don't use it in my work but I do use a related technique to isolate what I am focused on fixing.
Re:Learning from Ada by coolsunglasses on Monday August 22, 2016 @11:39AM (#12337080)
To elaborate a little on this:

In a strict language, a type error would mean the bricked off expression that doesn't type-check would spread like an infection to any expression that incorporated it.

In Haskell, I can dance around sub-expressions that don't type-check at runtime and evaluate things optionally.

The technique doesn't work in practice otherwise.

Re:Learning from Ada by tome on Monday August 22, 2016 @01:54PM (#12338066)
> The technique doesn't work in practice otherwise.

I don't see why. Functions in a strict language are evaluated lazily. Any type error within a function wouldn't spread beyond that function.

Re:Learning from Ada by coolsunglasses on Monday August 22, 2016 @04:21PM (#12339135)
Values still wouldn't work. You'd have to change their types to `() -> whatever` and that means a lot of churn.

Even strict-by-default languages that let you easily make values explicitly lazy would mean type level churn, if not term level.

The value part is important because it means you can't really talk about partially implemented hypothetical results where you know how to handle one branch of a function, but not another. This is a super common divide-and-conquer technique in Haskell.

Could possibly half-ass it if you have some kind of panic functionality, but it'll fail unconditionally in a strict language when the result of the function is forced. In Haskell, if you don't use the bottom, it doesn't blow up.

Re:Learning from Ada by sordina on Sunday August 21, 2016 @10:52PM (#12333798)
Yes. You can defer type errors. I turn this on in development.