Roam Notes on “RailsConf 2017: How to Write Better Code Using Mutation Testing” by John Backus

  • "Author::" [[John Backus]]
  • "Source::" [[YouTube]]
  • "Recommended By::" [[John Backus]]
  • "Tags::" #programming #testing #Videos
  • "Roam Notes URL::" https://www.marknagelberg.com/roam-notes-on-railsconf-2017-how-to-write-better-code-using-mutation-testing-by-john-backus/
  • "Anki Tag::" backus_mutation_testing
  • "Anki Deck Link::" link
  • {{[video]: https://www.youtube.com/watch?v=uB7m9T7ymn8&feature=emb_title}}
  • Overview
    • [[John Backus]] gives an overview of [[mutation testing]] and why you should use it.
  • Introduction #Ankified
    • Line Coverage Formula = Lines of Code run by Test / Total Lines of code in the Project
    • Mutation Coverage: How much of your code can I change without breaking your tests?
      • If you can remove a line of code or meaningfully change the code without breaking a test, something is probably wrong: you’re missing a test or it’s dead code.
  • Benefits of [[mutation testing]]:
    • Learning about your programming language and the code you rely on
      • Mutation testing frameworks have many special case mutations baked into the tool that you likely wouldn’t think of on your own. They teach you things about your language and the code you rely on, and you learn about them just-in-time.
      • It makes you a better developer: "Mutation testing has been the most powerful source of growth for me in the past few years"
      • You not only learn more about the code, but you learn faster. The feedback loop is fast, and you learn more per unit of time spent coding.
    • Ship code with fewer bugs
      • Introduce fewer regressions to code, since it lets you see hotspots where you could break the code without failing the test, resulting in a bug that you would only find in production. #Ankified
      • It teaches you better testing skills – it forces you to think more about different conditions that can happen and the expected behaviour of your code.
    • X-Raying Legacy Code #[[legacy]]
      • Helps you find hot spots in legacy code, where you could potentially introduce a regression and the tests won’t fail. It gives you a checklist, and in each case you determine if you should change your tests or your code.
    • Dead Code Detection
      • Dead Code: code that is never executed, or when executed has no effect on the program. #Ankified
      • Often shows you’re using redundant code, without consulting programming language’s documentation or coworkers.
    • Better Test Coverage
  • Is it Practical? (30:15) #Ankified
    • You might be wondering – I open PRs that are hundreds of lines long and my tests take hours to run. How is this practical?
    • You can run mutation test only on code that has changed since a specified Git revision.
    • You can specify a particular method you want to run the mutation tests on.
  • Mutation Testing on the Job
    • You should run mutation tests before you push code. You’ll learn more, write better code, and grow faster than your colleagues that refuse to use it.
    • If you’re a team lead, incorporate mutation tests into [[continuous integration]]. You don’t need 100% mutation coverage to benefit.

For access to my shared Anki deck and Roam Research notes knowledge base as well as regular updates on tips and ideas about spaced repetition and improving your learning productivity, join “Download Mark’s Brain”.

Roam Notes and Anki Deck on “Notes on Technology in the 2020s” by Eli Dourado

  • Title:: Notes on Technology in the 2020s
  • Author:: [[Eli Dourado]]
  • Recommended By:: [[Patrick Collison]] on Twitter https://twitter.com/patrickc/status/1345405936240742400
  • Reading Status:: #complete
  • Review Status:: #[[third pass]]
  • Tags:: #articles #technology #progress #innovation
  • URL:: https://elidourado.com/blog/notes-on-technology-2020s/
  • Source:: #instapaper
  • Anki Tag:: dourado_2020_tech
  • Anki Deck Link:: link
  • Notes

    • Overview
      • [[Eli Dourado]] thinks through how various promising technologies could evolve over the next decade. (View Highlight)
    • End of [[the great stagnation]]?
      • Metric marking the end of [[the great stagnation]] – sustained growth in utilization-adjusted [[total factor productivity]] of 2 percent per year. It was 2.1 percent over 1947-1972, only .17 percent since 2005. (Note: utilization-adjusted version is important since it corrects for the business cycle.) (View Highlight) #Ankified
      • Scientific breakthroughs alone are not enough to end the Great Stagnation. "TFP only budges when new technologies are adopted at scale, and generally this means products, not just science…This means building businesses, surmounting regulatory obstacles, and scaling production. (View Highlight) #commercialization #Ankified
    • [[Biotech]] and [[health]] (View Highlight)
      • [[mRNA vaccines]] provides the ability to encode and deploy arbitrary mRNA in our bodies—"it allows us to essentially program our cells to make whatever proteins we want". For [[COVID-19]], the vaccine instructs our cells to make the spike protein (View Highlight). mRNA technology can be deployed against non-viruses, like [[cancer]] (e.g. [[BioNTech]] treatment). (View Highlight) #[[Moderna]]
      • [[CRISPR]] is a technique for editing [[DNA]] discovered in 2012, but haven’t made a meaningful economic contribution yet—no treatment using CRISPR has been approved outside of [[clinical trials]]. (View Highlight) #Ankified
      • "[[DeepMind]] [[protein-folding]] breakthrough signals a promising decade for the science of [[proteomics]]. Most directly, being able to predict protein shapes will enable us to discover drugs more rapidly." But this is still a way off due to drug trials taking a long time. (View Highlight).
      • [[life extension]]: [[Conboy Lab at Berkeley]] helped prove that replacing plasma rejuvinates germ layer tissues and improves cognition by reducing neuroinflammation. (View Highlight) This is a product that could actually come to market – [[therapeutic plasma exchange]] is [[FDA]]-approved for other conditions (not aging), but could be provided off-label, and it’s cheap – "An automated [[plasmapheresis machine]]—which lets you do treatment after treatment—can be bought online for under $3,000". (View Highlight)
        • Another related product is [[aging clocks]] to know how biologically old you are – these are available today. (View Highlight)
        • [[metformin]] is something to look into if you are metabolically unhealthy. (View Highlight)
      • [[health sensors]] on [[wearables]] like Apple Watch are becoming better and more prevalent every year. (View Highlight)
      • "Let’s salute and cheer for the discoveries, but spare many thoughts for the entrepreneurs trying to bring treatments to market." (View Highlight) #commercialization
    • [[Energy]]
      • [[wind power]] and [[solar power]]: costs of these have decreased significantly over the 2010s but deployment is only 9% of utility-scale electricity generation in the US as of 2019. Going forward, cost reductions will stall, but deployment will increase. (View Highlight) #Ankified
        • Intermittency is a challenge. To reach a grid powered entirely by today’s renewables, we would need storage at a price of $20 per kWh (with caveats). To power the grid today entirely with renewables, would need price to be about $20 per kWh, while current prices are in the $500-$600 per kWh range. Increased demand could make price reductions in the future challenging. (View Highlight)
      • [[nuclear power]] or [[geothermal power]] seem to be required for scalable zero-carbon baseload energy.
        • [[nuclear power]] is challenging due to high costs
        • [[geothermal power]] is the most plausible this decade. This is apparently an area ripe for innovation: "The startups I have spoken to think with today’s technology they can crack 3.5¢/kWh without being confined to volcanic regions." Possibly 1¢/kWh by the 2050s, making it difficult for [[nuclear power]] to compete (View Highlight) #Ankified
      • [[sustainable alternative fuels (SAF)]] will be big in 2020s. Airlines can’t electrify since batteries can’t match fossil fuel energy density, which means airlines must go with [[hydrogen fuel]] or SAF. Dourado is betting on SAF over Hydrogen (esp. fuel made from CO2 from the atmosphere), since they are more energy dense. (View Highlight) #Ankified
    • [[transportation]]
      • [[electric cars]] – they’re better than regular cars due to lower fuel costs, lower maintenance costs (fewer moving parts), faster acceleration, higher low-end torque. (View Highlight) One exception is trucking, which may have to shift to hydrogen. This shift will significantly reduce air pollution from unregulated ultrafine particles; resulting in fewer premature birth, asthma, cancer, and mystery illness.
      • [[autonomous vehicles]] could happen at scale in 2020, and autonomy is inevitable eventually with constantly improving sensors and machine learning algorithms. (View Highlight)
      • [[supersonic aircraft]] will have a big impact on global business when it comes, but this is likely not in the 2020s. (View Highlight) [[urban air mobility]] may also happen (e.g. Joby, Wisk).
      • [[drone delivery]] is likely in the 2020s, with the [[FAA]] about to issue a rule expanding operations at night and flights over crowds. (View Highlight)
      • [[tunnels]] are a possible route in countries like the US where it is extremely difficult to build above-ground due to "promiscuous distribution of the veto power" (View Highlight). [[The Boring Company]] has a couple promising projects here, and Dourado is optimistic about the impact on commerce since time and hassle cost of travel is a key input to the [[gravity model of trade]].
    • [[space]]
      • [[SpaceX]] seems poised to dramatically reduce the cost of space exploration with [[Starship (SpaceX)]]. The Space Shuttle was about $65,000/kg to low earth orbit, [[Falcon 9 (SpaceX)]] is only $2,600/kg, and reasonable estimates suggest Starship could reach $10/kg. (View Highlight) #Ankified
      • Some consequences: commerce between Earth and space expands (e.g. manufacturing materials that can only be made in space, [[Starlink (SpaceX)]]), and less engineering required on payloads due to the consequences of losing them being lower. #[[gravity model of trade]] (View Highlight)
    • [[information technology]]
      • "[[custom silicon]] is going to be huge", due to incredible performance gains. Another name for this is [[system on a chip (SoC)]]. [[Apple M1]] is a notable example. "Almost all computer hardware—anything that has any scale to it—will move in this direction"
    • Conclusion
      • "It all depends on [[execution]]. The underlying science is there. The engineers are willing. Even the funding is available in most cases. But, as a society, how much urgency do we feel? Our culture does not prioritize [[progress]]—it fights, destructively, for [[status]]. And our politics reflects our culture." (View Highlight)

For access to my shared Anki deck and Roam Research notes knowledge base as well as regular updates on tips and ideas about spaced repetition and improving your learning productivity, join “Download Mark’s Brain”.