O'Reilly logo

Reliable JavaScript: How to Code Safely in the World's Most Dangerous Language by Seth Richards, Lawrence Spencer

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

CHAPTER 16 Conforming to Interfaces in an Interface-Free Language

WHAT’S IN THIS CHAPTER?            

  • Understanding the benefits of interfaces in other languages
  • Gaining the benefits of interfaces in JavaScript
  • Simplifying consumption of an object with the Interface Segregation Principle
  • Producing a registry in which you can define and enforce interfaces

WROX.COM CODE DOWNLOADS FOR THIS CHAPTER

The wrox.com code downloads for this chapter are found at www.wrox.com/go/reliablejavascript on the Download Code tab. The files are in the Chapter 16 download and individually named according to the filenames noted throughout this chapter.

In a 2014 commercial for Google’s business products (https://www.youtube.com/watch?v=bA0Hmhnl1oE), a videoconference is just finishing:

  • GOOGLER: So yeah, I think we’re good. I think that about wraps it up. So ...
  • WOMAN #1: Great. I’ll send a follow-up email.
  • GOOGLER: I don’t ... There’s nothing much to follow up on so I ...
  • WOMAN #2: Well, I think we should regroup.
  • GOOGLER: We just regrouped. This is the regrouping.
  • MAN #1: Cool. I’ll ping you later.
  • GOOGLER: You’re pinging me now. What do you want to ping about?
  • MAN #2: Next steps?
  • GOOGLER: There are no next steps. We just solved them.
  • MAN #3: Huh. All right ...

A conversation between a JavaScript programmer and a C# or Java programmer could go much the same way. The JavaScripter throws some objects together and the C# or Java developer keeps insisting, “You can’t do that! The program will fall ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required