You are writing a library. An evil genius steals all your library’s code somehow (you can’t retrieve it) and offers you a choice. You can either recover all your library’s implementation code, or all of your library’s tests, but you may not have both. What do you recover?
You are writing an application. An evil genius steals all your app’s code somehow (you can’t retrieve it) and offers you a choice. You can either recover all your app’s implementation code, or all of your app’s tests, but you may not have both. What do you recover?
Can you guess my answers?
This ofc depends on circumstances but other things equal, my answer is this:
Let’s take React for example. If we lose the entire source, we can reconstruct it (and probably in a better way) by starting from scratch and using the tests to guide and verify the implementation. I know we can do it because we literally did this once: engineering.fb.com/2017/09/26/web…
On the other hand, if we lose all tests for React, we’re screwed in a major way. We’d lose the specification about how our APIs work, edge cases, weird things to look out for, unintuitive consequences, bugs we already fixed, and so on. And any further change is scary and unsafe.
Whereas for the app, usually tests cover only a tiny percentage of what the app *is*. I’ll take a working login form over a test verifying a login form works any day! The implementation is the hard part, while good tests look trivial and obvious (“click here, get this”).
Might be interesting to note that React’s tests are written with public API (or at least, external entry points). There are no unit tests for individual modules. This is intentional because otherwise tests don’t help with rewrites. Unit tests can’t guide bigger-unit rewrites.
Another aspect. As a library developer I mostly know how it works already. Not all pieces but decently enough to figure it out. Whereas when I’m working in an app, I know a relatively small % of it. So I wouldn’t know where to even start reconstructing many pieces.
Also with an app, I can mostly write/guess tests without deep knowledge. Because I know what the app *should do*. Pressing log in should log me in. Pressing Buy should add to cart. Etc. Whereas library scenarios aren’t always obvious due to how generic and varied usage can be.
Interesting that people Disagree over this
• • •
Missing some Tweet in this thread? You can try to
force a refresh
can someone explain why *exactly* this proof doesn’t work for an infinite number of sets? usually when we prove things with induction they work “all the way” so what’s the concrete thing stopping the train here?
ok i see. so we can only use induction because we have "n" here. and we show that it works for all n. however, whichever n we pick, it’s finite. so we’ve only shown this works for all finite sets.
for an infinite set, we have to get rid of "n", but then we can’t induct on it...
in other words, just because induction lets us generate an infinite number of proofs, none of these proofs are constructing infinite objects by themselves
is it ethical to wake up the humanity living in a Matrix into the ugly real world where their bodies are atrophied and everything looks like shit? feels like a “crime against humanity” territory somehow
at least Neo opted in but what would opt-in look like at a global scale? and what’s the point if the real world is shittier than this one? might as well put resources into making the Matrix better. who’s to say the real world is the real one anyway, maybe it’s a Hell simulation
maybe there could be mass opt-in centers where you can get the red pill. people from “real world” would regularly visit the Matrix to tell the story of the outer world, share footage, recruit volunteers to rebuild.
if you designed a one-year CURRICULUM. assume students start after highschool, have infinite curiosity and good aptitude. assume no specialization. what would you put there? what courses, works, schools of thought would you unmissable? what are educations’s best hits & deep cuts?
i’m biased but i obviously think theory of relativity has to be there. not in some deep way where you sit down to calculate some tensor shit but in a funny way, where people gain an intuition about how trains get all weird and quirky when they run close to the speed of light
i would want some tldr of philosophy. meme versions of every big philosophical movement. at the exam students will make memes roasting other memes through the prism of the meta-contextual discourse and then post them on twitter
the thing nobody tells you if you’re learning mathematics alone is that it’s okay to spend ten minutes reading and thinking about a skngle sentence. it’s not just okay but encouraged. densely packed ideas are the norm there
the approach that’s working out for me so far is doing two reads. one where i skip over at any minor inconvenience and another where i don’t proceed until I understand 100%
the first time i read Tao’s Analysis i did it in two days. but i’ve been doing a close re-read for over two months now and i’m still on page 67 out of 300. (now i’m doing *all* exercises.)
what is a good intuition for why a Cartesian product of no sets is not an empty set?
i’m thinking it’s probably similar to there being one empty function (“only one way to map nothing to nothing”) but i wonder if there are other more obvious ways to think about it
maybe one way to think is
let product = []
let tuple = []
for each choice_strategy
for each set in input_sets
let choice = choice_strategy(set)
tuple.push(choice)
product.push(tuple)
there’s always a choice_strategy even if there are no input_sets
it always surprises me when some term in programming turns out to be US military slang. like, i get *why* historically but in all other ways its connection to computing feels so foreign and unnatural