billion-dollar mistake

10 results back to index


pages: 47 words: 8,976

Learning TypeScript: Enhance Your Web Development Skills Using Type-Safe JavaScript by Josh Goldberg

billion-dollar mistake, type inference

TypeScript is part of a surge of modern programming languages that utilizes strict null checking to fix the dreaded “billion dollar mistake”. The Billion Dollar Mistake The “billion dollar mistake” is a catchy industry term for many type systems allowing values such as null to be used in places that require a different type. In languages without strict null checking, code like example that assign null to a string is allowed: const firstName: string = null; If you’ve previously worked in a typed language such as C++ or Java that suffers from the billion dollar mistake, it may be surprising to you that some languages don’t allow such a thing.

In languages without strict null checking, code like example that assign null to a string is allowed: const firstName: string = null; If you’ve previously worked in a typed language such as C++ or Java that suffers from the billion dollar mistake, it may be surprising to you that some languages don’t allow such a thing. If you’re never worked in a language with the billion dollar mistake before, it may be surprising that some languages do allow such a thing in the first place! In the words of the developer who coined the phrase: I call it my billion-dollar mistake. It was the invention of the null reference in 1965… This has led to innumerable errors, vulnerabilities, and system crashes, which have probably caused a billion dollars of pain and damage in the last forty years. Tony Hoare, 2009 The TypeScript compiler has an --strictNullChecks option to toggle whether strict null checking is enabled.

"Tony Hoare" : undefined; nameMaybe.toLowerCase(); Roughly speaking, disabling strict null checking adds | null | undefined to every type in your code, thereby allowing any variable to receive null or undefined. TypeScript best practice is generally to enable strict null checking. Doing so helps prevent crashes and eliminates the billion dollar mistake. With strict null checking enabled, TypeScript sees the potential crash in the code snippet: let nameMaybe = Math.random() ? "Tony Hoare" : undefined; nameMaybe.toLowerCase(); // Error: Object is possibly 'undefined'. Truthiness Narrowing TypeScript can also narrow a variable’s type from a truthiness check if only some of its potential values may be truthy.


pages: 448 words: 71,301

Programming Scala by Unknown

billion-dollar mistake, business logic, domain-specific language, duck typing, en.wikipedia.org, fault tolerance, functional programming, general-purpose programming language, higher-order functions, information security, loose coupling, type inference, web application

Because Scala runs on the JVM and .NET and because it must interoperate with other libraries, Scala has to support null. Still, you should avoid using null in your code. Tony Hoare, who invented the null reference in 1965 while working on an objectoriented language called ALGOL W, called its invention his “billion dollar mistake” (see [Hoare2009]). Don’t contribute to that figure. So, how would you write a method that returns an Option? Here is a possible implementation of get that could be used by a concrete subclass of Map (Map.get itself is abstract). For a more sophisticated version, see the implementation of get in scala.collection.immutable.HashMap in the Scala library source code distribution: def get(key: A): Option[B] = { if (contains(key)) new Some(getValue(key)) else None } The contains method is also defined for Map.

For fixed sets of more complex, constant objects, use sealed case objects. Using Nulls Versus Options When we introduced Option in “Option, Some, and None: Avoiding nulls” on page 41, we briefly discussed how it encourages avoiding null references in your code, which Tony Hoare, who introduced the concept of null in 1965, called his “billion dollar mistake” (see [Hoare2009]). Scala has to support null, because null is supported on both the JVM and .NET and other libraries use null. In fact, null is used by some Scala libraries. What if null were not available? How would that change your designs? The Map API offers some useful examples. Consider these two Map methods: trait Map[A,+B] { ... def get(key: A) : Option[B] def getOrElse [B2 >: B](key : A, default : => B2) : B2 = ... ... } A map may not have a value for a particular key.

Finally, recall from “Partial Functions” on page 183 that the case user => ... statements, for example, cause the compiler to generate a PartialFunction to pass to flatMap and map, so no corresponding foo match {...} style wrappers are necessary. Using Options with for comprehensions eliminate the need for most “null/empty” checks. Exceptions and the Alternatives If nulls are the “billion dollar mistake” as we discussed in “Option, Some, and None: Avoiding nulls” on page 41, then what about exceptions? You can argue that nulls should never occur and you can design a language and libraries that never use them. However, exceptions have a legitimate place because they separate the concerns of normal program flow from “exceptional” program flow.


pages: 821 words: 178,631

The Rust Programming Language by Steve Klabnik, Carol Nichols

anti-pattern, billion-dollar mistake, bioinformatics, business logic, business process, cryptocurrency, data science, DevOps, duck typing, Firefox, functional programming, Internet of things, iterative process, pull request, reproducible builds, Ruby on Rails, type inference

Rust doesn’t have the null feature that many other languages have. Null is a value that means there is no value there. In languages with null, variables can always be in one of two states: null or not-null. In his 2009 presentation “Null References: The Billion Dollar Mistake,” Tony Hoare, the inventor of null, has this to say: I call it my billion dollar mistake. At that time, I was designing the first comprehensive type system for references in an object-oriented language. My goal was to ensure that all use of references should be absolutely safe, with checking performed automatically by the compiler.

Matches in Rust are exhaustive: we must exhaust every last possibility in order for the code to be valid. Especially in the case of Option<T>, when Rust prevents us from forgetting to explicitly handle the None case, it protects us from assuming that we have a value when we might have null, thus making the billion-dollar mistake discussed earlier. The _ Placeholder Rust also has a pattern we can use when we don’t want to list all possible values. For example, a u8 can have valid values of 0 through 255. If we only care about the values 1, 3, 5, and 7, we don’t want to have to list out 0, 2, 4, 6, 8, 9 all the way up to 255.


pages: 629 words: 83,362

Programming TypeScript by Boris Cherny

billion-dollar mistake, bitcoin, business logic, database schema, don't repeat yourself, duck typing, Firefox, functional programming, Internet of things, pull request, source of truth, SQL injection, type inference, web application

Then, when something really is null, you get a dreaded null pointer exception at runtime: function addDeliciousFish(pizza: Pizza) { return pizza.addAnchovies() // Uncaught TypeError: Cannot read } // property 'addAnchovies' of null // TypeScript lets this fly with strictNullChecks = false addDeliciousFish(null) null has been called the “billion dollar mistake” by the guy that introduced it in the 1960s. The problem with null is it’s something that most languages’ type systems can’t express and don’t check for; so when a programmer tries to do something with a variable that they thought was defined but it actually turns out to be null at runtime, the code throws a runtime exception!


pages: 316 words: 94,886

Decisive: How to Make Better Choices in Life and Work by Chip Heath, Dan Heath

behavioural economics, billion-dollar mistake, call centre, Captain Sullenberger Hudson, Cass Sunstein, classic study, Daniel Kahneman / Amos Tversky, en.wikipedia.org, endowment effect, Great Leap Forward, hindsight bias, index fund, it is difficult to get a man to understand something, when his salary depends on his not understanding it, job satisfaction, Kevin Kelly, loss aversion, Max Levchin, medical residency, mental accounting, meta-analysis, Mikhail Gorbachev, PalmPilot, Paradox of Choice, pattern recognition, Peter Thiel, pets.com, Richard Thaler, Ronald Reagan, shareholder value, Silicon Valley, unpaid internship, Upton Sinclair, US Airways Flight 1549, young professional

This is an insightful book for leaders in government, health care, public safety, and technology who need to prepare for the unexpected. Paul B. Carroll and Chunka Mui (2008). Billion Dollar Lessons: What You Can Learn from the Most Inexcusable Business Failures of the Last 25 Years. The authors, a journalist and a consultant, analyze a series of billion-dollar mistakes in the business world and share advice on how to avoid similar mistakes (on a smaller scale). If you’re involved in strategic decisions for your organization, this book will help you avoid major pitfalls. John Mullins and Randy Komisar (2009). Getting to Plan B: Breaking Through to a Better Business Model.


pages: 406 words: 105,602

The Startup Way: Making Entrepreneurship a Fundamental Discipline of Every Enterprise by Eric Ries

activist fund / activist shareholder / activist investor, Affordable Care Act / Obamacare, Airbnb, AOL-Time Warner, autonomous vehicles, barriers to entry, basic income, Ben Horowitz, billion-dollar mistake, Black-Scholes formula, Blitzscaling, call centre, centralized clearinghouse, Clayton Christensen, cognitive dissonance, connected car, corporate governance, DevOps, Elon Musk, en.wikipedia.org, fault tolerance, financial engineering, Frederick Winslow Taylor, global supply chain, Great Leap Forward, hockey-stick growth, index card, Jeff Bezos, Kickstarter, Lean Startup, loss aversion, machine readable, Marc Andreessen, Mark Zuckerberg, means of production, minimum viable product, moral hazard, move fast and break things, obamacare, PalmPilot, peer-to-peer, place-making, rent-seeking, Richard Florida, Sam Altman, Sand Hill Road, scientific management, secular stagnation, shareholder value, Sheryl Sandberg, Silicon Valley, Silicon Valley startup, six sigma, skunkworks, Steve Jobs, TechCrunch disrupt, the scientific method, time value of money, Toyota Production System, two-pizza team, Uber for X, universal basic income, web of trust, Y Combinator

It’s why the Lean Startup movement is so focused on scientific “validated learning” as a unit of progress. 11. psychologytoday.com/​blog/​wired-success/​201511/​why-financial-incentives-don-t-improve-performance. 12. steveblank.com/​2010/​11/​01/​no-business-plan-survives-first-contact-with-a-customer-%E2%80%93-the-5-2-billion-dollar-mistake/. 13. Remarks at the National Defense Executive Reserve Conference, November 14, 1957; presidency.ucsb.edu/​ws/​?pid=10951. 14. Most boards are composed of representatives from three groups: insiders (founders and employees), investors, and independent directors. The most common configuration in my experience is 2/2/1 for a total of five directors.


The Future of Money by Bernard Lietaer

agricultural Revolution, Alan Greenspan, Alvin Toffler, banks create money, barriers to entry, billion-dollar mistake, Bretton Woods, business cycle, clean water, complexity theory, corporate raider, currency risk, dematerialisation, discounted cash flows, diversification, fiat currency, financial deregulation, financial innovation, floating exchange rates, full employment, geopolitical risk, George Gilder, German hyperinflation, global reserve currency, Golden Gate Park, Howard Rheingold, informal economy, invention of the telephone, invention of writing, John Perry Barlow, Lao Tzu, Lewis Mumford, low interest rates, Mahatma Gandhi, means of production, microcredit, Money creation, money: store of value / unit of account / medium of exchange, Norbert Wiener, North Sea oil, offshore financial centre, pattern recognition, post-industrial society, price stability, Recombinant DNA, reserve currency, risk free rate, Ronald Reagan, San Francisco homelessness, seigniorage, Silicon Valley, South Sea Bubble, The Future of Employment, the market place, the payments system, Thomas Davenport, trade route, transaction costs, trickle-down economics, two and twenty, working poor, world market for maybe five computers

Specifically in our case, the consequences of a shift of control over money systems to various new players in society will be highlighted. 3. To work creatively with these discoveries, and use the clarity they inspire to shape a more desirable future. Scenarios are not academic exercises. The scenario-building process enabled Shell to forecast and prepare for the fall of the former Soviet Union, thereby avoiding billion-dollar mistakes in North Sea oil investments. Shell still updates its scenarios roughly every three years. This process also contributed to the 'South African miracle' of the peaceful transition after Apartheid (see sidebar). These same methods were further refined by the Global Business Network founded by several Shell alumni, and later published by Peter Schwartz.


pages: 424 words: 115,035

How Will Capitalism End? by Wolfgang Streeck

"there is no alternative" (TINA), accounting loophole / creative accounting, air traffic controllers' union, Airbnb, Alan Greenspan, basic income, behavioural economics, Ben Bernanke: helicopter money, billion-dollar mistake, Bretton Woods, business cycle, capital controls, Capital in the Twenty-First Century by Thomas Piketty, Carmen Reinhart, central bank independence, centre right, Clayton Christensen, collective bargaining, conceptual framework, corporate governance, creative destruction, credit crunch, David Brooks, David Graeber, debt deflation, deglobalization, deindustrialization, disruptive innovation, en.wikipedia.org, eurozone crisis, failed state, financial deregulation, financial innovation, first-past-the-post, fixed income, full employment, Gini coefficient, global reserve currency, Google Glasses, haute cuisine, income inequality, information asymmetry, invisible hand, John Maynard Keynes: Economic Possibilities for our Grandchildren, junk bonds, Kenneth Rogoff, labour market flexibility, labour mobility, late capitalism, liberal capitalism, low interest rates, market bubble, means of production, military-industrial complex, moral hazard, North Sea oil, offshore financial centre, open borders, pension reform, plutocrats, Plutonomy: Buying Luxury, Explaining Global Imbalances, post-industrial society, private sector deleveraging, profit maximization, profit motive, quantitative easing, reserve currency, rising living standards, Robert Gordon, savings glut, secular stagnation, shareholder value, sharing economy, sovereign wealth fund, tacit knowledge, technological determinism, The Future of Employment, The Theory of the Leisure Class by Thorstein Veblen, The Wealth of Nations by Adam Smith, Thorstein Veblen, too big to fail, transaction costs, Uber for X, upwardly mobile, Vilfredo Pareto, winner-take-all economy, Wolfgang Streeck

By late July of the pre-election year of 2015, total campaign contributions already amounted to $388 million. ‘Small Pool of Rich Donors Dominates Election Giving’, New York Times, 1 August 2015, nytimes.com, last accessed 12 August 2015. For a broader account see David Cole, ‘The Supreme Court’s Billion-Dollar Mistake’, New York Review of Books, 19 January 2015: ‘Over the five years since [the Court’s Citizens United rule], super PACs have spent more than one billion dollars on federal election campaigns … About 60 percent of that billion dollars has come from just 195 people … The average donation over $200 of the ironically named Ending Spending, a conservative PAC, was $502,188 …’ For the 2016 election campaign, the brothers Charles G. and David H.


pages: 455 words: 133,322

The Facebook Effect by David Kirkpatrick

"World Economic Forum" Davos, Andy Kessler, AOL-Time Warner, Benchmark Capital, billion-dollar mistake, Burning Man, delayed gratification, demand response, don't be evil, global village, happiness index / gross national happiness, Howard Rheingold, Jeff Bezos, Marc Andreessen, Marc Benioff, Mark Zuckerberg, Marshall McLuhan, Max Levchin, Menlo Park, Network effects, Peter Thiel, rolodex, Salesforce, Sand Hill Road, sharing economy, Sheryl Sandberg, Silicon Valley, Silicon Valley startup, Skype, social graph, social software, social web, SoftBank, Startup school, Steve Ballmer, Steve Jobs, Stewart Brand, the payments system, The Wealth of Nations by Adam Smith, UUNET, Whole Earth Review, winner-take-all economy, Y Combinator, Yochai Benkler

The polished and well-liked son of a wealthy Brazilian business magnate, Saverin was an officer in the college Investment Club and a superb chess player who was known by his friends as a math genius. The two nineteen-year-olds agreed to invest $1,000 each. (Joe Green says Zuckerberg also approached him to be a business partner, but when Professor Green heard about it, he got “kind of pissed,” so Joe declined. Later he took to calling it, always with a pained laugh, his “billion-dollar mistake.”) On the afternoon of Wednesday, February 4, 2004, Zuckerberg clicked a link on his account with Manage.com. Thefacebook.com went live. Its home screen read: “Thefacebook is an online directory that connects people through social networks at colleges. We have opened up Thefacebook for popular consumption at Harvard University.


pages: 669 words: 210,153

Tools of Titans: The Tactics, Routines, and Habits of Billionaires, Icons, and World-Class Performers by Timothy Ferriss

Abraham Maslow, Adam Curtis, Airbnb, Alexander Shulgin, Alvin Toffler, An Inconvenient Truth, artificial general intelligence, asset allocation, Atul Gawande, augmented reality, back-to-the-land, Ben Horowitz, Bernie Madoff, Bertrand Russell: In Praise of Idleness, Beryl Markham, billion-dollar mistake, Black Swan, Blue Bottle Coffee, Blue Ocean Strategy, blue-collar work, book value, Boris Johnson, Buckminster Fuller, business process, Cal Newport, call centre, caloric restriction, caloric restriction, Carl Icahn, Charles Lindbergh, Checklist Manifesto, cognitive bias, cognitive dissonance, Colonization of Mars, Columbine, commoditize, correlation does not imply causation, CRISPR, David Brooks, David Graeber, deal flow, digital rights, diversification, diversified portfolio, do what you love, Donald Trump, effective altruism, Elon Musk, fail fast, fake it until you make it, fault tolerance, fear of failure, Firefox, follow your passion, fulfillment center, future of work, Future Shock, Girl Boss, Google X / Alphabet X, growth hacking, Howard Zinn, Hugh Fearnley-Whittingstall, Jeff Bezos, job satisfaction, Johann Wolfgang von Goethe, John Markoff, Kevin Kelly, Kickstarter, Lao Tzu, lateral thinking, life extension, lifelogging, Mahatma Gandhi, Marc Andreessen, Mark Zuckerberg, Mason jar, Menlo Park, microdosing, Mikhail Gorbachev, MITM: man-in-the-middle, Neal Stephenson, Nelson Mandela, Nicholas Carr, Nick Bostrom, off-the-grid, optical character recognition, PageRank, Paradox of Choice, passive income, pattern recognition, Paul Graham, peer-to-peer, Peter H. Diamandis: Planetary Resources, Peter Singer: altruism, Peter Thiel, phenotype, PIHKAL and TIHKAL, post scarcity, post-work, power law, premature optimization, private spaceflight, QWERTY keyboard, Ralph Waldo Emerson, Ray Kurzweil, recommendation engine, rent-seeking, Richard Feynman, risk tolerance, Ronald Reagan, Salesforce, selection bias, sharing economy, side project, Silicon Valley, skunkworks, Skype, Snapchat, Snow Crash, social graph, software as a service, software is eating the world, stem cell, Stephen Hawking, Steve Jobs, Stewart Brand, superintelligent machines, TED Talk, Tesla Model S, The future is already here, the long tail, The Wisdom of Crowds, Thomas L Friedman, traumatic brain injury, trolley problem, vertical integration, Wall-E, Washington Consensus, We are as Gods, Whole Earth Catalog, Y Combinator, zero-sum game

It was just huge and went up to $129M domestically, and I think worldwide it was $269M or something like that.” TF: This reminded me of the deal that George Lucas crafted for Star Wars, in which the studio effectively said, “Toys? Yeah, sure, whatever. You can have the toys.” That was a multi-billion-dollar mistake that gave Lucas infinite financing for life (an estimated 8,000,000,000+ units sold to date). When deal-making, ask yourself: Can I trade a short-term, incremental gain for a potential longer-term, game-changing upside? Is there an element here that might be far more valuable in 5 to 10 years (e.g., ebook rights 10 years ago)?


Designing Data-Intensive Applications: The Big Ideas Behind Reliable, Scalable, and Maintainable Systems by Martin Kleppmann

active measures, Amazon Web Services, billion-dollar mistake, bitcoin, blockchain, business intelligence, business logic, business process, c2.com, cloud computing, collaborative editing, commoditize, conceptual framework, cryptocurrency, data science, database schema, deep learning, DevOps, distributed ledger, Donald Knuth, Edward Snowden, end-to-end encryption, Ethereum, ethereum blockchain, exponential backoff, fake news, fault tolerance, finite state, Flash crash, Free Software Foundation, full text search, functional programming, general-purpose programming language, Hacker News, informal economy, information retrieval, Internet of things, iterative process, John von Neumann, Ken Thompson, Kubernetes, Large Hadron Collider, level 1 cache, loose coupling, machine readable, machine translation, Marc Andreessen, microservices, natural language processing, Network effects, no silver bullet, operational security, packet switching, peer-to-peer, performance metric, place-making, premature optimization, recommendation engine, Richard Feynman, self-driving car, semantic web, Shoshana Zuboff, social graph, social web, software as a service, software is eating the world, sorting algorithm, source of truth, SPARQL, speech recognition, SQL injection, statistical model, surveillance capitalism, systematic bias, systems thinking, Tragedy of the Commons, undersea cable, web application, WebSocket, wikimedia commons

., developers.google.com. [17] Igor Anishchenko: “Thrift vs Protocol Buffers vs Avro - Biased Comparison,” slideshare.net, September 17, 2012. [18] “A Matrix of the Features Each Individual Language Library Supports,” wiki.apache.org. [19] Martin Kleppmann: “Schema Evolution in Avro, Protocol Buffers and Thrift,” martin.kleppmann.com, December 5, 2012. [20] “Apache Avro 1.7.7 Documentation,” avro.apache.org, July 2014. [21] Doug Cutting, Chad Walters, Jim Kellerman, et al.: “[PROPOSAL] New Subpro‐ ject: Avro,” email thread on hadoop-general mailing list, mail-archives.apache.org, April 2009. [22] Tony Hoare: “Null References: The Billion Dollar Mistake,” at QCon London, March 2009. [23] Aditya Auradkar and Tom Quiggle: “Introducing Espresso—LinkedIn’s Hot New Distributed Document Store,” engineering.linkedin.com, January 21, 2015. [24] Jay Kreps: “Putting Apache Kafka to Use: A Practical Guide to Building a Stream Data Platform (Part 2),” blog.confluent.io, February 25, 2015. [25] Gwen Shapira: “The Problem of Managing Schemas,” radar.oreilly.com, Novem‐ ber 4, 2014. [26] “Apache Pig 0.14.0 Documentation,” pig.apache.org, November 2014. [27] John Larmouth: ASN.1 Complete.


pages: 1,237 words: 227,370

Designing Data-Intensive Applications: The Big Ideas Behind Reliable, Scalable, and Maintainable Systems by Martin Kleppmann

active measures, Amazon Web Services, billion-dollar mistake, bitcoin, blockchain, business intelligence, business logic, business process, c2.com, cloud computing, collaborative editing, commoditize, conceptual framework, cryptocurrency, data science, database schema, deep learning, DevOps, distributed ledger, Donald Knuth, Edward Snowden, end-to-end encryption, Ethereum, ethereum blockchain, exponential backoff, fake news, fault tolerance, finite state, Flash crash, Free Software Foundation, full text search, functional programming, general-purpose programming language, Hacker News, informal economy, information retrieval, Infrastructure as a Service, Internet of things, iterative process, John von Neumann, Ken Thompson, Kubernetes, Large Hadron Collider, level 1 cache, loose coupling, machine readable, machine translation, Marc Andreessen, microservices, natural language processing, Network effects, no silver bullet, operational security, packet switching, peer-to-peer, performance metric, place-making, premature optimization, recommendation engine, Richard Feynman, self-driving car, semantic web, Shoshana Zuboff, social graph, social web, software as a service, software is eating the world, sorting algorithm, source of truth, SPARQL, speech recognition, SQL injection, statistical model, surveillance capitalism, systematic bias, systems thinking, Tragedy of the Commons, undersea cable, web application, WebSocket, wikimedia commons

[19] Martin Kleppmann: “Schema Evolution in Avro, Protocol Buffers and Thrift,” martin.kleppmann.com, December 5, 2012. [20] “Apache Avro 1.7.7 Documentation,” avro.apache.org, July 2014. [21] Doug Cutting, Chad Walters, Jim Kellerman, et al.: “[PROPOSAL] New Subproject: Avro,” email thread on hadoop-general mailing list, mail-archives.apache.org, April 2009. [22] Tony Hoare: “Null References: The Billion Dollar Mistake,” at QCon London, March 2009. [23] Aditya Auradkar and Tom Quiggle: “Introducing Espresso—LinkedIn’s Hot New Distributed Document Store,” engineering.linkedin.com, January 21, 2015. [24] Jay Kreps: “Putting Apache Kafka to Use: A Practical Guide to Building a Stream Data Platform (Part 2),” blog.confluent.io, February 25, 2015