semantic versioning

back to index

description: scheme of software versioning highlighting the degree of compatibility of each version

21 results

pages: 629 words: 109,663

Docker in Action
by Jeff Nickoloff and Stephen Kuenzli
Published 10 Dec 2019

This approach enables software authors and operators to support environment-specific variation while maintaining traceability back to the originating sources and preserving a simple deployment workflow. 10.5.4. Semantic versioning Semantic versioning (https://semver.org/) is a popular approach to versioning artifacts with a version number of the form Major.Minor.Patch. The semantic versioning specification defines that as software changes, authors should increment the following: Major version when making incompatible API changes Minor version when adding functionality in a backward-compatible manner Patch version when making backward-compatible bug fixes Semantic versioning helps both publishers and consumers manage expectations for the kind of changes a consumer is getting when updating an image dependency.

The semantic versioning specification defines that as software changes, authors should increment the following: Major version when making incompatible API changes Minor version when adding functionality in a backward-compatible manner Patch version when making backward-compatible bug fixes Semantic versioning helps both publishers and consumers manage expectations for the kind of changes a consumer is getting when updating an image dependency. Authors who publish images to a large number of consumers or who must maintain several release streams for a long time often find semantic versioning or a similar scheme attractive. Semantic versioning is a good choice for images that many people depend on as a base operating system, language runtime, or database. Figure 10.7. Tag and publish image release with semantic versioning Suppose that after testing your image in dev and stage that you want to release your recent build of the example app as version 1.0.0 to your customers. You can use BUILD_ID to identify the image and tag it with 1.0.0: make tag BUILD_ID=$BUILD_ID TAG=1.0.0 Tagging the image as version 1.0.0 signals that you are ready to maintain backward compatibility in the operation of the software.

Record metadata at image build time 10.3.1. Orchestrating the build with make 10.4. Testing images in a build pipeline 10.5. Patterns for tagging images 10.5.1. Background 10.5.2. Continuous delivery with unique tags 10.5.3. Configuration image per deployment stage 10.5.4. Semantic versioning Summary 3. Higher-level abstractions and orchestration Chapter 11. Services with Docker and Compose 11.1. A service “Hello World!” 11.1.1. Automated resurrection and replication 11.1.2. Automated rollout 11.1.3. Service health and rollback 11.2. Declarative service environments with Compose V3 11.2.1.

pages: 725 words: 168,262

API Design Patterns
by Jj Geewax
Published 19 Jul 2021

And while it’s possible to coincidentally have code continue to work, the lack of a guarantee can be quite off-putting to anyone who would much rather have a stronger promise that their code will continue to function as intended for more than a fixed, relatively short window of time. 24.3.3 Semantic versioning Probably the most popular form of versioning out there today, semantic versioning (or SemVer; https://semver.org), is a very powerful tool that allows a single version label to convey quite a lot of meaning in three simple numbers. Most importantly, this meaning is practical: it can tell a user about the differences between two APIs and whether code written against one should continue to work with another. Let’s take a moment to look at how exactly this works. A semantic version string (illustrated in figure 24.4) is built up of three numbers separated by dots (e.g., 1.0.0 or 12.5.2), where each number increases as changes are made to an API and carries a different meaning about the change that was made to bring about this increase.

Keep the same major and minor version and release the patched code with an incremented patch version. As we explored in section 24.2.2, your compatibility policy will guide you to decide which category your change falls into; so as long as you follow it, semantic versioning works quite well. One major issue with semantic versioning, though, is the sheer number of versions available to the user (and to be managed as separate services). In other words, semantic versioning provides a huge number of versions to choose from, each with a varying set of functionality, to the point where users might end up quite confused. Additionally, since users will want to be able to pin to a specific, very granular version for as long as possible, this means that the web API must actually maintain and run lots of different versions of the API, which can become an infrastructural headache.

In other words, you can assume that any code written for a major version N is almost certainly not going to function as expected for a major version M. If it happens to actually work, it’s entirely coincidental and not at all due to any sort of guarantee by design. Figure 24.4 The different version numbers in a semantic version string The next number in a semantic version string is the minor version. This number is incremented when a backward compatible change is made according to the rules defined in the compatibility policy that is some new functionality or change in behavior. For example, if we were to add a new field to the API and we’ve defined this action as being backward compatible in our policy, then we would increment the minor version rather than the major version (e.g., from 1.0.0 to 1.1.0).

pages: 540 words: 103,101

Building Microservices
by Sam Newman
Published 25 Dec 2014

Once you realize you are going to break a consumer, you have the choice to either try to avoid the break altogether or else embrace it and start having the right conversations with the people looking after the consuming services. Use Semantic Versioning Wouldn’t it be great if as a client you could look just at the version number of a service and know if you can integrate with it? Semantic versioning is a specification that allows just that. With semantic versioning, each version number is in the form MAJOR.MINOR.PATCH. When the MAJOR number increments, it means that backward incompatible changes have been made. When MINOR increments, new functionality has been added that should be backward compatible.

reverse proxy, Client-Side, Proxy, and Server-Side Caching Riemann, The Future risk, spreading, Spreading Your Risk Robustness principle, Defer It for as Long as Possible Rx (reactive extensions), Reactive Extensions S SAML, Common Single Sign-On Implementations, Use SAML or OpenID Connect SAN (storage area networks), Spreading Your Risk scaling, Scaling-Starting Againautoscaling, Autoscaling benefits of, Scaling databases, Scaling Databases load balancing, Load Balancing reasons for, Scaling splitting workloads, Splitting Workloads spreading risk, Spreading Your Risk vertical, Go Bigger vs. redesign, Starting Again worker-based systems, Worker-Based Systems seams, concept of, It’s All About Seams security, Security-Summaryattacks, defending from, Defense in Depth authentication/authorization, Authentication and Authorization backups, Backup Data Pump, Encrypt Backups education/awareness of, Baking Security In encryption, Go with the Well Known example setup, A Worked Example external verification of, External Verification firewalls, Firewalls human element of, The Human Element importance of, Security intrusion detection/prevention, Intrusion Detection (and Prevention) System key storage, It’s All About the Keys logs, Logging man-in-the-middle attacks, Allow Everything Inside the Perimeter operating systems, Operating System overview of, Summary passwords, Go with the Well Known privacy issues, Be Frugal securing data at rest, Securing Data at Rest service-to-service authentication/authorization, Service-to-Service Authentication and Authorization tool selection, The Golden Rule virtual private clouds, Network Segregation Security Development Lifecycle, Baking Security In self-describing systems, HAL and the HAL Browser semantic monitoring, So Should You Use End-to-End Tests?, Synthetic Monitoring semantic versioning, Use Semantic Versioning server-side caching, Client-Side, Proxy, and Server-Side Caching service accounts, Use SAML or OpenID Connect service boundaries, Zoning(see also modeling services) service calls, data retrieval via, Data Retrieval via Service Calls service configuration, Service Configuration service discovery, Service Discovery service ownershipcomprehensive approach, Service Ownership shared, Drivers for Shared Services service provider, Common Single Sign-On Implementations service separation, staging, Staging the Break(see also database decomposition) service templates, Tailored Service Template service testsCohn's Test Pyramid, Test Scope implementation of, Implementing Service Tests mocking vs. stubbing, Mocking or Stubbing Mountebank server for, A Smarter Stub Service scope of, Service Tests service-oriented architectures (SOA)concept of, What About Service-Oriented Architecture?

When MINOR increments, new functionality has been added that should be backward compatible. Finally, a change to PATCH states that bug fixes have been made to existing functionality. To see how useful semantic versioning can be, let’s look at a simple use case. Our helpdesk application is built to work against version 1.2.0 of the customer service. If a new feature is added, causing the customer service to change to 1.3.0, our helpdesk application should see no change in behavior and shouldn’t be expected to make any changes. We couldn’t guarantee that we could work against version 1.1.0 of the customer service, though, as we may rely on functionality added in the 1.2.0 release.

pages: 214 words: 31,751

Software Engineering at Google: Lessons Learned From Programming Over Time
by Titus Winters , Tom Manshreck and Hyrum Wright
Published 17 Mar 2020

Rather, the value in pointing out this difference comes from recognizing that some tools are great in one domain but not in the other. You probably don’t need to rely on integration tests (see “Larger Scope Testing”) and continuous deployment practices (See “Continuous Deployment”) for a project that will last only a few days. Similarly, all of our long-term concerns about semantic versioning (SemVer) and dependency management in software engineering projects (See “Dependency Management”) don’t really apply for short-term programming projects: use whatever is available to solve the task at hand. We believe it is important to differentiate between the related-but-distinct terms “programming” and “software engineering”.

One of the biggest differences between external and internal dependencies is that external dependencies have versions, and those versions exist independently of the project’s source code. Automatic vs. Manual Dependency Management Build systems can allow the versions of external dependencies to be managed either manually or automatically. When managed manually, the buildfile explicitly lists the version it wants to download from the artifact repository, often using a semantic version string20 such as “1.1.4”. When managed automatically, the source file specifies a range of acceptable versions, and the build system always downloads the latest one. For example, Gradle allows a dependency version to be declared as “1.+” to specify that any minor or patch version of a dependency is acceptable so long as the major version is 1.

Automatically-managed dependencies can be convenient for small projects, but they’re usually a recipe for disaster on projects of non-trivial size or that are being worked on by more than one engineer. The problem with automatically-managed dependencies is that you have no control over when the version is updated. There’s no way to guarantee that external parties won’t make breaking updates (even when they claim to use semantic versioning), so a build that worked one day might be broken the next with no easy way to detect what changed or to roll it back to a working state. Even if the build doesn’t break, there may be subtle behavior or performance changes that are impossible to track down. In contrast, since manually-managed dependencies require a change in source control, they can be easily discovered and rolled back, and it’s possible to check out an older version of the repository to build with older dependencies.

Team Topologies: Organizing Business and Technology Teams for Fast Flow
by Matthew Skelton and Manuel Pais
Published 16 Sep 2019

An API (application programming interface) is a description and specification for how to interact programmatically with software, so we extend this idea to entire interactions with the team. The team API includes: Code: runtime endpoints, libraries, clients, UI, etc. produced by the team Versioning: how the team communicates changes to its code and services (e.g., using semantic versioning [SemVer] as a “team promise” not to break things) Wiki and documentation: especially how-to guides for the software owned by the team Practices and principles: the team’s preferred ways of working Communication: the team’s approach to remote communication tools, such as chat tools and video conferencing Work information: what the team is working on now, what’s coming next, and overall priorities in the short to medium term Other: anything else that other teams need to use to interact with the team The team API should explicitly consider usability by other teams: Will other teams find it easy and straightforward to interact with us, or will it be difficult and confusing?

This approach will require regular coordination between teams for features that impact two or more technology areas. Changes might need to be scheduled to the cloud platform’s APIs before a new software version can be deployed to the embedded devices. This coordination, however, should also serve to establish common ways of working between the teams (e.g., semantic versioning, logging approaches, API-first development). Over time, these shared practices and knowledge might enable a future restructure of team boundaries, as the pace of change becomes more similar across technologies. Summary: Choose Software Boundaries to Match Team Cognitive Load When optimizing for flow, stream-aligned teams should be responsible for a single domain.

Promise theory—devised by technologist and researcher Mark Burgess—explains how and why it is preferable to construct inter-team relationships in terms of promises rather than in terms of commands and enforceable contracts. For example, by adhering to the meaning of the major/minor/patch/build numbering indicated by semantic versioning (SemVer), the team promises not to break software that depends on their code.6 Team Behaviors for Collaboration Mode: “High Interaction and Mutual Respect” Teams interacting using the collaboration mode should expect to have high interaction and mutual respect with the collaborating team.

Terraform: Up and Running: Writing Infrastructure as Code
by Yevgeniy Brikman
Published 13 Mar 2017

Git tags are as stable as a commit (in fact, a tag is just a pointer to a commit) but they allow you to use any name you want. Versioned modules | 113 A particularly useful naming scheme for tags is semantic versioning.2 This is a version‐ ing scheme of the format MAJOR.MINOR.PATCH (e.g. 1.0.4) with specific rules on when you should increment each part of the version number. In particular, you should increment the… • MAJOR version when you make incompatible API changes, • MINOR version when you add functionality in a backwards-compatible manner, and • PATCH version when you make backwards-compatible bug fixes. Semantic versioning gives you a way to communicate to users of your module what kind of changes you’ve made and the implications of upgrading.

pages: 433 words: 130,334

Docker: Up & Running: Shipping Reliable Containers in Production
by Sean Kane and Karl Matthias
Published 14 May 2023

It is highly recommended that you tag your CI/CD builds with something that uniquely identifies the exact source code commit that was used to build them. In a git workflow, this could be the git hash related to the commit. Once you are ready to release an image, the recommendation is that you use semantic versioning and provide your image with tags, like 1.4.3, 2.0.0, etc. Pinning versions requires a bit more work to keep them current, but it will also prevent many unfortunate and poorly timed surprises during builds and deployments. Building Building applications is a black art in many organizations, where a few people know all the levers to pull and knobs to turn to spit out a well-formed, shippable artifact.

I IAM (Amazon Identity and Access Management), IAM Role Setup image registriesclient/server model, Client/Server Model custom registry mirror, Authenticating to a Registry private registries, Private Registriesrunning a private registry, Running a Private Registry-Testing the private registry public registries, Public Registries(see also Docker Hub; GitHub) pull-through image cache, Authenticating to a Registry pushing image to, Quick Overview image tagsabout Docker images, Important Terminology(see also Docker images) docker container run command, Alpine Linux, Quick Overview editing for Docker Hub username, Pushing images into a repository latest tag, Image tags, Downloading Image Updatesdeployment and, Downloading Image Updates not in production, Docker Swarm Mode testing and, Quick Overview revision control, Image tags semantic versioning, Image tags images (see OCI images) immutable infrastructurecontainer deployment for, Toward an Immutable Infrastructure immutable atomic hosts, Immutable atomic hosts installing Dockerabout, Installing Docker clientabout, Docker Client Fedora Linux, Fedora Linux 36 (64-bit) Linux, Docker Client-Fedora Linux 36 (64-bit) macOS, Docker Client, macOS, Mac OS X Ubuntu Linux, Ubuntu Linux 22.04 (64-bit) Windows, Docker Client, Microsoft Windows 11-Chocolatey installation docker group, Testing the Setup exploring Docker server, Exploring the Docker Server serverabout, Docker Server Docker Community Edition, Docker Server exploring, Exploring the Docker Server Fedora, Docker Server macOS on Docker Community Edition, Docker Server macOS VM via Docker Desktop, Non-Linux VM-Based Server Ubuntu, Docker Server Vagrant for server VM, Vagrant-Vagrant Windows on Docker Community Edition, Docker Server Windows VM via Docker Desktop, Non-Linux VM-Based Server testing the installation, Testing the Setup Internet Assigned Numbers Authority (IANA), Network Ports and Unix Sockets IP addressescontainer networking, Container Networking containers normally have their own, Network Inspection Docker host IP address determination, Running Your Image docker network inspect command, Network Inspection minikube ip command, minikube commands running a private registry, Running a Private Registrytesting the private registry, Testing the private registry IPC namespaces, Namespaces J jail command, History of Containers Jenkins build system, Buildingdaemons forking into background, Controlling Processes Docker plug-ins, Quick Overview job control by Docker in production, Job Control jq tool for output formatting, stats API endpoint JSONdaemon.json (see daemon.json configuration file) json-file logging plug-in, docker container logs-More Advanced Logging stats API endpoint for monitoring, stats API endpoint-stats API endpoint json-file logging plug-in, docker container logs-More Advanced Logging K k0s, Minikube k3d, Minikube k3s, Minikube k8s (see Kubernetes) Kata Containers runtime, Broad Support and Adoption kill command, Controlling Processespassing Unix signals, Controlling Processes kind, Kind-Kind kubectl commandabout, Installing Minikube apply, Deploying the application configcurrent-context, Docker Desktop-Integrated Kubernetes unset current-context, Docker Desktop-Integrated Kubernetes use-context, Docker Desktop-Integrated Kubernetes create, Let’s deploy something delete, kubectl APIdeployment, Let’s deploy something service, Let’s deploy something expose, Let’s deploy something getall, Let’s deploy something pvc, Deploying the application services, Let’s deploy something installing with MinikubeLinux, Linux macOS, macOS Windows, Windows logs, Scaling up proxy, kubectl API scale, Scaling up Kubernetesautomatic scheduler, Orchestration choice when building from scratch, Distributed schedulers Cloud Native Computing Foundation certifications, Distributed schedulers container-based scheduler, Distributed schedulers containerd runtime supported, Broad Support and Adoption, Distributed schedulers dockershim deprecation, The Road Ahead production orchestration, Robust Tooling public cloud provider offerings, Containers at Scale scalingabout, Kubernetes containers and pods, Kubernetes containers and pods-Kubernetes containers and pods dashboard, Kubernetes Dashboard deploying a production stack, Deploying a realistic stack deploying the application, Deploying the application-Deploying the application deployment, Let’s deploy something-Let’s deploy something Deployment definition, Deployment definition Docker Desktop, Docker Desktop-Integrated Kubernetes kind, Kind-Kind kubectl API, kubectl API-kubectl API Minikube, Minikube-kubectl API PersistentVolumeClaim definition, PersistentVolumeClaim definition running Kubernetes, Running Kubernetes scaling up, Scaling up-Scaling up Service definition, Service definition Kubernetes: Up and Running (Burns et al.), Kubernetes KVM, Vagrant L labels, Anatomy of a Dockerfile, Labels latest tag, Image tags, Downloading Image Updatesdeployment and, Downloading Image Updates not in production, Docker Swarm Mode testing and, Quick Overview libcontainer Go library, What Are Containers?

API, Docker Engine API bind mounts, Directory Caching building base images on various Linux distributions, Custom Base Images deprecation, Installing Docker docker image build, Building an Image filesystem backends, Storage filtering options, Cleaning Up Containers and Images installation, Docker Client installation on Ubuntu Linux, Ubuntu Linux 22.04 (64-bit) installation on Windows, Chocolatey installation networking, Container Networking rootless mode uninstall, Rootless Mode security, The Docker Daemon source code on GitHub, Introduction SSH or TLS client certificate, Vagrant Docker website, The Docker Ecosystem Dockerfiles documentation, Directory Caching Fedora CoreOS download link, Important Terminology Git installer, Building an Image Hypervisor framework documentation, GUI installer Windows containers documentation, Windows Containers responsive systems, Resilient REST API, Robust Tooling revision controlabout, Revision Control filesystem layers, Filesystem layers Git (see Git) GitHub (see GitHub) image tags, Image tagslatest tag, Image tags semantic versioning, Image tags RFC 1918 private subnet block, Container Networking Rocket.Chatabout, Exploring Rocket.Chat about startup, Launching Services Admin Info screen via browser, Exploring Rocket.Chat-Exploring Rocket.Chat Administration panel, Exploring Rocket.Chatclosing, Exploring Rocket.Chat cloning Git repository, Exploring Docker Compose configuration managementdefault values, Default Values-Default Values docker-compose.yaml, Configuring Docker Compose-Configuring Docker Compose mandatory values, Mandatory Values create new chat channel, Exploring Rocket.Chat exploring, Exploring Rocket.Chat-Exploring Rocket.Chat general channel, Exploring Rocket.Chat invite user, Exploring Rocket.Chat launching services, Launching Services-Launching Services setup via MongoDB with preconfigured database, Exploring Rocket.Chat user added, Exploring Rocket.Chat-Exploring Rocket.Chat rollbacksimage tags enabling, Image tags software update, Docker Swarm Mode root directory default, Server Information root running container processes, Anatomy of a Dockerfile root shell prompt for interactive containers, Hostname rootless containers, Namespacessecurity risk, Rootless Mode-Rootless Modeuninstalling rootless mode, Rootless Mode unprivileged context, Security RPM Package Manager, Docker Client run stage separate from build stage, Build, Release, Run runc as containerd default runtime, Broad Support and Adoption, Server Information runit, Controlling Processes runtimescontainerd and its runtimes, Broad Support and AdoptionKubernetes supporting containerd, Distributed schedulers runc as default, Broad Support and Adoption, Server Information crun runtime, Broad Support and Adoption gVisor runtime, Broad Support and Adoption, Namespaces, gVisor-gVisor Kata Containers runtime, Broad Support and Adoption Nabla Containers runtime, Broad Support and Adoption runc as default for containerd, Broad Support and Adoption, Server Information swapping, Swapping Runtimes-gVisor S s6, Controlling Processes saving a docker image to a tarball, Exploration scalingAmazon ECS and Fargateabout, Amazon ECS and Fargate AWS CLI setup, AWS CLI Setup container instances, Container Instances core AWS setup, Core AWS Setup Identity and Access Management, IAM Role Setup stopping the task, Stopping the Task-Stopping the Task tasks, Tasks-Tasks testing the task, Testing the Task container abstraction facilitating, Containers at Scale Docker Swarm mode, Docker Swarm Mode-Docker Swarm Modeoverlay network driver, Configuring networks horizontal with concurrency, Concurrency Kubernetesabout, Kubernetes containers and pods, Kubernetes containers and pods-Kubernetes containers and pods dashboard, Kubernetes Dashboard deploying a production stack, Deploying a realistic stack deploying the application, Deploying the application-Deploying the application deployment, Let’s deploy something-Let’s deploy something Deployment definition, Deployment definition Docker Desktop, Docker Desktop-Integrated Kubernetes kind, Kind-Kind kubectl API, kubectl API-kubectl API Minikube, Minikube-kubectl API PersistentVolumeClaim definition, PersistentVolumeClaim definition running Kubernetes, Running Kubernetes scaling up, Scaling up-Scaling up Service definition, Service definition load balancers for service discovery, Service Discovery plug-ins for, Quick Overview public cloud providersKubernetes offerings, Containers at Scale Linux container support, Containers at Scale running your own versus, Containers at Scale scheduling and Docker, Scheduling-Orchestrationdistributed schedulers, Distributed schedulers orchestration, Orchestration secretsdocker secret, Config .env (dotenv) file, The dotenv File git .gitignore file, The dotenv File HashiCorp Vault, Config private registry, Testing the private registryproduction, Testing the private registry Secure Computing Mode, Secure Computing Mode-Secure Computing Mode securityabout, Security AppArmor, SELinux and AppArmor Docker daemon, The Docker Daemonattack surface documentation, Vagrant documentation, The Docker Daemon gVisor runtime, Namespaces Linux capabilities--cap-add, Process Inspection, Privileged Containers, Secure Computing Mode-Secure Computing Mode, Debugging Shell-less Containers --cap-drop, Privileged Containers NET_ADMIN, Privileged Containers NET_RAW, Privileged Containers SYS_ADMIN, Secure Computing Mode-Secure Computing Mode, Debugging Shell-less Containers SYS_PTRACE, Process Inspection, Debugging Shell-less Containers mandatory access control, SELinux and AppArmor metrics and, Prometheus Monitoring privileged containers, Privileged Containers rootless mode security risk, Rootless Mode-Rootless Moderootless containers, Namespaces uninstalling rootless mode, Rootless Mode Secure Computing Mode, Secure Computing Mode-Secure Computing Mode SELinux, SELinux and AppArmor SSH or TLS client certificate documentation, Vagrant system calls, Containers in Detail, Secure Computing Mode-Secure Computing Mode UID 0 security risk, UID 0 unprivileged user context in production, Anatomy of a Dockerfile, Security Security-Enhanced Linux (SELinux), Limited Isolation SELinux security, SELinux and AppArmorvolume mounts, Storage Volumes semantic versioning for image tags, Image tags server, Important Terminology(see also Docker server; dockerd) serverless technologies, History of Containers servicesbacking services as attached resources, Backing Services disposability, Disposability Docker Compose launching services, Launching Services-Launching ServicesWindows, Launching Services Docker Swarm modelaunching first service, Docker Swarm Mode more services than nodes, Docker Swarm Mode scaling service up or down, Docker Swarm Mode draining off a single node, Docker Swarm Mode export services via port binding, Port Binding load balancers for service discovery, Service Discovery metadata about services, Docker Swarm Mode removing, Docker Swarm Mode service discoveryabout, Service Discovery Docker Compose, Service Discovery Docker’s role in production, Service Discovery-Service Discovery shell assumed to be traditional Unix, Installing Docker shell running in a container, Exploring the Shellexiting shell stops container, Exploring the Shell getting inside a running container, Getting Inside a Running Container-docker volumeabout, Getting Inside a Running Container docker container exec, Getting Inside a Running Container docker volume, docker volume-docker volume shell scripting versus Compose, Configuring Docker Compose-Configuring Docker Compose shell-less containers, Debugging Shell-less Containers SIGKILL signal when killing a container, Stopping a Container SIGTERM signal when stopping a container, Stopping a Container SIGUSR1 signal, Controlling Processes Spotify Helios, Orchestration SSHclient certificate documentation, Vagrant Docker server exploration, Exploring the Docker Server SSL encrypted connection port, Network Ports and Unix Sockets SSL keypair for private registry, Running a Private Registry, Testing the private registry stateless applications, Stateless Applications-Externalizing State stateless containers, Storage Volumes stats API endpoint for monitoring, stats API endpoint-stats API endpoint stderrcaptured in logging, Logging, Logginglog file json.log, docker container logs output from container, Returning a Result STDIN open with -i argument, Hostname stdoutcaptured in logging, Logging, Logginglog file json.log, docker container logs output from container, Returning a Result storage and retrieval optimized by Docker, Optimizing Storage and Retrieval storage backends for filesystem layers, Working with Docker Images, Storagecomparing storage backends, Storage-Storage storage volumes for Linux containers, Storage Volumes-Storage Volumesdocker volume command, docker volume SELinux, Storage Volumes storing Docker imagesabout, Storing Images custom registry mirror, Authenticating to a Registry Docker Hub, Public Registries, Authenticating to a Registry-Exploring images in Docker Hubcreating account, Creating a Docker Hub account editing image tags with username, Pushing images into a repository exploring images in, Exploring images in Docker Hub logging in, Logging in to a registry logging out, Logging in to a registry official curated images, Exploring images in Docker Hub pulling from repository, Pushing images into a repository pushing images, Pushing images into a repository private registries, Private Registriesrunning a private registry, Running a Private Registry-Testing the private registry public registries, Public Registries pull-through image cache, Authenticating to a Registry strace command, Process Inspection stress command, CPU shares subnet from unused private subnet block, Container Networking subscription-based delivery of images, Packaging and Delivery sudo before docker commands, Testing the Setupman page, Testing the Setup supervisordbuilding a Docker image, Building an Image Dockerfile anatomy, Anatomy of a Dockerfile, Anatomy of a Dockerfile, Anatomy of a Dockerfile Swarm mode (see Docker Swarm mode) system callschroot, History of Containers, Namespaces exit, Vagrant gVisor, gVisor history of container development, History of Containers mountBtrfs backend with loopback-mount, Storage namespaces, Namespaces networking, Host networking privileged containers, Privileged Containers root volume as read-only, Storage Volumes run within container, Hostname Secure Computing Mode, Secure Computing Mode read, Secure Computing Mode Secure Computing Mode, Containers in Detail, Secure Computing Mode-Secure Computing Mode sigreturn, Secure Computing Mode structure of Docker, The Structure of Docker umount, Secure Computing Modenamespaces, Namespaces write, Secure Computing Mode system events, docker system events-docker system events systemctl to start Docker server, Docker Serverrestarting the server, Prometheus Monitoring T tagscontent-addressable tag, Downloading Image Updates image tags, Important Terminology(see also image tags) TARGETARCH in Dockerfiles, Multiarchitecture Builds TCP port for unencrypted traffic, Network Ports and Unix Sockets tcpdump command, Network Inspection terminology, Important Terminology testingDocker and the DevOps pipelineabout, Docker and the DevOps Pipeline external dependencies, Outside Dependencies overview, Quick Overview-Quick Overview Docker workflow, TestingDocker and the DevOps pipeline, Quick Overview testing your private registry, Testing the private registry time command, Utilizing the Layer Cache time namespaces, Namespaces tini, Controlling Processes TLS client certificate documentation, Vagrant tmpfs for writable within read-only, Storage Volumeslogging, More Advanced Logging lost when container stopped, Stopping a Container toolsall-in-one developer toolsPodman Desktop, Podman Desktop Rancher Desktop, Rancher Desktop client toolsnerdctl, nerdctl-nerdctl podman and buildah, podman and buildah-podman and buildah top command after stress command, CPU shares tree command, Building an Image troubleshooting (see debugging) twelve-factor appabout, The Twelve-Factor App admin processes, Admin Processes backing services, Backing Services build, release, run, Build, Release, Run codebase, Codebase concurrency, Concurrency configuration, Config-Config dependencies, Dependencies development/production parity, Development/Production Parity disposability, Disposability logs, Logs port binding, Port Binding processes, Processes “The Twelve-Factor App.”

Designing Web APIs: Building APIs That Developers Love
by Brenda Jin , Saurabh Sahni and Amir Shevat
Published 28 Aug 2018

The transformation functions convert the data to the appropriate schema before returning the data. Figure 7-4. Pseudocode sample of a transformation layer between ver‐ sion 2 and version 1 In addition to implementing the versioning system, you and your team need to think about how to organize and label your versions. For this, the semantic versioning specification (SemVer) can be helpful in using a standard to describe your changes. In SemVer, there are MAJOR, MINOR, and PATCH versions (in the format MAJOR.MINOR.PATCH). MAJOR versions are for backwardincompatible API changes. MINOR versions are for adding func‐ tionality in a backward-compatible manner.

API Implementation Checklist: ❏ Define specific developer problem to solve ❏ Write internal API specification ❏ Get internal feedback on API specification ❏ Build API ❏ Authentication ❏ Authorization ❏ Error handling ❏ Rate-limiting ❏ Pagination ❏ Monitoring and logging ❏ Write documentation ❏ Run beta test with partners on new API ❏ Gather feedback from beta partners and make changes ❏ Create communication plan to notify developers of changes ❏ Release API changes API Design Worksheets | 205 Index A additions to APIs, 131 additive-change strategy, 133 Amazon Web Services (AWS), 83 ambassador programs, 195 analytics dashboards, 56 Apache Thrift, 14 API testers, 179 APIs about, 1 attributes and traits of good APIs, 199 business case for, 3-7 APIs as a product, 6 APIs for external developers first, internal developers second, 5 APIs for internal developers first, external developers second, 4 characteristics of great APIs, 7 description language, 122-126 design paradigms, 9 designing (see designing APIs, best practices; designing APIs, practical exercise in) event-driven, 19-25 comparison of different types, 24 HTTP Streaming, 23-24 WebHooks, 19-22 WebSockets, 22-23 request–response comparison of types, 18 GraphQL, 14-18 REST, 10-13 RPC, 13-14 security (see security) uses of, 2 application names, misleading, pro‐ hibiting in OAuth, 40 application-level caching for APIs, 87 archiving a GitHub repository, HTTP request for, 12 asynchronous operations, 89 authentication, 27 choosing mechanism for MyFiles API (example), 66 authorization, 28 OAuth 2.0 as standard for, 29 Authorization header (HTTP) for Basic Authentication, 28 with OAuth tokens and scope, 34 automated testing (see testing) awareness tactics examples, 156 AWS (see Amazon Web Services) B backward compatibility, maintaining, 58, 127-128 Basic Authentication, 28 beta programs, 188-190 beta testers, 79 Botkit framework, 177 bottlenecks, finding, 82 207 breadth and depth analysis for devel‐ oper programs, 185 breadth developer programs, 192-197 bulk operation endpoints, support‐ ing, 95 business case for APIs, 3-7 business objectives, defining, 62-64 business-focused tech savvy audience, 145 C cache invalidation, 87 caching in developer SDKs, 115 using to scale thoughput, 87 change, managing, 117-142 aiming for consistency, 117-126 using automated testing, 120-126 backward compatibility, 127-128 planning for and communicating change, 128-141 additions to the API, 131 communication plan, 129 removing fields or endpoints, 132 versioning, 133-141 changelogs, 170 CI pipeline, 121 clickjacking, 40 client secret, ability to reset in OAuth, 39 cloud hosting providers, solutions for measuring bottlenecks, 83 code samples, 173 code snippets, 174 communication means, preferred, of developers, 149 communication plan for changes, 129 community contributions, 182-183 community, building, 192 computing resources, adding to scale applications, 85 consistency in an API, 50, 117-126 hallmarks of consistency, 118 using automated testing, 120-126 continuous integration (CI), 121 Conversations APIs (Slack), 13, 93 208 | Index CPU bottlenecks, 83 Create, Read, Update, and Delete operations (see CRUD operations) credit programs, 197 cross-site request forgery (CSRF), 27, 38 cross-site scripting (XSS), 27 CRUD operations, 10 HTTP verbs and REST conven‐ tions, 11 in MyFiles API (example), 67 in request–response API para‐ digms, 18 pros and cons of API paradigms for MyFiles API (example), 65 current actual numbers for developer funnel indicators, 155 cursor-based pagination, 99-101 advantages and disadvantages, 100 ID as cursor, 101 opaque strings as cursor, 101 timestamp as cursor, 101 custom HTTP headers rate-limit response headers, 110 with OAuth token and scope, 34 D dark launching rate-limiting, 109 data access patterns (new), introduc‐ ing in your API, 90 database indexes, 86 database profiling, 84 database replication, 85 database sharding, 85 date filters, 96 debugging tools, 179 DELETE method (HTTP), 10 (see also CRUD operations) depth developer programs, 187-192 design sprints, 160, 191 designing APIs, best practices, 47-59 design for great developer experi‐ ence, 48-59 making it fast and easy to get started, 48 making troubleshooting easy, 52-56 making your API extensible, 56 working toward consistency, 50 design for real-life use cases, 47-48 focusing on users, 2 designing APIs, practical exercise in, 61-79 scenario 1, 62-72 defining business objectives, 62-64 outlining key user stories, 64 selecting technology architec‐ ture, 65 writing an API specification, 68-72 scenario 2, 72-79 defining problem and impact statement, 73 getting feedback on the API spec, 77-79 selecting technology architec‐ ture, 74 writing an API specification, 74-77 developer ecosystem strategy, build‐ ing, 143-161 building a developer strategy, 147 defining your developer funnel, 152-154 funnel indicators, 154 deriving measurements, 160 developer segmentation, 147-150 common use cases and tasks, 148 examples of segmentation analysis, 149 identity, 147 market size and geographical distribution, 149 platform of choice, 148 preferred development lan‐ guage, framework, and tools, 148 preferred means of communi‐ cation, 149 proficiency, 148 developers, 144-147 business-focused tech savvy audience, 145 hackers, 145 hobbyist, 144 professional developers, 146 variations on categories men‐ tioned, 146 distilling the value proposition, 151 mapping current and future state, 155-156 outlining your tactics, 156-160 awareness tactics examples, 156 developer relations high-level quarterly plan, 159 proficiency tactics examples, 157 success tactics examples, 158 usage tactics examples, 157 developer programs, 185-198 breadth and depth analysis for, 185 breadth programs, 192-197 credit programs, 197 hackathons, 194 meetups and community, 192 online videos and streaming, 196 speaking at events and event sponsorships, 194 support, forums, and StackO‐ verflow, 196 train-the-trainer and ambassa‐ dor programs, 195 depth programs, 187-192 design sprints, 191 early access/beta program, 188 top partner program, 187 measuring, 197 developer relations, 143 Developer Relations core activities, 185 developer resources, 163-184 API documentation, 163-172 code samples and snippets, 172-175 Index | 209 community contribution, 182-183 development tools, 179 frameworks, 177 office hours, 181 rich media, 180 videos, 180 software development kits (SDKs), 175-177 webinars and online training, 182 developer SDKs (see software devel‐ opment kits) developers APIs for external developers first, internal developers second, 5 APIs for internal developers first, external developers second, 4 communicating with about API changes, 129 removal of fields or endpoints, 132 rate limits and, 110-112 trying APIs without signing up, 49 disk I/O, 83 documentation for APIs, 49, 163-172 changelog, 170 frequently asked questions, 168 Getting Started guides, 163 landing page, 169 reference documentation, 165 terms of service (ToS), 171 tutorials, 167 E early access/beta program, 188 edge caching, 87 error handling and exponential back‐ off in SDKs, 115 errors HTTP status codes in MyFiles API specification (example), 71 meaningful, 52-55 actionable errors and recom‐ mended error codes, 52 grouping errors into high-level categories, 53 210 | Index organizing into status codes, headers, and machinereadable and humanreadable codes, 54 event objects for MyFiles API techni‐ cal spec (example), 75 event-driven APIs, 19-25 comparison of different types, 24 HTTP Streaming, 23-24 pros and cons for MyFiles API (example), 74 WebHooks, 19-22 WebSockets, 22-23 events (developer), 194 Events API (Slack), 91 evolving API design, 90-97 adding new API methods, 92 best practices, 97 introducing new data access pat‐ terns, 90 new options to filter results, 95 supporting bulk endpoints, 95 explicit-version strategy, 134-138 exponential back-off, 115 extensibility of APIs, 56 F Facebook, ToS violations, 41 failures and retries (WebHooks), 20 feedback, getting on API specifica‐ tion, 77-79 fields in API responses, filtering, 96 filtering results, providing options for, 95 firewalls, WebHooks and, 21 fixed-window counter (rate-limiting), 107 Flannel (Slack), 88 forums, 196 frameworks, 177 frequently asked questions (FAQ), 168 function names, versioned, 136 G geographical distribution (develop‐ ers), 149 GET method (HTTP), 10 (see also CRUD operations) Getting Started guides, 163 GitHub, 5 addressing scalability challenges, 91 archiving a repository, HTTP request for, 12 OAuth scope headers in API response, 35 rate-limit response header, 111 rate-limiting at, 112 Gmail phishing attack on, 40 thin WebHook message payload, 45 Google Cloud Platform (GCP), 83 Google Developer Groups (GDG), 192 Google Hangouts, versioning case study, 140 GraphQL, 6, 14-18, 91 advantages over REST and RPC, 16 comparison to REST and RPC APIs, 18 Object Field deprecation, 133 pros and cons for MyFiles API (example), 66 gRPC, 14 gzip compression, using in SDKs, 114 custom rate-limit response head‐ ers X-RateLimit-Limit, 111 X-RateLimit-Remaining, 111 X-RateLimit-Reset, 111 organizing errors into, 54 specifying API versions in, 135 X-Frame-Options, 40 HTTP methods CRUD operations and REST con‐ ventions, 11 in REST APIs, 10 in REST, RPC, and GraphQL APIs, 18 in RPC-style APIs, 13 HTTP status codes description for errors in MyFiles API specification (example), 71 in REST APIs, 10 indicating redirection for moved/ moving resources, 135 organizing errors into, 54 returning for rate limits, 110 HTTP Streaming, 23-24 comparison with WebHooks and WebSockets, 24 pros and cons for MyFiles eventdriven API (example), 74 HTTPs endpoints (OAuth), 39 human-readable errors, 52 H I hackathons, 194 hackers, 145 hash-based message authentication code (HMAC), 43 Hello World exercise, 163 hobbyist developers, 144 horizontal scaling, 85 HTTP, 9 (see also request–response APIs) in RPC-style APIs, 13 HTTP headers custom OAuth headers X-Accepted-OAuth-Scopes, 35 X-OAuth-Scopes, 35 ID as cursor, 101 identity (developers), 147 iframes, rendering of authorization screen, disallowing, 40 impact statement for MyFiles API (example), 63 scenario 2, 73 indexes (database), 86 integrated development environ‐ ments (IDEs), 148 interface definition language, 122-126 interface description language (IDL), 122 interfaces, 1 Index | 211 J JavaScript object notation (JSON), 122 JSON responses in REST APIs, 11 JSON web APIs, 122-126 describing and validating requests, 125 describing and validating respon‐ ses, 123 K key indicators status report (devel‐ oper funnel), 155 key performance indicators (KPIs), connecting to developer activities, 160 L landing page for API documentation, 169 load testing, 84 logging changelog, 170 use in troubleshooting developer issues, 55 M machine-readable error codes, 52 Macys.com responsive checkout, 78 MAJOR, MINOR, and PATCH ver‐ sions, 137 managing change (see change, man‐ aging) market potential (developer funnel indicators), 155 market size, 149 measurements of developer activities, 160 measuring developer programs, 197 meetups and community, 192 memory bottlenecks, 83 methods, adding to APIs, 92 MINOR versions, 137 mocking data for interactive user testing, 78 Mutual TLS (Transport Layer Secu‐ rity), 44 212 | Index N network I/O, 83 noise (in WebHooks), 21 non-CRUD operations in REST APIs, 12 O OAuth, 28-42, 50 benefits of, 29 best practices, 38 listing and revoking authoriza‐ tions, 37 scopes, 32 Slack's move to granular OAuth scopes, 34 selection for use in MyFiles API (example), 66 token and scope validation, 34 token expiry and refresh tokens, 35 token generation, 30 objective key results (OKRs), 159 office hours, 181 offset-based pagination, 97 advantages and disadvantages, 98 opaque strings as cursor, 101 OpenAPI, 125 order filters, 96 P paginating APIs, 97-102 best practices, 102 cursor-based pagination, 99-101 advantages and disadvantages, 100 choosing cursor contents, 101 offset-based pagination, 97 advantages and disadvantages, 98 pagination support in developer SDKs, 114 partner engineers, 187 PATCH method (HTTP), 10 (see also CRUD operations) PATCH versions, 137 personally identifiable information (PII), 55 phishing attacks using misleading application names, 40 platform of choice (developers), 148 polling, 19 solving as API scaling problem in REST APIs, 90 WebHooks vs., 19 POST method (HTTP), 10 (see also CRUD operations) problem and impact statement for MyFiles API (example), 63 scenario 2, 73 professional developers, 146 proficiency (developer), 148 proficiency tactics examples, 157 profiling code, 83 programming languages, 148 implementing code snippets in, 174 PUT method (HTTP), 10 (see also CRUD operations) Q quarterly plan for developer relations, 159 R rate-limit response headers, 110 rate-limiting APIs, 102-114 best practices, 112 implementation strategies, 105-110 fixed-window counter, 107 sliding-window counter, 108 token bucket algorithm, 105 rate limits and developers, 110-112 documenting rate limits, 111 rate-limit status API, 111 rate-limiting policy, 103 Slack's rate-limiting, lessons learned from, 113 Stripe's rate-limiting strategies, 104 Read method, 10 (see also CRUD operations) read/write scopes, 32 Real-Time Messaging API, 91 reference apps, 173 reference documentation, 165 refresh tokens, 36 one-time-use, 39 remote procedure calls (RPCs), 13 (see also RPC APIs) removing endpoints or fields from APIs, 132 replay attacks, 43 request logs, providing for develop‐ ers, 55 requests adding request parameters to con‐ trol output, 131 describing and validating, 125 request parameters in version schemes, 136 request–response APIs, 9-19 comparison of different types, 18 GraphQL, 14-17 REST, 10-13 RPC, 13-14 resources (in REST APIs), 10 showing relationships between, 11 responses adding response fields, 131 describing and validating, 123-125 REST APIs, 10-13 comparison to RPC and GraphQL, 18 CRUD operations, HTTP verbs, and REST conventions, 11 general rules for, 10 non-CRUD operations, 12 payload creep, 17 polling as scaling problem, solv‐ ing, 90 pros and cons for MyFiles API (example), 66 showing relationships among resources, 11 retries (WebHooks), 20 rich media, 180-181 rich site summary (RSS) feed, adding to changelog, 170 RPC APIs, 13-14 Index | 213 comparison to REST and GraphQL, 18 general rules for, 13 HTTP request to Slack API, 13 pros and cons for MyFiles API (example), 66 Slack, Conversations APIs, 13 using protocols other than HTTP, 14 RSpec test using JSON Schema speci‐ fication, 125 S sandboxes and API testers, 179 scaling APIs, 81-116 evolving your API design, 90-97 adding new API methods, 92 best practices, 97 introducing new data access patterns, 90 providing new options to filter results, 95 supporting bulk endpoints, 95 providing developer SDKs, 114-116 caching frequently used data, 115 error handling and exponen‐ tial back-off, 115 pagination support, 114 rate-limiting support, 114 SDK best practices, 115 using gzip compression in SDKs, 114 scaling throughput, 82-90 adding computing resources, 85 best practices, 89 caching, 87 database indexes, 86 doing expensive operations asynchronously, 89 finding bottlenecks, 82 using pagination, 97-102 best practices, 102 cursor-based pagination, 99-101 offset-based pagination, 97 214 | Index using rate-limiting, 102-114 best practices, 112 implementation strategies, 105-110 rate limits and developers, 110-112 scopes (OAuth), 32 for sensitive information, 39 for use in MyFiles API (example), 66 in MyFiles API (example) scopes, operations, and resour‐ ces, 67 Slack's move to granular OAuth scopes, lessons learned from, 34 SDKs (see software development kits) search filters, 96 search operations in REST APIs, 12 security, 27-46 authentication and authorization, 27 for WebHooks, 20 OAuth, 28-42 best practices, 38 listing and revoking authoriza‐ tions, 37 scopes, 32 token and scope validation, 34 token expiry and refresh tokens, 35 token generation, 30 WebHooks, 42-45 semantic versioning specification (SemVer), 137 server-sent events (SSE), streaming data via, 24 short-lived authorization codes (OAuth), 39 short-term targets and market poten‐ tial (developer funnel indicators), 155 signatures (WebHook), 43 Slack APIs, 4 adding new API methods, 92 addressing scalability challenges with Events API, 91 API Metadata, 126 app credentials of Slack app with verification token, 42 changelog, 170 Conversations API, 132 supporting bulk operations, 95 developer segmentation for Slack, 149 early access/beta program, 189 Flannel, application-level edge cache, 87 inconsistency in, 118 long-lived tokens, 37 missing field on message pay‐ loads, 127 move to granular OAuth scopes, lessons learned from, 34 rate-limiting, lessons learned from, 113 RPC-style web API, 13 translation layer to maintain backward compatibility, 57 WebSocket-based real-time mes‐ saging API, 22 sliding-window counter (ratelimiting), 108 snippets (code), 174 software as a service (SaaS) compa‐ nies, 4 software development kits (SDKs), 50, 148, 175-177 developer SDKs, 114-116 best practices, 115 caching frequently used data, 115 error handling and exponen‐ tial back-off, 115 pagination support, 114 rate-limiting support, 114 using gzip compression, 114 maintaining, 178 SoundCloud API, value proposition, 151 speaking at developer events, 194 specification (spec), writing for an API, 68-72 MyFiles API WebHooks (exam‐ ple), 74-77 SQL databases, queries based on cur‐ sor values, 99 Stack Overflow, 196 Stackdrivers, 83 stakeholders, reviewing API specifi‐ cation with, 77 state parameter support (OAuth), 38 streaming, 196 Stripe online testing of API by develop‐ ers without signing up, 49 rate-limiting, 104 value proposition, 151 versioning case study, 139 subresources in APIs, 11 success tactics examples, 158 support for developers, 196 T task queues, 89 TCP (Transport Control Protocol), 22 technology architecture, selecting scenario 1 for MyFiles API (exam‐ ple), 65 scenario 2 for MyFiles API (exam‐ ple), 74 terms of service (ToS) violations of Facebook ToS, 41 writing, 171 testing automated, 120-126 describing and validating requests, 125 describing and validating responses, 123-125 sandboxes and API testers, 179 Thrift, 14 throughput, scaling, 82-90 adding computing resources, 85 best practices, 89 caching, 87 database indexes, 86 doing expensive operations asyn‐ chronously, 89 finding bottlenecks, 82 the Time to Hello World (TTHW), 164 Index | 215 timestamps, using as cursors, 101 TLS (Transport Layer Security), 44 token bucket algorithm (ratelimiting), 105 tokens (OAuth) and scope, validation of, 34 expiry and refresh tokens, 35 generation of, 30 Slack's long-lived tokens, 37 top partner program, 187 train-the-trainer and ambassador programs, 195 transformations between versions, 137 Transport Control Protocol (see TCP) transport patterns for MyFiles API (example), 65 troubleshooting, making easy for developers, 52-56 building tooling, 55 meaningful errors, 52-55 providing troubleshooting tools, 179 tutorials for APIs, 49, 167 Twitch, deprecation of an API, 59 Twitter, 90 cursor-based pagination, 99 U Uber developers and rate-limiting, 109 Unix timestamp as cursor, 99 Update method, 10 (see also CRUD operations) URI components, specifying versions in, 135 URIs, specification for MyFiles API (example), 70 usage tactics examples, 157 user interfaces (UIs), 88 user stories (key), outlining scenario 1 for MyFiles API (exam‐ ple), 64 scenario 2 for MyFiles API (exam‐ ple), 73 users, focusing on in API design, 2 216 | Index users.conversations API method (Slack), 94 V value proposition, distilling for your API, 151 verification tokens, 42 versioning APIs, 57, 133-141 additive-change strategy, 133 case study, Google Hangouts, 140 case study, Stripe, 139 explicit-version strategy, 134-138 policies for MAJOR and MINOR changes, 138 process management, 141 vertical scaling, 85 videos creating, 180 online videos and streaming, 196 W WebHooks, 19-22, 90 comparison with WebSockets and HTTP Streaming, 24 considerations for use in MyFiles API (example), 66 MyFiles API Webhooks Spec (example), 74-77 polling vs., 19 pros and cons for MyFiles eventdriven API (example), 74 security, 42-45 best practices, 45 Mutual Transport Layer Secu‐ rity, 44 request signing and WebHook signatures, 43 thin payloads and API retrieval, 44 verification tokens, 42 supporting, additional complexi‐ ties added by, 20 webinars and online training, 182 WebSockets, 22-23, 90 comparison with WebHooks and HTTP Streaming, 24 pros and cons for MyFiles eventdriven API (example), 74 Y YouTube API, value proposition, 151 X XML responses, REST APIs, 11 Index | 217 About the Authors Brenda Jin is an entrepreneur and software engineer.

pages: 821 words: 178,631

The Rust Programming Language
by Steve Klabnik and Carol Nichols
Published 14 Jun 2018

Open that file now and add the following line to the bottom beneath the [dependencies] section header that Cargo created for you: Cargo.toml [dependencies] rand = "0.3.14" In the Cargo.toml file, everything that follows a header is part of a section that continues until another section starts. The [dependencies] section is where you tell Cargo which external crates your project depends on and which versions of those crates you require. In this case, we’ll specify the rand crate with the semantic version specifier 0.3.14. Cargo understands Semantic Versioning (sometimes called SemVer), which is a standard for writing version numbers. The number 0.3.14 is actually shorthand for ^0.3.14, which means “any version that has a public API compatible with version 0.3.14.” Now, without changing any of the code, let’s build the project, as shown in Listing 2-2

You’ve now shared your code with the Rust community, and anyone can easily add your crate as a dependency of their project. Publishing a New Version of an Existing Crate When you’ve made changes to your crate and are ready to release a new version, you change the version value specified in your Cargo.toml file and republish. Use the Semantic Versioning rules at http://semver.org/ to decide what an appropriate next version number is based on the kinds of changes you’ve made. Then run cargo publish to upload the new version. Removing Versions from Crates.io with cargo yank Although you can’t remove previous versions of a crate, you can prevent any future projects from adding them as a new dependency.

, 161–165 type aliases for, 442–443 unwrap method on, 157–158 unwrap_or_else method on, 239 return keyword, 46 return values of functions, 46–47 multiple using a tuple, 67–68 rev method, 55 ripgrep, 228, 302–303 RLS (Rust Language Server), xxiv root module, 118 .rs file extension, 5 running code, 6–7 runtime, 343 Rustaceans, 3–4 rustc, 3, 5, 6–7 rustfmt, xxiv, 6 Rust Language Server (RLS), xxiv Rustonomicon, The, 133, 339, 363 rustup commands, 1–4 doc, 4 uninstall, 3 update, 3 S scalar data types, 36–39, 65–66 scope, 60 SCREAMING_SNAKE_CASE, 421 Self keyword, 374–375 self parameter, 90 Semantic Versioning (SemVer), 19, 296 semicolon (;), 6, 493 Send trait, 362–363, 423, 465 sequence, 55 server, 450 shadowing, 25, 34–36 shallow copy, 64 shared-state concurrency, 355–362 should_panic attribute, 212–215 signed integer types, 36–37 single quote ('), 493–494 for characters, 39 for lifetime parameter names, 190 ?

pages: 648 words: 183,275

The Rust Programming Language, 2nd Edition
by Steve Klabnik and Carol Nichols
Published 27 Feb 2023

Be sure to specify rand exactly as we have here, with this version number, or the code examples in this tutorial may not work: Cargo.toml [dependencies] rand = "0.8.5" In the Cargo.toml file, everything that follows a header is part of that section that continues until another section starts. In [dependencies] you tell Cargo which external crates your project depends on and which versions of those crates you require. In this case, we specify the rand crate with the semantic version specifier 0.8.5. Cargo understands Semantic Versioning (sometimes called SemVer), which is a standard for writing version numbers. The specifier 0.8.5 is actually shorthand for ^0.8.5, which means any version that is at least 0.8.5 but below 0.9.0. Cargo considers these versions to have public APIs compatible with version 0.8.5, and this specification ensures you’ll get the latest patch release that will still compile with the code in this chapter.

You’ve now shared your code with the Rust community, and anyone can easily add your crate as a dependency of their project. Publishing a New Version of an Existing Crate When you’ve made changes to your crate and are ready to release a new version, you change the version value specified in your Cargo.toml file and republish. Use the Semantic Versioning rules at https://semver.org to decide what an appropriate next version number is, based on the kinds of changes you’ve made. Then run cargo publish to upload the new version. Deprecating Versions from Crates.io with cargo yank Although you can’t remove previous versions of a crate, you can prevent any future projects from adding them as a new dependency.

, 175–180 type aliases for, 442–443 unwrap method on, 168 unwrap_or_else method on, 168 return keyword, 47 return values of functions, 47–49 of loops, 55 multiple using a tuple, 70 rev method, 58 ripgrep, 244, 312–313 RLS (Rust Language Server), xxvi .rs file extension, 5 running code, 5–7, 9–10 Rustaceans, 3 rust-analyzer, 514 rustc, 3, 5–7 rustfix, 512–513 rustfmt, xxvi, 6, 511–512 Rust Language Server, xxvi “The Rustonomicon,” 145, 351, 374 rustup commands, 1–4 doc, 4 uninstall, 4 update, 4 S saturating_* methods, 38 scalar data types, 36–40 scope, 62, 120 SCREAMING_SNAKE_CASE, 428 Self keyword, 98 self module, 125 self parameter, 97 Semantic Versioning (SemVer), 19–20, 306 semicolon (;), 6, 501 in the array type, 42 to end statements, 47 Send trait, 373–374, 429, 476 sequence, 58 server, 460 shadowing, 34–36 vs. mut keyword, 35–36 shared-state concurrency, 367–373 should_panic attribute, 226–229 sibling modules, 125 single quote ('), 502 for characters, 40 for lifetime parameter names, 205 for loop labels, 55 ?

pages: 560 words: 135,629

Eloquent JavaScript: A Modern Introduction to Programming
by Marijn Haverbeke
Published 15 Nov 2018

Versions are a way to deal with the fact that packages evolve separately, and code written to work with a package as it existed at one point may not work with a later, modified version of the package. NPM demands that its packages follow a schema called semantic versioning, which encodes some information about which versions are compatible (don’t break the old interface) in the version number. A semantic version consists of three numbers, separated by periods, such as 2.3.0. Every time new functionality is added, the middle number has to be incremented. Every time compatibility is broken, so that existing code that uses the package might not work with the new version, the first number has to be incremented.

: operator, 18, 20, 209 [] (array), 60 [] (subscript), 60, 61 || operator, 17, 20, 51, 95, 328, 408 2d (canvas context), 289 200 (HTTP status code), 312, 360, 364 204 (HTTP status code), 366, 367 304 (HTTP status code), 374, 380, 386 400 (HTTP status code), 425 403 (HTTP status code), 364 404 (HTTP status code), 312, 365, 377–379 405 (HTTP status code), 316, 364 406 (HTTP status code), 422 500 (HTTP status code), 364 A a (HTML tag), 222, 235, 237, 320, 344 Abelson, Hal, 202 absolute positioning, 240, 244, 253, 257, 262 absolute value, 76, 424 abstract data type, 96 abstract syntax tree, see syntax tree abstraction, 5, 41, 84, 86, 203, 316, 349 in Egg, 230 of the network, 221 acceleration, 281–282 Accept header, 329, 422 access control, 98, 141–142, 375 Access-Control-Allow-Origin header, 316 actions, 334, 336, 337 activeElement property, 319 actor, 269, 274, 280 add method, 113 addEntry function, 66 addEventListener method, 248, 282, 362 addition, 13, 113 address, 77, 311 address bar, 221, 311, 313 adoption, of tools and techniques, 145 ages example, 104 alert function, 223–224 algorithmic optimization, 397, 406 alpha, 346 alphanumeric character, 147 alt attribute, 233 ALT key, 252 altKey property, 252 ambiguity, 215 American English, 148 ampersand character, 223, 314 analysis, 129, 133 ancestor element, 275 Android, 252 angle, 242, 293, 294, 421 angle brackets, 222 animation, 256, 262, 271, 306, 419 bouncing ball, 308, 421 performance, 266 platform game 277, 283, 296, 297, 303, 305 spinning cat, 240, 241, 244 anyStorage function, 198–199, 200 appendChild method, 232, 417 Apple, 225 application (of functions), see function application applications, 1, 333, 372 arc, 293, 294 arc method, 293, 421 argument, 27, 47, 51, 74, 155, 204 arguments object, 409 argv property, 355 arithmetic, 13, 19, 210 array, 61, 64, 79, 95 counting, 93 creation, 91, 60, 336, 409, 413 in Egg, 214 filtering, 88 indexing, 60, 68, 72, 409, 418 iteration, 69, 85, 87 length of, 61 as matrix, 107–108, 268 methods, 71, 79, 87–89, 92, 94, 95 notation, 77 random element, 122 as regular expression match, 149 representation, 77 of rest arguments, 74 searching, 68, 71 as table, 67 Array constructor, 336 Array prototype, 100, 103 Array.from function, 195, 231, 356 array-like object, 230–232, 255, 320, 325, 358 arrays in Egg (exercise), 214, 416 arrow function, 45, 99, 199 arrow keys, 262 artificial intelligence, 117, 213 assert function, 140 assertion, 140 assignment, 25, 34, 160, 162, 215, 417 assumption, 139, 140 asterisk, 13, 148 async function, 195–196, 199, 200, 386 asynchronous programming, 181, 200 animation, 284 in Node.js, 354, 359, 361, 365, 368 reading files, 325 attribute, 222, 230, 235, 320, 337, 422 autofocus attribute, 320 automatic semicolon insertion, 24 automation, 125, 132 automaton, 117 avatar, 266 average function, 91 await keyword, 195–196, 197, 199 axis, 281, 289, 298, 424 B Babbage, Charles, 58 background, 266, 273, 278 background (CSS), 262, 266, 274 backslash character as path separator, 365 in regular expressions, 146, 147, 157, 158, 414 in strings, 14, 223 backtick, 14–15 backtracking, 153–154, 156–157 ball, 308, 421 balloon (exercise), 262, 418 banking example, 137 Banks, Iain, 264 baseControls constant, 348 baseTools constant, 348 bean counting (exercise), 56, 409 beforeunload event, 258 behavior, 164, 213 benchmark, 236, 391, 397 Berners-Lee, Tim, 218 best practices, 3 bezierCurveTo method, 292 big ball of mud, 167, 168 binary data, 3, 11, 358 binary numbers, 11, 12, 68, 133, 153, 324 binary operator, 13, 16, 23 binding assignment, 25, 44 compilation of, 215, 403 definition, 24, 41, 215, 417 destructuring, 76 in Egg, 210, 212 exported, 173 global, 43, 130, 285, 354, 355 local, 43 model of, 25, 63, 65 naming, 26, 35, 52, 75, 131 from parameter, 42, 49 scope of, 43 as state, 31, 33, 65, 160, 326 undefined, 138 visibility, 43 bitfield, 255 bitmap graphics, 295, 308 bits, 3, 11, 12, 16, 68 block, 29, 32, 42, 43, 46, 63, 136, 137, 204 block comment, 36, 156 block element, 235, 237–238 blocking, 182, 241, 260, 359 blur event, 257–258 blur method, 319 body (HTML tag), 222–223, 228 body (HTTP), 313–315, 360, 366, 367, 378 body property, 228, 229, 231, 316 bold, 237 Book of Programming, The, 10, 352 Boolean, 16, 28, 31, 65, 146, 209, 210 conversion to, 19, 28, 31 Boolean function, 28 border (CSS), 235, 237 border-radius (CSS), 253 bouncing, 267, 270, 278, 280, 308 boundary, 151, 153, 157, 161, 164, 302, 413 bounds, of ranges, 88 box, 142, 227, 266, 308, 421 box shadow (CSS), 275 br (HTML tag), 340, 422 braces block, 4, 29, 42 class, 102 function body, 46, 63, 408 object, 66, 76, 85 in regular expression, 148 branching, 152, 153 branching recursion, 50, 300 break keyword, 33, 35 breakpoint, 134 British English, 148 broadcastConnections function, 193 browser, 2, 5, 174, 183, 219–225, 266, 267, 308, 313, 316, 321, 344, 348, 372 environment, 7, 26, 27, 311 security, 317, 392 storage, 326–328 window, 248 browser wars, 225 bubbling, see event propagation Buffer class, 358, 359, 361, 362 bug, 83, 129, 133, 157, 159, 164, 168, 225 building Promise.all (exercise), 200, 416 bundlers, 174 button, 247, 313, 320, 330 button (HTML tag), 224, 248, 252, 262, 321, 327, 330, 337 button property, 249, 255, 338 buttons property, 255, 338 C C (programming language), 391 cache, 172, 184 call method, 99, 104 call protocol, 400 call stack, 46–47, 51, 62, 135, 136, 138, 197, 400 callback functions, 184–190, 247, 283, 337, 358–359, 361, 380, 385 calling (of functions), see function application camel case, 35, 238 cancelAnimationFrame function, 260 canvas, 266, 287, 289–292, 295–301, 305–307, 395, 421 context, 289 path, 290 size, 288, 290 canvas (HTML tag), 288, 334, 337, 344, 345, 349, 423 CanvasDisplay class, 301, 302, 304 capitalization, 35, 101, 149, 238, 243, 362 capture group, 149–151, 155, 376 career, 265 caret character, 147, 151, 161, 358 carriage return, 161 cascading, 238 Cascading Style Sheets, see CSS case conversion, 62 case keyword, 35 case sensitivity, 149, 414 casual computing, 2 cat’s hat (exercise), 244 catch keyword, 135–136, 138–139, 141, 197, 413 catch method, 188 CD, 11 cell, 330 Celsius, 110 centering image on screen, 241 player in viewport, 276 certificate, 317 change event, 319, 322, 340, 422, 425 character, 14–15, 92–93, 322 character category, 163 character encoding, 358–359 characterCount function, 90 characterScript function, 94, 95, 411 charCodeAt method, 92 checkbox, 318, 323, 330, 422 checked attribute, 318, 323 chessboard (exercise), 38, 408 chicks function, 198–199 child node, 229, 230, 232 childNodes property, 230, 231, 233, 419 children property, 231 Chinese characters, 92, 94 choice, 152 Chrome, 225, 398, 400, 402, 404 circle, 241, 293 circle (SVG tag), 288 circles (exercise), 350, 423 circular dependency, 178, 415 circus, 71 class, 101, 102, 113, 119, 267, 335 class attribute, 232, 235, 239, 273, 275 class declaration, 102 class hierarchy, 112 className property, 235 cleaning up, after exceptions, 136 clearing, the canvas, 288, 296, 301, 302, 421 clearInterval function, 260 clearRect method, 296, 421 clearTimeout function, 259, 260 click event, 248, 250, 253, 255, 337, 422 client, 220, 316, 361, 372, 381, 382 clientHeight property, 235 clientWidth property, 235 clientX property, 253, 255, 339 clientY property, 253, 255, 339 clipboard, 225 clipping, 302 closePath method, 291 closing tag, 222, 224 closure, 49, 214, 417–419 closure in Egg (exercise), 214, 417 code, 6, 156, 265 structure of, 23, 32, 41, 167, 175 code golf, 164 code unit, 92 codePointAt method, 93 coin, 266, 267, 280, 305 Coin class, 271, 280 collaboration, 219 collection, 5, 60, 62, 64, 79 collision detection, 277, 278, 280–282, 420, 421 colon character, 18, 34, 63, 237 color, 288, 290, 302, 334, 346 color (CSS), 237, 238 color codes, 336 color field, 334, 336, 341 color picker, 334, 341, 344 color property, 335 ColorSelect class, 341 comma character, 204 COMMAND key, 252, 349 command line, 169, 353–355, 368 comment, 35, 77, 156, 160, 214, 229, 372, 374, 379, 384, 417 comment field reset (exercise), 388, 426 COMMENT_NODE code, 229 comments in Egg (exercise), 214, 417 CommonJS modules, 171–173, 355–356 exercise, 177–178, 415 communication, 220, 316 community, 354 compareRobots function, 125 comparison, 16, 19, 31, 35, 80 deep, 210, 409 of NaN, 17 of numbers, 16, 27 of objects, 66 of strings, 16 of undefined values, 19 compatibility, 5, 219, 225, 350, 357 compilation, 174, 212, 213, 391, 392, 398, 400, 403, 417 complexity, 3, 83, 112, 154, 239, 272, 349 component, 334, 335, 340, 346 composability, 5, 91, 175 computed property, 61, 328 computers, 1, 2 concat method, 72, 95, 413, 418, 426 concatenation, 15, 72, 418 conditional execution, 18, 28, 34, 37, 209 conditional operator, 18, 20, 209 conditional request, 374 configuration, 160 connected graph, 125 connection, 220, 311, 317, 372, 373 connections binding, 192 consistency, 35, 219, 230 console.log function, 5, 8, 16, 27, 46, 48, 55, 133, 354, 362–363, 398 const keyword, 25–26, 43, 65, 75, 76 constants, 26, 75, 282 constructor, 35, 101, 102, 112, 126, 130, 136, 150, 157, 411, 413 content negotiation (exercise), 329, 422 Content-Length header, 313 Content-Type header, 313, 360, 365, 369 context, 289 context menu, 251 continuation, 184 continue keyword, 33 control, 339, 341, 344, 347 control flow asynchronous, 182, 196 conditional, 28–30 exceptions, 135, 136 function, 46, 86 loop, 30–31, 32–33 control point, 292, 293 convention, 35 convergent evolution, 184 Conway’s Game of Life, 330 coordinates, 113, 241–242, 253, 273, 276, 278, 279, 289, 293, 298 copy-paste programming, 53, 168 copyright, 169 correlation, 66, 67, 69, 70 corvid, 183 cosine, 75, 241 countBy function, 93, 95 counter variable, 30, 32, 242, 408, 409, 416, 418 CPU, 182 crash, 138, 140, 378, 387 createElement method, 234, 336, 417 createReadStream function, 362, 365 createServer function, 360, 362, 375, 376 createTextNode method, 233, 422 createWriteStream function, 361, 367 cross-domain request, 316 crow, 183, 184, 188, 194 crow-tech module, 185 crying, 149 cryptography, 317 CSS, 237–239, 273–277, 287, 290, 336, 382 CTRL key, 252, 349 ctrlKey property, 252, 349 curl program, 367 curly braces, see braces cursor, 322 curve, 292–293 cutting point, 272 cwd function, 364–365 cycle, 229 D Dark Blue (game), 265 data, 2, 11, 59 data attribute, 235, 262 data event, 362 data flow, 334, 349 data format, 77, 230 data loss, 387 data set, 68, 87 data structure, 59, 175, 177, 306, 330 collection, 60 immutable, 120 list, 79 map, 104 stack, 62 tree, 204, 227, 229 data URL, 344–345 date, 147, 148, 150 Date class, 150, 151, 169, 171 date-names package, 171 Date.now function, 151, 346, 405 dblclick event, 253 De Morgan’s laws, 411 debouncing, 260 debugger statement, 134 debugging, 6, 129–131, 133, 136, 139, 140, 164 decentralization, 219 decimal number, 11, 133, 153 declaration, 237 decodeURIComponent function, 314, 364, 376 deep comparison, 66, 80 deep comparison (exercise), 80, 410 default behavior, 237, 251 default export, 173 default keyword, 35 default value, 20, 48, 290, 328, 348 defineProperty function, 411 defineRequestType function, 185, 190 degree, 293, 298 delete method, 113 DELETE method, 312–313, 315, 363, 366, 378 delete operator, 63 deoptimization, 401, 403, 404 dependence, 66 dependency, 168, 170, 173, 178, 224, 357 deserialization, 77 design, 168 destructuring, 151 destructuring assignment, 424 destructuring binding, 76, 171, 348, 415 developer tools, 7, 27, 134, 138 dialect, 174 dialog box, 26 diamond, 307, 420 digit, 11, 12, 133, 147–149, 336 Dijkstra, Edsger, 116, 176 Dijkstra’s algorithm, 176 dijkstrajs package, 176, 414 dimensions, 113, 235, 265, 267, 278, 289, 401, 408 dinosaur, 213 direct child node, 239 direction (writing), 95 directory, 355, 358–359, 363, 365–366, 368, 425 directory creation (exercise), 368, 425 disabled attribute, 320 discretization, 266, 278, 283 dispatch, 34, 334–336, 340, 347, 375, 423 display, 272, 273, 283, 284, 301, 305, 306 display (CSS), 237, 262 distance, 396, 423 distribution, 392 division, 13, 14, 396 division by zero, 14 do loop, 31, 122 doctype, 222–223 document, 221, 227, 258, 287 document format, 317, 329 Document Object Model, see DOM documentation, 353 documentElement property, 228, 229 dollar sign, 26, 151, 155, 161 DOM, 228, 229 attributes, 235 components, 334 construction, 230, 232, 234, 336 events, 248, 252 fields, 318, 322 graphics, 266, 267, 273–276, 287, 288, 305 interface, 229–230 modification, 232–233 querying, 231–232, 239 tree, 229 dom property, 335 domain, 221, 313, 316, 327 domain-specific language, 84, 132, 145, 214, 239 DOMDisplay class, 273, 301 dominant direction (exercise), 95, 411 done property, 346 doneAt property, 346 dot character, see period character double-click, 253 double-quote character, 14, 165, 204, 223 download, 7, 169, 344, 356, 367, 371, 387 download attribute, 344 draggable bar example, 254 dragging, 254, 334, 342, 350 draw function, 342, 350 drawGraph function, 395 drawImage method, 295–296, 298, 301, 303, 421 drawing, 227, 235, 236, 241, 272, 273, 288, 289, 292, 299, 303, 305, 333, 334, 422 drawing program example, 253, 333 drawPicture function, 338, 344, 350, 423 drop-down menu, 319, 324 duplication, 168 dynamic typing, 403 E ECMAScript, 5, 6, 173 ECMAScript 6, 6, 426 economic factors, 349 ecstatic package, 376 Edge, 398, 400, 402 editor, 32 efficiency, 50, 79, 91, 192, 212, 236, 266, 275, 289, 338, 349 efficient drawing (exercise), 349, 423 Egg language, 203, 215, 229 electronic life, 266 elegance, 50, 205 element, 222, 229, 231, 234 ELEMENT_NODE code, 229, 418 elements property, 320 ellipse, 240, 242 else keyword, 29 elt function, 234, 336, 349, 384 email, 317 emoji, 15, 92, 162, 262 empty set, 156 encapsulation, 97, 98, 105, 112, 248, 272 encodeURIComponent function, 314, 373–374, 383 encoding, 220 encryption, 317 end event, 362 end method, 360, 361, 364 enemies example, 160 engine, 391, 398, 400, 402 engineering, 225 ENOENT (status code), 365 ENTER key, 321 entity, 223 enum (reserved word), 26 environment, 26, 208 equality, 17 error, 92, 129, 130, 133–135, 138, 139, 187, 188, 194 error event, 326, 367 error handling, 129, 135, 138, 359, 364, 365, 383, 386 error message, 207, 330 error recovery, 134 error response, 312, 364, 366 error tolerance, 223 Error type, 136, 138, 139, 365 ES modules, 173, 224 ESC key, 285 escaping in HTML, 222, 224 in regular expressions, 146, 147, 158 in strings, 14, 204 in URLs, 314, 364, 373–374, 376 Escher, M.C., 286 ETag header, 374, 380, 386 eval operator, 170 evaluate function, 207–208, 210 evaluation, 170, 207, 213 even numbers, 30, 56 event handling, 247–262, 266, 282, 284, 285, 295–296, 305, 321, 322, 337, 362, 419, 422 event loop, 197 event object, 249, 253, 255 event propagation, 249, 250, 257, 258 event type, 249 every method, 95 everything (exercise), 95, 411 everywhere function, 192 evolution, 145, 349, 357 exception handling, 135, 136, 138–142, 187, 188, 196, 197, 200, 416, 422 exception safety, 138 exec method, 149–150, 158, 160 execution order, 28, 45, 46 exercises, 2, 7, 37, 133 exit method, 354 expectation, 251 experiment, 3, 7, 164 exploit, 225 exponent, 13, 165, 414 exponentiation, 31, 33 export keyword, 173 exports object, 171–173, 356, 415 expression, 23, 24, 27, 31, 33, 44, 203, 204, 208 expressivity, 214 extension, 355 extraction, 150 F factorial function, 8 Fahrenheit, 110 fallthrough, 35 false, 16 farm example, 52, 54, 152 fetch function, 315, 329, 361, 383, 385, 425 field, 252, 313, 318, 320, 323, 326, 330, 334, 388 Fielding, Roy, 310 file, 168, 325, 426 access, 172, 174, 345, 358, 359 image, 333, 344 resource, 312, 313, 363, 365, 366 stream, 361 file extension, 365 file field, 318, 325 file format, 160 file reading, 325 file server, 381 file server example, 363, 365–369, 425 file size, 174 file system, 325, 358, 359, 363, 364, 425 File type, 325 FileReader class, 325, 326, 345 files property, 325 fill function, 343 fill method, 291, 336 fillColor property, 336 filling, 289–291, 295, 306 fillRect method, 289, 296 fillStyle property, 290, 295 fillText method, 295, 420 filter method, 88, 91, 94, 120, 191, 411, 413 finally keyword, 137, 142, 413 findIndex method, 94 findInStorage function, 194, 195 findRoute function, 124, 193 finish event, 367 Firefox, 225, 398, 400, 402, 404 firewall, 372 firstChild property, 230 fixed positioning, 257 fixing scope (exercise), 215, 417 FizzBuzz (exercise), 37, 407 flattening (exercise), 95 flexibility, 6 flipHorizontally function, 304, 420 flipHorizontally method, 298 flipping, 297–298 floating-point number, 12–13 flood fill, 340, 343 flooding, 192 flow diagram, 152, 153 focus, 252, 257, 319, 320, 322, 323, 349, 388 focus event, 257–258 focus method, 319 fold, see reduce method font, 295 font-family (CSS), 238 font-size (CSS), 262 font-weight (CSS), 238 for attribute, 323 for loop, 32, 33, 69, 85, 95, 139, 397, 409, 410 for/of loop, 69, 93, 106, 107, 109, 398, 412 force, 393–398 force-directed graph layout, 393 forceDirected_noRepeat function, 397 forceDirected_noVector function, 401 forceDirected_simple function, 396 forceDirected_skip function, 398 forEach method, 87 form, 313, 314, 320, 321, 369 form (HTML tag), 318, 320, 385, 425 form property, 320 formatDate module, 171, 173 fractal example, 300 fractional numbers, 13, 165, 266 fragmentation, 402 frame, 296, 297, 303, 421 framework, 54, 334 frequency table, 67 fs package, 358, 359 Fuller, Margaret, 370 function, 5, 26, 41, 45, 130, 203, 204, 211 application, 26, 27, 42, 46, 47, 50, 74, 88, 138, 203, 208 body, 42, 46 callback, see callback function declaration, 45 definition, 41, 45, 52 higher-order, 45, 85, 86, 88, 89, 91, 155, 283 inlining, 400 model of, 49 naming, 52–54 as property, 62 purity, 55 scope, 44, 169, 214 as value, 42, 44, 48, 85, 86, 88, 249, 283, 419 Function constructor, 170, 172, 210, 213, 330, 422 function keyword, 42, 45 Function prototype, 100, 103 future, of JavaScript, 6, 26, 45, 308 G game, 265–267, 282, 284, 285, 301 with canvas, 305 screenshot, 277, 305 game of life (exercise), 330, 422 GAME_LEVELS data set, 284 garbage collection, 12, 400–403 garble example, 355 gardening, 371 gaudy home pages, 262 generation, 330, 422 generational garbage collection, 403 generator, 196 get method, 105 GET method, 312, 313, 315, 321, 361, 363, 365, 373, 377–378 getAttribute method, 235 getBoundingClientRect method, 236, 339 getContext method, 289 getDate method, 151 getElementById method, 232, 417 getElementsByClassName method, 232 getElementsByTagName method, 232, 233, 243, 418 getFullYear method, 151 getHours method, 151 getImageData method, 345, 346 getItem method, 326, 328 getMinutes method, 151 getMonth method, 151 getPrototypeOf function, 100, 101, 215, 417 getSeconds method, 151 getter, 109, 113, 270 getTime method, 150 getYear method, 151 GitHub, 312 global object, 130 global scope, 43, 170, 210, 259, 354, 355, 417 goalOrientedRobot function, 125 Google, 225 gossip property, 192 grammar, 23, 129, 160 graph, 118, 124, 176, 193, 306, 392, 394, 405 graph layout, 393, 394, 397, 398, 400 graphics, 266, 272, 275, 287–289, 295, 305, 306 GraphNode class, 394, 400 grave accent, see backtick gravity, 282 greater than, 16 greed, 156–157 grep, 368 grid, 266, 273, 278–279, 330, 422 Group class, 113, 114, 126, 197, 411, 412 groupBy function, 95 grouping, 13, 29, 149, 155, 413 groups (exercise), 113, 114, 411, 412 H h1 (HTML tag), 222, 235 hack, 173 handleAction function, 382 hard disk, 175, 181, 184 hard drive, 12, 325, 327, 353, 387 hard-coding, 231, 307 has method, 105, 113 hash mark character, 214, 336 hasOwnProperty method, 105, 215, 417 head (HTML tag), 222, 223, 228 head property, 228 header, 313, 316, 360, 373 headers property, 315, 316, 329 height property, 350, 423 help text example, 257 hexadecimal numbers, 153, 314, 336, 346 Hières-sur-Amby, 183 hidden element, 238, 262 higher-order functions, see function, higher-order history, 5, 349 historyUpdateState function, 346 Hoare, C.A.R., 82 Hooke’s law, 395 hooligan, 375 Host header, 313 hot code, 392 href attribute, 222, 232, 235 HTML, 221, 312, 326, 369 notation 221 structure 227 html (HTML tag), 223, 228 HTTP, 219–221, 311–317, 366, 367, 369, 373, client, 361, 367, 372 server, 360, 363, 375, 381 http package, 360–361 HTTPS, 221, 317, 361 https package, 361 human language, 23 Hypertext Markup Language, see HTML Hypertext Transfer Protocol, see HTTP hyphen character, 13, 147, 238 I id attribute, 232, 239, 323 idempotence, 189, 366, 425 identifier, 204 identity, 65 if keyword, 28, 162 chaining, 29, 34, 408 If-None-Match header, 374, 380, 385 image, 233, 258, 287, 313 imagination, 265 IME (input method editor), 252 img (HTML tag), 222, 233, 237, 258, 287, 295, 296, 345 immutable, 65, 120, 270, 335, 336, 342, 346, 423 implements (reserved word), 26 import keyword, 173 in operator, 64, 105 includes method, 68, 69, 399, 411 indentation, 32 index, 61 index property, 149 index.html file, 381 index.js file, 355 indexOf method, 71, 73, 94, 113, 146, 158, 411 infinite loop, 33, 47, 139, 409 infinity, 14 infrastructure, 169 inheritance, 100, 111–112, 139, 365 INI file, 160 ini package, 169, 173, 175, 356 initialization, 258 inline caching, 403, 404 inline element, 235, 237 inlining, 400 inner function, 44, 418 inner loop, 154 innerHeight property, 257 innerWidth property, 257 input, 134, 247, 266, 319, 353, 378 input (HTML tag), 257, 318, 322, 323, 325, 341, 345 input event, 322 insertBefore method, 232, 233 installation, 169 instance, 101 instanceof operator, 112, 139 instructions, 3, 391 integers, 13 integration, 145, 230 interface, 98 canvas, 287, 289 design, 54, 145, 150, 155, 158, 229, 230, 272, 290 HTTP, 316, 373 module, 168–172, 175, 315, 356 object, 105, 106, 109, 114, 126, 189, 269, 301, 322, 335 interface (reserved word), 26 internationalization, 162 internet, 160, 220, 221, 224 Internet Explorer, 225 interpolation, 15 interpretation, 7, 170, 207–208, 212, 391 interview question, 37 inversion, 147 invoking (of functions), see function application IP address, 221, 311, 313 isDirectory method, 366, 425 isEven (exercise), 56, 408 isolation, 97, 167, 170, 224 iterable interface, 107, 412 iterator, 196 iterator interface, 106, 107, 114, 398 J Jacques, the weresquirrel, 60 Java, 5 JavaScript, 5 availability of, 2 flexibility of, 6 history of, 5, 219 in HTML, 223 syntax, 23 uses of, 6 versions of, 6 weaknesses of, 6 JavaScript console, 7, 16, 27, 134, 138, 330, 354 JavaScript Object Notation, see JSON join method, 94, 104, 356 journal, 60, 62, 64, 66, 69 JOURNAL data set, 68 journalEvents function, 69 JSON, 77, 175, 184, 193, 315, 328, 373, 386, 425 json method, 315 JSON.parse function, 77, 426 JSON.stringify function, 77 JSX, 384 jump, 4 jump-and-run game, 265 jumping, 266, 282 just-in-time compilation, 392 K Kernighan, Brian, 128 key code, 282 key property, 252, 418, 423 keyboard, 26, 247, 251, 266, 281, 282, 285, 319, 320, 322, 349 keyboard bindings (exercise), 349, 423 keyboard focus, see focus keydown event, 251, 260, 282, 349, 418, 423 keyup event, 251, 282 keyword, 24, 26, 235 Khasekhemwy, 322 kill process, 360 Knuth, Donald, 40 L label, 295, 307 label (HTML tag), 323, 341 labeling, 323 landscape example, 44 Laozi, 180 lastChild property, 230 lastIndex property, 158–160 lastIndexOf method, 71 Last-Modified header, 313 latency, 174 lava, 266, 267, 275, 278, 280, 305 Lava class, 270, 280 layering, 194, 220 layout, 235–237 laziness, 236 Le Guin, Ursula K., 2 leaf node, 229 leak, 225, 285 learning, 2, 6, 371 left (CSS), 240–242, 244 LEGO, 168 length property for arrays, 61, 336 for strings, 53, 56, 61, 74, 409 less than, 16 let keyword, 24, 25, 43, 65, 75, 76, 130 level, 266, 267, 273, 275, 284 Level class, 267 lexical scoping, 44 library, 230, 334, 356, 357 license, 169 line, 24, 32, 161, 287, 289–294, 307, 420 line break, 14, 161 line comment, 35, 156 line drawing, 350, 424 line width, 290, 297 lines of code, 211 lineTo method, 290–291 lineWidth property, 290 link (HTML tag), 277 linked list, 79, 410, 426 links, 222, 230–231, 251, 252, 344 linter, 173 Liskov, Barbara, 96 list (exercise), 79, 410 listen method, 360 listening (TCP), 220, 360 literal expression, 23, 146, 206, 208 live data structure, 227, 233, 240, 419 live view, 372, 373, 387, 426 lives (exercise), 285 load event, 258, 295–296, 303, 326, 421 LoadButton class, 344 local binding, 48, 215, 409 local scope, 43, 212 localhost, 360 localStorage object, 326–327, 383 locked box (exercise), 141, 413 logging, 133 logical operators, 17 long polling, 372–374, 378, 380, 385 loop, 4, 30, 32, 37, 38, 50, 69, 85, 90, 91, 160, 189, 408, 409, 420 termination of, 33 loop body, 31, 85 lycanthropy, 60, 66 M machine code, 3, 213, 391 macro-optimization, 406 magic, 99, 203 mailRoute array, 123 maintenance, 169 malicious script, 224 man-in-the-middle, 317 map, 272, 321 map (data structure), 104 Map class, 105, 109, 195 map method, 88, 91, 94, 99, 104, 120, 191, 268, 340 Marcus Aurelius, 246 match method, 149, 159 matching, 146, 151, 152, 158, 164 algorithm, 152–154 Math object, 56, 61, 75 Math.abs function, 76, 424 Math.acos function, 75 Math.asin function, 75 Math.atan function, 75 Math.ceil function, 76, 278, 302–303 Math.cos function, 75, 241, 242, 421 mathematics, 50, 86 Math.floor, 76, 122, 278, 302–303 Math.max function, 27, 61, 74, 75, 302 Math.min function, 27, 56, 75, 302 Math.PI constant, 75, 293 Math.random function, 75, 122, 271, 330, 404 Math.round function, 76 Math.sin function, 75, 241, 242, 271, 281 Math.sqrt function, 68, 75, 411 Math.tan function, 75 Matrix class, 107–108, 335 matrix example, 107–108, 111 MatrixIterator class, 108 max-height (CSS), 275–276 maximum, 27, 75, 90 max-width (CSS), 275–276 McConnell, Steve, 390 Meadowfield, 117 measurement, 397 measuring, 399 measuring a robot (exercise), 125, 412 media type, 317, 329, 365 meetups, JavaScript, 371 memory, 3, 11 call stack, 24 organization, 12, 47, 60, 65, 77 persistence, 387 speed, 181, 213, 400, 402, 406 structure sharing, 79 mesh, 221 message event, 259 meta key, 252 metaKey property, 252, 349 method, 62, 100, 101 array, 71 HTTP, 312, 317, 360, 367, 373, 375 interface, 98 method attribute, 313 method call, 98 method property, 315 methods object, 363 micro-optimization, 397, 399, 406 Microsoft, 225 Middle East, graph of, 393 mime package, 365 MIME type, 329, 365 mini application, 326 minifiers, 175 minimalism, 265 minimum, 27, 56, 75 minimum (exercise), 56, 408 minus, 13, 165 Miró, Joan, 332 mirror, 298, 308, 421 mirroring, 297–298 MKCOL method, 368–369, 425 mkdir function, 368–369, 425 modification date, 366 modifier key, 252 modular robot (exercise), 177, 414 modularity, 97, 334 module, 168, 169, 177, 272, 355, 356, 375 design, 175 module loader, 355 module object, 172 module system, 169 modulo (remainder) operator, 14, 33, 297, 407, 408, 418, 420 Mongolian vowel separator, 162 monster (exercise), 285, 419 Mosaic, 225 motion, 266 mouse, 26 button, 249, 250, 253 cursor, 253 mouse trail (exercise), 262, 418 mousedown event, 250, 253, 255, 337, 338, 422 mousemove event, 254, 260–262, 338, 350, 418 mouseup event, 253–255 moveTo method, 290, 293 Mozilla, 225 multiple attribute, 324, 325 multiple-choice, 318–319, 323, 324 multiplication, 13, 269–270, 280 multiplier function, 49 music, 265 mutability, 63, 65, 120 N name attribute, 320, 324 namespace, 75 naming, 4, 5, 25–26 NaN (not a number), 14, 17, 18, 130 negation, 16, 17 neighbor, 330, 422 neighbors property, 190 nerd, 158 nesting of arrays, 67 of expressions, 23, 205 of functions, 44 of loops, 38, 408 of objects, 228, 231 in regular expressions, 154 of scope, 44 Netscape, 5, 225 network, 182, 219, 372 abstraction, 194, 316 protocol, 220 reliability, 188 security, 317 speed, 174, 181, 353 network function, 194 new operator, 101 newline character, 14, 38, 147, 156, 161, 268, 422 next method, 107, 197, 412 nextSibling property, 230 Nietzsche, Friedrich, 226 node, 228, 229 node program, 354 node-fetch package, 361 Node.js, 6, 7, 27, 171, 183, 353–369, 372, 373, 375, 387, 398 NodeList type, 230, 239 node_modules directory, 355, 356 nodeName property, 243 nodeType property, 229, 418, 419 nodeValue property, 231 nonbreaking space, 162 normalizing, 396 not a number (NaN), 14, 17, 18, 129 notation, 173 note-taking example, 327 notification, 372 NPM, 169, 171, 173, 174, 176, 177, 355–358, 365, 375, 376, 387, 415 npm program, 356, 357, 365 null, 18, 19, 51, 61, 77, 80, 134 number, 12, 65, 146, 165, 414 conversion to, 19, 28 notation, 12–13 precision of, 13 representation, 12 special values, 14 Number function, 28, 35 number puzzle example, 50–52 Number.isNaN function, 29 O object, 59, 63–65, 97, 112 creation, 77, 101, 328, 401, 403 identity, 65 as map, 272 as module, 169 mutability, 65 property, 27, 61, 75, 76, 99 representation, 77 Object prototype, 99, 100 object shape, 404 Object.assign function, 328, 336 Object.create function, 100, 104, 211 Object.keys function, 64, 80, 195, 410, 417 object-oriented programming, 97, 101, 105, 106, 111, 119, 175 Object.prototype, 104 observation, 399 obstacle, 277, 278 offsetHeight property, 235, 236 offsetWidth property, 235 on method, 362 onclick attribute, 224, 248 onclick property, 337 OpenGL, 289 opening tag, 222 operator, 13, 16, 19, 204, 210, 404 application, 13 optimization, 50, 55, 236, 260, 266, 275, 306, 308, 359, 392, 398–400, 403, 406, 426 option (HTML tag), 319, 324, 425 optional, in pattern, 148 optional arguments, 48, 78 options property, 324 ordering, 220 ordinal package, 171–172 organic growth, 167 organization, 167 outline, 289 output, 16, 26, 27, 133, 134, 211, 353, 422 overflow (CSS), 275–276 overflow, with numbers, 12 overlap, 278 overlay, 238 overriding, 103, 105, 111, 415 overwriting, 367, 369, 378 P p (HTML tag), 222, 235 package, 168, 171, 355, 357 package (reserved word), 26 package manager, 169 package.json file, 357 padding (CSS), 274 page reload, 258, 321, 326 pageX property, 253, 255 pageXOffset property, 236 pageY property, 253, 255 pageYOffset property, 236, 257 Palef, Thomas, 265 panning, 339 paragraph, 222 parallelism, 182, 313 parameter, 27, 42, 43, 46–48, 74, 76, 99, 131, 172 parent node, 249 parentheses arguments, 23, 41, 46, 85, 204 expression, 13 in regular expressions, 149, 151, 152, 162, 413 statement, 27, 29, 31, 33 parentNode property, 230 parse function, 207 parseApply function, 206 parseExpression function, 205 parseINI function, 161, 168 parsing, 77, 129, 161, 203–206, 208, 211, 223, 227, 364, 380 password, 317 password field, 318 path canvas, 290–293, 420 closing, 291 file system, 355, 363 URL, 312, 315, 363, 364, 373, 375 path package, 365 pathfinding, 123, 176, 193, 343 pathfinding (exercise), 405, 406, 426 patience, 350 pattern, 145–147, 157 pausing (exercise), 285, 419 pea soup, recipe analogy, 84 peanuts, in weresquirrel example, 70–71 percent sign, 314 percentage, 94, 257 performance, 154, 174, 212, 236, 266, 306, 359, 391, 393, 397, 399 period character, 27, 61, 74, 147, 156, 165, 336 persistence, 326, 372, 387, 425 persistent data structure, 119, 120, 126, 132, 335, 342, 346, 419 persistent group (exercise), 126 persistent map (exercise), 413 PGroup class, 126, 413 phase, 271, 281 phi coefficient, 66–68 phi function, 68, 76 phone, 252 physics, 277, 281, 393, 418 physics engine, 278 pi, 13, 75, 241, 271, 293 PI constant, 75, 242 pick function, 343 picture, 287, 288, 296, 306, 334, 346 Picture class, 335, 345 picture property, 335 PictureCanvas class, 337, 349 pictureFromImage function, 345 pie chart example, 294, 295, 307, 420 ping request, 190 pink, 336 pipe analogy, 220 pipe character, 152, 414 pipe method, 364, 367 pipeline, 175 pixel, 235, 242, 253, 267, 273, 288, 289, 295, 296, 302, 306, 308, 333, 335, 339, 342, 343, 345, 350, 423 pixel art, 296 PixelEditor class, 340, 347, 349 pizza, in weresquirrel example, 67 platform game, 265, 285 Plauger, P.J., 128 player, 265–267, 275, 278, 281, 284, 296, 303, 305 Player class, 270, 281 plus character, 13, 148, 165 pointer, 230 pointer events, 253–256, 337 pointerPosition function, 338 polling, 247 pollTalks function, 385 polymorphism, 105–106 pop method, 62, 71 Popper, Karl, 234 port, 220, 311, 360 pose, 296 position, of elements on screen, 236 position (CSS), 240, 244, 257, 266, 275 POST method, 313, 314, 321, 374 postMessage method, 259 power example, 42, 48, 50 precedence, 13, 17, 239 predicate function, 88, 92, 95 Prefer header, 374, 380, 385 premature optimization, 50 preventDefault method, 251, 256–258, 282, 321, 339, 423 previousSibling property, 230 primitiveMultiply (exercise), 141, 413 privacy, 225 private (reserved word), 26 private properties, 98, 141–142 process object, 354–355, 364–365 processor, 181, 400 profiling, 50, 399 program, 2, 23, 28 program size, 83, 84, 164, 272 programming, 1 difficulty of, 2 history of, 3 joy of, 1, 2 Programming Is Terrible, 166 programming language, 1–2 creating, 203, 213 DOM, 229 history of, 3 machine language and, 391 Node.js and, 354 power of, 5 programming style, 3, 24, 32, 35, 272 progress bar, 256 project chapter, 117, 203, 265, 333, 371 promise, 200, 416 Promise class, 186, 187, 189, 195, 197, 198, 200, 315, 326, 359, 361, 363, 386, 416 Promise.all function, 190, 199, 200, 416 Promise.reject function, 187 Promise.resolve function, 186, 190 promises package, 359 promptDirection function, 139 promptInteger function, 134 propagation, of events, 249, 250, 257, 258 proper lines (exercise), 350, 424 property access, 27, 61, 129, 348, 403 assignment, 63 definition, 63, 66, 109 deletion, 63, 98 inheritance, 99, 101, 103 model of, 63 naming, 105–107 testing for, 64 protected (reserved word), 26 protocol, 220, 221, 311–312 prototype, 99–104, 111, 211, 215, 417, 426 diagram, 103 prototype property, 101 pseudorandom numbers, 75 public (reserved word), 26 public properties, 98 public space (exercise), 369, 425 publishing (packages), 358 punch card, 3 pure function, 55, 79, 88, 175, 330, 422 push method, 62, 69, 71, 411, 426 pushing data, 372 PUT method, 312–313, 363, 367, 373, 378, 425 Pythagorean theorem, 411, 423 Python, 391 Q quadratic curve, 292 quadraticCurveTo method, 292, 420 query string, 314, 374, 380 querySelector method, 240, 417 querySelectorAll method, 239, 324 question mark, 18, 148, 157, 314 queue, 198 quotation mark, 14, 165 quoting in JSON, 77 of object properties, 63 quoting style (exercise), 165, 413 R rabbit example, 98, 100–102 radians, 242, 293, 298 radio buttons, 318, 323 radius, 350, 423 radix, 11 raising (exceptions), 135 random numbers, 75, 271 random-item package, 414 randomPick function, 122 randomRobot function, 122 range, 88, 147, 148 range function, 5, 78, 409 Range header, 316 ray tracer, 306 readability, 4, 5, 35, 50, 54, 135, 167, 208, 276, 307 readable stream, 361, 362, 364, 378 readAsDataURL method, 345 readAsText method, 326 readdir function, 359, 366, 425 readdirSync function, 425 read-eval-print loop, 354 readFile function, 172, 358, 425 readFileSync function, 359, 424 reading code, 6, 117 readStorage function, 184 readStream function, 378, 379 real-time events, 247 reasoning, 17 recipe analogy, 84 record, 62 rect (SVG tag), 288 rectangle, 266, 278, 289, 307, 342 rectangle function, 342, 423 recursion, 47, 50, 56, 80, 189, 195, 205, 206, 208, 231, 243, 300, 394, 408, 410, 413, 416, 418 reduce method, 89, 91, 94, 95, 340, 411 redundancy, 397 ReferenceError type, 215 RegExp class, 146, 157, 424 regexp golf (exercise), 164 regular expressions, 145–165, 206, 368, 375, 376, 417, 424 alternatives, 152 backtracking, 153 boundary, 151 creation, 146, 157 escaping, 146, 158, 414 flags, 149, 155, 157, 414 global, 155, 158, 159 grouping, 149, 155 internationalization, 162 matching, 152, 158 methods, 146, 150, 158 repetition, 148 rejecting (a promise), 187, 189, 198 relative path, 172, 224, 355, 363, 425 relative positioning, 240, 241 relative URL, 315 remainder (modulo) operator, 14, 33, 297, 407, 408, 418, 420 remote access, 363 remote procedure call, 316 removeChild method, 232 removeEventListener method, 248, 419 removeItem method, 326 rename function, 359 rendering, 289 renderTalk function, 384 renderTalkForm function, 385 renderUserField function, 383 repeat method, 73, 257 repeating key, 251 repetition, 52, 148, 154, 157, 260 replace method, 155, 165, 413 replaceChild method, 233, 418 replaceSelection function, 322 reportError function, 383 repulsion, 393, 395 request, 185, 189, 220, 312, 313, 321, 360, 361, 367, 372 request function, 189, 361, 362 request type, 185 requestAnimationFrame function, 241, 258, 260, 283, 308, 418 requestType function, 190 require function, 171, 172, 178, 355, 356, 365, 375 reserved words, 26 resolution, 172, 355 resolve function, 364 resolving (a promise), 186, 187, 189, 198 resource, 220, 221, 312, 313, 317, 363, 377 response, 185, 189, 312, 313, 316, 360, 364, 366 Response class, 315 responsiveness, 247, 353, rest parameters, 74 restore method, 299, 300 result property, 326 retry, 189 return keyword, 42, 47, 101, 196, 408, 411 return value, 27, 42, 134, 185, 410 reuse, 54, 112, 167–169, 356 reverse method, 79 reversing (exercise), 79, 409 rgb (CSS), 274 right-aligning, 243 rmdir function, 366, 368 roadGraph object, 118 roads array, 117 roads module (exercise), 177, 415 robot, 117, 119, 121, 123, 125, 177 robot efficiency (exercise), 125, 412 robustness, 373 root, 229 rotate method, 298, 300 rotation, 307, 420 rounding, 76, 134, 278, 279, 302, 424 router, 372, 375 Router class, 375, 376 routeRequest function, 194 routeRobot function, 123 routing, 192 rows, in tables, 243 Ruby, 391 rules (CSS), 238, 239 run function, 211 runAnimation function, 283, 285 runGame function, 284, 285 runLayout function, 396 runLevel function, 283, 285 running code, 7 runRobot function, 121, 412 run-time error, 132–134, 140, 417 Rust (programming language), 391 S Safari, 225 sandbox, 7, 59, 224, 227, 316 save method, 299, 300 SaveButton class, 344 scalar replacement of aggregates, 400, 402 scale constant, 337–339 scale method, 297, 299 scaling, 273, 296, 297, 303, 421 scalpel (exercise), 200, 416 scheduling, 197, 354 scientific notation, 13, 165 scope, 43, 44, 48, 168, 170–173, 208, 210, 214, 215, 417 script (HTML tag), 223, 224, 258 SCRIPTS data set, 87, 89, 92, 93, 95 scroll event, 256, 260 scrolling, 251, 256–257, 275–276, 282, 301 search method, 158 search problem, 124, 152, 154, 232, 368, 405 search tool (exercise), 368, 424 section, 161 Secure HTTP, 221, 317, 361 security, 224, 225, 316, 317, 325, 327, 364, 375 select (HTML tag), 319, 324, 327, 334, 340, 425 selected attribute, 324 selection, 322 selectionEnd property, 322 selectionStart property, 322 selector, 239 self-closing tag, 222 semantic versioning, 357 semicolon, 23, 24, 33, 237 send method, 185, 188 sendGossip function, 191 sep binding, 364–365 sequence, 148 serialization, 77 server, 220, 221, 311–313, 315, 316, 353, 360, 362, 363, 372, 375 session, 328 sessionStorage object, 328 set, 146, 147, 229 Set (data structure), 113, 126 Set class, 113, 126, 413 set method, 105 setAttribute method, 235, 337 setInterval function, 260, 296 setItem method, 326 setter, 110 setTimeout function, 184, 197, 259, 260, 380, 386 shape, 287, 290, 291, 293, 295, 307 shapes (exercise), 307, 420 shared property, 100, 103 SHIFT key, 252, 423 shift method, 71 shiftKey property, 252 short-circuit evaluation, 20, 51, 209, 411 SICP, 202 side effect, 24, 27, 34, 42, 54, 65, 79, 88, 159, 175, 199, 230, 232, 233, 236, 290, 299, 314, 334, 335 sign, 12, 165, 414 sign bit, 12 signal, 11 simplicity, 213 simulation, 119, 121, 265, 270, 330, 393, 418 sine, 75, 241, 271, 281 single-quote character, 14, 165, 224 singleton, 126 skill, 333 SkillShareApp class, 386 skill-sharing project, 371–373, 375, 381 skipSpace function, 206, 214 slash character, 13, 35–36, 146, 156, 315, 364, 425 slice method, 72, 73, 88, 233, 409, 416 slope, 424 sloppy programming, 261 smooth animation, 241 SMTP, 220 social factors, 349 socket, 372–373 some method, 92, 95, 191, 376, 426 sorting, 229 source property, 158 special form, 203, 208 special return value, 134, 135 specialForms object, 208 specificity, 239 speed, 1, 2, 308, 421 SpiderMonkey, 400 spiral, 307, 420 split method, 118, 268 spread, 74, 336 spread operator, 274 spring, 393, 395 sprite, 296, 303–304 spy, 256 square, 28 square brackets, 60, 61, 74, 76, 107, 147, 324, 328, 409 square example, 41–42, 45, 46 square root, 68, 75, 411 src attribute, 222, 224 stack, see call stack stack overflow, 47, 50, 56, 408 stack trace, 136 staged compilation, 392 standard, 5, 26, 35, 88, 136, 162, 349, 354, 355 standard environment, 26 standard output, 354, 362–363 standards, 219, 225 star, 307, 420 Star Trek insignia, 292 startPixelEditor function, 347 startState constant, 347 startsWith method, 364 stat function, 359, 365, 366, 425 state of application, 275, 334, 342, 346, 347, 388 in binding, 24, 31, 32, 34, 400 of canvas, 289, 299 in iterator, 197 in objects, 119, 268, 301 transitions, 198, 336, 337 statement, 23, 24, 28, 31, 32, 42, 63 static (reserved word), 26 static file, 373, 376 static method, 110, 113, 268, 413 static typing, 403 Stats type, 366 statSync function, 425 status code, 312, 354–355 status property, 315, 383 stdout property, 362–363 stopPropagation method, 250 storage function, 187 stream, 220, 361–363, 364, 367, 378 strict mode, 130 string, 14, 60, 62, 65, 92 indexing, 56, 72, 74, 92, 149 length, 37, 92 methods, 73, 149 notation, 14 properties, 72 representation, 15 searching, 73 String function, 28, 105 stroke method, 290–292 strokeRect method, 289, 421 strokeStyle property, 290 strokeText method, 295 stroking, 289, 290, 295, 306 strong (HTML tag), 235, 237 structure, 168, 222, 227, 334 Structure and Interpretation of Computer Programs, 202 structure sharing, 79 style, 237 style (HTML tag), 238, 239 style attribute, 237–239, 273 style sheet, see CSS subclass, 111 submit, 318, 320, 321 submit event, 321, 384, 425 substitution, 54 subtraction, 13, 113 sum function, 5, 78 summing (exercise), 78, 409 summing example, 4, 83, 89, 211 superclass, 111 survey, 294 Sussman, Gerald, 202 SVG, 287–289, 305, 306 swapping bindings, 424 swipe, 342 switch keyword, 34 symbiotic relationship, 183 symbol, 106 Symbol function, 106 Symbol.iterator symbol, 107 SymmetricMatrix class, 111 synchronization, 387, 426 synchronous programming, 182, 195, 359, 368 syncState method, 335, 338, 340, 341, 349, 426 syntax of Egg, 203, 204 error, 26, 129, 130 expression, 23 function, 42, 45 identifier, 26 number, 12, 165 object, 63 operator, 13 statement, 24, 26, 28–34, 135 string, 14 syntax tree, 204–205, 207, 228–229 SyntaxError type, 206 T tab character, 14, 32 TAB key, 320 tabbed interface (exercise), 262, 419 tabindex attribute, 252, 320, 349 table (HTML tag), 243, 266, 274, 422 table example, 417 tableFor function, 68 tables, 67, 68, 274 tags, 221–222, 227, 239, see also names of specific tags talk, 371, 372, 377–379 talkResponse method, 380 talksAbout function, 231 talkURL function, 383 Tamil, 87 tampering, 317 tangent, 75 target property, 250 task management example, 71 TCP, 220, 221, 311, 373 td (HTML tag), 243, 274 Tef, 166 temperature example, 110 template, 171, 388, 426 template literals, 15 tentacle (analogy), 25, 63, 65 terminal, 354 termite, 183 ternary operator, 18, 20, 209 test method, 146 test runners, 132 test suites, 132 testing, 125, 132 text, 14, 221, 222, 227, 229, 295, 305–307, 322, 324, 358, 422 text field, 257, 318, 319, 322 text method, 315 text node, 229, 231, 233, 419 text wrapping, 305 text-align (CSS), 243 textAlign property, 295, 420 textarea (HTML tag), 260, 318, 322, 327, 330, 425 textBaseline property, 295, 420 textContent property, 418, 422 TEXT_NODE code, 229, 419 textScripts function, 94, 411 th (HTML tag), 243 then method, 186–188, 191, 416 theory, 133 this binding, 62, 98–99, 101, 130 thread, 182, 183, 198, 259 throw keyword, 135, 136, 139, 141, 413 tile, 303 time, 147, 148, 150, 184, 241, 261, 277, 278, 280, 283, 303, 346 time zone, 150 timeline, 182, 197, 223, 241, 247, 258 timeout, 188, 259, 373, 374, 380 Timeout class, 189 times method, 269 timing, 396 title, 382 title (HTML tag), 222, 223 toDataURL method, 344 toLowerCase method, 62, 243 tool, 145, 164, 175, 334, 339, 340, 342–344, 347, 350, 357 tool property, 335 ToolSelect class, 340 top (CSS), 240–242, 244 top-level scope, see global scope toString method, 99, 100, 103–105, 346, 362 touch, 255, 334 touchend event, 255 touches method, 278 touches property, 255, 339 touchmove event, 255, 339, 350 touchstart event, 255, 337, 339 toUpperCase method, 62, 132, 243, 362 tr (HTML tag), 243, 274 trackKeys function, 282, 285 transform (CSS), 287 transformation, 297–299, 308, 420 translate method, 298, 299 Transmission Control Protocol, 220, 221, 311, 373 transparency, 289, 296, 346 transpilation, 213 trapezoid, 307, 420 traversal, 152 tree, 100, 204, 229 treeGraph function, 394 trial and error, 133, 282, 293 triangle (exercise), 37, 407 trigonometry, 75, 241 trim method, 73, 268 true, 16 trust, 224 try keyword, 136, 137, 190, 413, 422 type, 12, 16, 112 type attribute, 318, 321 type checking, 131, 174 type coercion, 18, 19, 28 type observation, 392, 401, 403 type property, 204, 249 type variable, 131 typeof operator, 16, 80, 410 TypeScript, 131–132 typing, 260 typo, 129 U Ullman, Ellen, xx unary operator, 16, 23 uncaught exception, 138, 188 undefined, 18, 19, 25, 42, 47, 61, 63, 77, 129, 130, 134 underline, 237 underscore character, 26, 35, 98, 151, 157 undo history, 346, 347 UndoButton class, 347 Unicode, 15, 17, 87, 92, 147, 162, 163 unicycling, 371 Uniform Resource Locator, see URL uniformity, 204 uniqueness, 239 unit (CSS), 242, 257 Unix, 366–368 Unix time, 150 unlink function, 359, 366 unshift method, 71 unwinding the stack, 135 upcasing server example, 362 updated method, 378, 381, 425 updateState function, 336 upgrading, 169 upload, 325 URL, 221, 224, 288, 313, 315, 317, 360, 373, 383 URL encoding, 314 url package, 364, 380 urlToPath function, 364 usability, 251 use strict, 130 user experience, 247, 320, 372, 383 user interface, 138, 334 users’ group, 371 UTF-8, 358, 359 UTF-16, 15, 92 V V8, 398 validation, 134, 140, 203, 277, 321, 378, 379 value, 12, 186 value attribute, 318, 322, 324 var keyword, 25, 43, 76 variables, see also binding Vec class, 113, 268, 269, 280, 394, 396, 421 vector, 394, 400 vector (exercise), 113, 411 vector graphics, 295 verbosity, 46, 182 version, 169, 222, 312, 357, 398 viewport, 275–277, 301, 302, 305 VillageState class, 119 virtual keyboard, 252 virtual world, 117, 119, 121 virus, 224 vocabulary, 41, 84 void operator, 26 volatile data storage, 12 W waitForChanges method, 380 waiting, 184 walking, 303 warning, 357 wave, 271, 280, 281 web, see World Wide Web web application, 5, 326, 333 web browser, see browser web page, 174 web worker, 259 WebDAV, 369 webgl (canvas context), 289 website, 224, 225, 313, 353, 369, 371 WebSockets, 373 weekDay module, 169–170 weekend project, 369 weresquirrel example, 60, 62, 64, 66, 69, 71 while loop, 4, 30, 32, 53, 160 whitespace in HTML, 231, 340, 419 indentation, 32 matching, 147, 162 syntax, 204, 206, 214, 417 trimming, 73, 268 in URLs, 373–374 Why’s (Poignant) Guide to Ruby, 22 width property, 350, 423 window, 250, 255, 258 window object, 248 with statement, 131 word boundary, 151 word character, 147, 151, 162 work list, 124, 343 workbench (exercise), 330, 422 world, of a game, 265 World Wide Web, 5, 77, 219, 221, 224, 225, 311 writable stream, 360–363, 364 write method, 360, 361 writeFile function, 359, 361, 425 writeHead method, 360 writing code, 6, 117 writing system, 87 WWW, see World Wide Web X XML, 230, 288 XML namespace, 288 xmlns attribute, 288 Y yield (reserved word), 26 yield keyword, 197 your own loop (example), 95 Yuan-Ma, 10, 352 Z Zawinski, Jamie, 144 zero-based counting, 56, 61, 150 zeroPad function, 54 zigzag shape, 420 zooming, 305 Eloquent JavaScript, 3rd Edition is set in New Baskerville, Futura, Dogma, and TheSansMono Condensed.

pages: 999 words: 194,942

Clojure Programming
by Chas Emerick , Brian Carper and Christophe Grand
Published 15 Aug 2011

Projects often produce multiple related artifacts under the same groupId, though it’s common for smaller Clojure open source libraries to have the same groupId and artifactId when there is no distinction between the organization and project. packaging, an identifier of the type of artifact that is being referred to that corresponds to the file extension of the artifact itself. This defaults to jar, and is generally not specified in the default case. version, a version string that ideally follows the conventions of semantic versioning.[249] In textual settings, Maven coordinates are often specified in a format like groupId:artifactId:packaging:version, so v1.3.0 of Clojure’s jar is referred to as org.clojure:clojure:1.3.0 (remembering that the jar packaging is the default). Each project defines its own coordinates—sometimes in a Maven pom.xml file, sometimes in a project.clj file if you are using Leiningen.

That library will likely distribute many builds with a version of 2.0.0-SNAPSHOT, and as long as you specify that version string in your project’s dependencies, you will always be working with and testing against the latest prerelease version.[253] You can then switch to using the 2.0.0 release version of the library once its authors finish their work and deploy the final release artifact to the project’s repository. Version ranges. Say you have a dependency on version 1.6.0 of a library, but you might know that you could safely depend upon a library not breaking API compatibility until its next major release. Insofar as nearly all artifacts use semantic versioning, as in this case, it is often useful to define dependency versions in terms of ranges of versions. Maven supports a number of version range formats: Table 8-2. Maven version range formats[254] Range formatSemantics (,1.0] x <= 1.0 1.0 “Soft” requirement on 1.0 [1.0] Hard requirement on 1.0 [1.2,1.3] 1.2 <= x <= 1.3 [1.0,2.0) 1.0 <= x < 2.0 [1.5,) x >= 1.5 [254] Taken from http://docs.codehaus.org/display/MAVEN/Dependency+Mediation+and+Conflict+Resolution.

This almost never causes any problems, but when it does, specifying a version range will eliminate the ambiguity. In this example, if you change your direct dependency on the library to [1.2,1.5], then version 1.5 will be selected. This scenario and your usage of version ranges in general depends upon your assessment of the projects that produce the libraries you depend upon. If they use semantic versioning (of some sort) reliably, then version ranges can be a great way to ensure that the artifacts you produce will be used only with versions of their dependencies with which they are likely to be compatible. On the other hand, if your dependencies are versioned using some other scheme,[255] then version ranges may be less useful to you.

pages: 960 words: 125,049

Mastering Ethereum: Building Smart Contracts and DApps
by Andreas M. Antonopoulos and Gavin Wood Ph. D.
Published 23 Dec 2018

Each version of the Solidity compiler corresponds to and compiles a specific version of the Solidity language. To get started, we will download a binary executable of the Solidity compiler. Then we will develop and compile a simple contract, following on from the example we started with in Chapter 2. Selecting a Version of Solidity Solidity follows a versioning model called semantic versioning, which specifies version numbers structured as three numbers separated by dots: MAJOR.MINOR.PATCH. The “major” number is incremented for major and backward-incompatible changes, the “minor” number is incremented as backward-compatible features are added in between major releases, and the “patch” number is incremented for backward-compatible bug fixes.

Remote Procedure Call (RPC) commands (see JSON-RPC API) request-response oracles, Oracle Design Patterns require function, Error Handling (assert, require, revert) resolver contracts, Resolvers revert function, Error Handling (assert, require, revert) reward, defined, Quick Glossary RLP (Recursive Length Prefix), Quick Glossary, The Structure of a Transaction root seeds, creating HD wallets from, Creating an HD Wallet from the Seed Ropsten Test Network, Getting Some Test Ether RPC (Remote Procedure Call) commands (see JSON-RPC API) Rubixi pyramid scheme, Real-World Example: Rubixi runtime bytecode, Contract Deployment Code Rust, Software Requirements for Building and Running a Client (Node) S SafeMath library, Preventative Techniques salts, From mnemonic to seed Satoshi Nakamoto, Quick Glossary SchellingCoin protocol, Decentralized Oracles Schneier, Bruce, Cryptographic Hash Functions SECG (Standards for Efficient Cryptography Group), Generating a Public Key secp256k1 elliptic curve, Elliptic Curve Cryptography Explained-Elliptic Curve Cryptography Explained, Generating a Public Key, Elliptic Curve Libraries secret keys, Quick Glossary(see also private keys) Secure Hash Algorithm (see SHA entries) security (smart contracts), Smart Contract Security-Conclusionsarithmetic over/underflow threat, Arithmetic Over/Underflows-Real-World Examples: PoWHC and Batch Transfer Overflow (CVE-2018–10299) best practices, Security Best Practices block timestamp manipulation threat, Block Timestamp Manipulation-Real-World Example: GovernMental constructors and contract name-change threat, Constructors with Care contract libraries for, Contract Libraries default visibility specifier threat, Default Visibilities-Real-World Example: Parity Multisig Wallet (First Hack) DELEGATECALL opcode threat, DELEGATECALL-Real-World Example: Parity Multisig Wallet (Second Hack) denial of service attacks, Denial of Service (DoS)-Real-World Examples: GovernMental entropy illusion threat, Entropy Illusion external contract referencing threat, External Contract Referencing-Real-World Example: Reentrancy Honey Pot floating-point problem, Floating Point and Precision-Real-World Example: Ethstick race conditions/front running threat, Race Conditions/Front Running-Real-World Examples: ERC20 and Bancor reentrancy attacks, Reentrancy-Real-World Example: The DAO risks and antipatterns, Security Risks and Antipatterns-Preventative Techniques short address/parameter attack, Short Address/Parameter Attack token standard implementation choices, Security by Maturity tx.origin authentication threat, Tx.Origin Authentication-Preventative Techniques unchecked CALL return value threat, Unchecked CALL Return Values-Real-World Example: Etherpot and King of the Ether unexpected ether threat, Unexpected Ether-Further Examples uninitialized storage pointer threat, Uninitialized Storage Pointers-Real-World Examples: OpenAddressLottery and CryptoRoulette Honey Pots seeded wallets (see deterministic wallets) seeds, Quick Glossary(see also root seeds) deriving from mnemonic code words, From mnemonic to seed mnemonic code words for, Wallet Technology Overview, Seeds and Mnemonic Codes (BIP-39)(see also mnemonic code words) optional passphrase with, Optional passphrase in BIP-39 selfdestruct function, Contract Constructor and selfdestruct, The Vulnerability SELFDESTRUCT opcode, Life Cycle of a Smart Contract, Contract Constructor and selfdestruct semantic versioning, Selecting a Version of Solidity Serenity, Quick Glossary, Ethereum’s Four Stages of Development Serpent, Quick Glossary, Introduction to Ethereum High-Level Languages SGX (Software Guard eXtensions), Data Authentication SHA (Secure Hash Algorithm), Quick Glossary SHA-3 Hash Function, Ethereum’s Cryptographic Hash Function: Keccak-256 shell commands, Software Requirements for Building and Running a Client (Node) short address/parameter attack, Short Address/Parameter Attackpreventative techniques, Preventative Techniques vulnerability, The Vulnerability side effects, Introduction to Ethereum High-Level Languages single-instance private blockchain, Local Blockchain Simulation Advantages and Disadvantages singleton, Quick Glossary smart contracts, Smart Contracts and Solidity-ConclusionsABI, The Ethereum Contract ABI-Selecting a Solidity Compiler and Language Version addressing an existing instance, Addressing an existing instance and Ethereum high-level languages, Introduction to Ethereum High-Level Languages-Introduction to Ethereum High-Level Languages as DApp backend, Backend (Smart Contract), Auction DApp: Backend Smart Contracts-DApp governance basics, Externally Owned Accounts (EOAs) and Contracts building with Solidity, Building a Smart Contract with Solidity-Conclusions call method, Raw call, delegatecall-Raw call, delegatecall calling other contracts from within a contract, Calling Other Contracts (send, call, callcode, delegatecall)-Raw call, delegatecall constructor function, Contract Constructor and selfdestruct creating new instance, Creating a new instance defined, Quick Glossary, Quick Glossary, What Is a Smart Contract?

Producing Open Source Software: How to Run a Successful Free Software Project
by Karl Fogel
Published 13 Oct 2005

In the section called “Stabilizing a Release” later in this chapter we will examine another, perhaps more common, method of releasing potentially unstable code to the public, in which the release number is further marked so that people have an idea of the risk/benefit trade-offs immediately on seeing the release's name. * * * [68] Since the first edition of this book was published, these conventions have been formalized, in a more detailed way, as the Semantic Versioning standard and are maintained at semver.org. As of this writing in July 2015 the latest version of the standard is 2.0.0. The recommendations made there seem to be roughly the same as the first strategy documented here, except that Semantic Versioning apparently does not include the forward-compatibility requirement for increments in the micro (patch) number. [69] Not seventeenth and tenth, because numbering starts from 0, not 1

Learning Puppet 4: A Guide to Configuration Management and Automation
by Jo Rhett
Published 24 Mar 2016

Default values used if you just hit ENTER are included in brackets after each question. $ puppet module generate myorg-puppet We need to create a metadata.json file for this module. Please answer the following questions; if the question is not applicable to this module, feel free to leave it blank. Puppet uses Semantic Versioning (semver.org) to version modules. What version is this module? [0.1.0] --> After you have answered all of the questions, it will generate the module in your cur‐ rent directory. Notice: Generating module at /home/vagrant/myorg-puppet... Notice: Populating templates... 138 | Chapter 13: Designing a Custom Module www.it-ebooks.info Finished; module generated in myorg-puppet. myorg-puppet/manifests myorg-puppet/manifests/init.pp myorg-puppet/spec myorg-puppet/spec/classes myorg-puppet/spec/classes/init_spec.rb myorg-puppet/spec/spec_helper.rb myorg-puppet/tests myorg-puppet/tests/init.pp myorg-puppet/Gemfile myorg-puppet/Rakefile myorg-puppet/README.md myorg-puppet/metadata.json If you prefer to skip the questions and edit the file yourself, add --skip-interview to the command line.

pages: 1,025 words: 150,187

ZeroMQ
by Pieter Hintjens
Published 12 Mar 2013

You want C4 certification for your project, you make sure your public contracts are documented. No “It’s specified in the code” excuses. Code is not a contract. (Yes, I intend at some point to create a C4 certification process to act as a quality indicator for open source projects.) All Public Contracts SHALL use Semantic Versioning. This rule is mainly here because people asked for it. I’ve no real love for it, as semantic versioning is what led to the so-called “Why does ØMQ not speak to itself?!” debacle. I’ve never seen the problem that this solved. Something about runtime validation of library versions, or some-such. All Public Contracts SHOULD have space for extensibility and experimentation.

pages: 834 words: 180,700

The Architecture of Open Source Applications
by Amy Brown and Greg Wilson
Published 24 May 2011

Was it actively developed and gaining new adopters? The Equinox team felt that the community around their final choice of technology was just as important as the technical considerations. After researching and evaluating the available alternatives, the committers selected OSGi. Why OSGi? It had a semantic versioning scheme for managing dependencies. It provided a framework for modularity that the JDK itself lacked. Packages that were available to other bundles must be explicitly exported, and all others were hidden. OSGi provided its own classloader so the Equinox team didn't have to continue to maintain their own.

A bundle is in the stopping state when it is executing its activator stop method to clean up any resources that were opened when it was active. Finally, a bundle may be uninstalled, which means that it's not available for use. As the API evolves, there needs to be a way to signal changes to your consumers. One approach is to use semantic versioning of your bundles and version ranges in your manifests to specify the version ranges for your dependencies. OSGi uses a four-part versioning naming scheme as shown in Figure 7.5. Figure 7.5: Versioning Naming Scheme With the OSGi version numbering scheme, each bundle has a unique identifier consisting of a name and a four part version number.

pages: 1,331 words: 183,137

Programming Rust: Fast, Safe Systems Development
by Jim Blandy and Jason Orendorff
Published 21 Nov 2017

It uses the most recent version of image that is considered compatible with version 0.6.1. The compatibility rules are adapted from Semantic Versioning. A version number that starts with 0.0 is so raw that Cargo never assumes it’s compatible with any other version. A version number that starts with 0.x, where x is nonzero, is considered compatible with other point releases in the 0.x series. We specified image version 0.6.1, but Cargo would use 0.6.3 if available. (This is not what the Semantic Versioning standard says about 0.x version numbers, but the rule proved too useful to leave out.) Once a project reaches 1.0, only new major versions break compatibility.

pages: 283 words: 78,705

Principles of Web API Design: Delivering Value with APIs and Microservices
by James Higginbotham
Published 20 Dec 2021

API consumers opt into a specific version and write code against that version. They only migrate to a new version when they are ready, which may be a long time after the new version is released, or perhaps never. Versions may be numbers or strings (e.g. v1 or 2017-01-14). For those familiar with semantic versioning (semver), this is the same thing as a major version. Figure 14.1 illustrates two versions of an API, each offered as a different product that the API consumer selects when making the API request. Figure 14.1 API versions are selected by the API consumer, while the API server offers both the current version (v2) for new applications and the previous version (v1) for existing applications until they migrate their code to v2.

pages: 537 words: 82,938

Rust Programming by Example
by Guillaume Gomez and Antoni Boucher
Published 11 Jan 2018

Now write this into your Cargo.toml file: [package] name = "tetris" version = "0.0.1" [dependencies] sdl2 = "0.30.0" Here, we declare that our project's name is tetris, its version is 0.0.1 (it isn't really important at the moment), and that it has a dependency on the sdl2 crate. For the versioning, Cargo follows SemVer (Semantic Versioning). It works as follows: [major].[minor].[path] So here's exactly what every part means: Update the [major] number version when you make incompatible API changes Update the [minor] number version when adding functionalities that don't break backward compatibility Update the [patch] number version when you make bug fixes that don't break backward compatibility It's not vital to know this, but it's always nice to be aware of it in case you intend to write crates in the future.

pages: 1,076 words: 67,364

Haskell Programming: From First Principles
by Christopher Allen and Julie Moronuki
Published 1 Jan 2015

Turns out, in the JSON standard, you’ll find that only JSON arrays and objects are allowed to be at the top level of an input stream. There’s a quickn-dirty fix for this: Prelude> type Result = Either String [NumberOrString] Prelude> eitherDecode "[123]" :: Result Right [Numba 123] Prelude> eitherDecode "[\"123\"]" :: Result Right [Stringy "123"] 24.11 Chapter Exercises 1. Write a parser for semantic versions as defined by http://semver. org/. After making a working parser, write an Ord instance for the SemVer type that obeys the specification outlined on the CHAPTER 24. PARSER COMBINATORS 893 SemVer website. -- Relevant to precedence/ordering, -- cannot sort numbers like strings. data NumberOrString = NOSS String | NOSI Integer type type type type type Major = Integer Minor = Integer Patch = Integer Release = [NumberOrString] Metadata = [NumberOrString] data SemVer = SemVer Major Minor Patch Release Metadata parseSemVer :: Parser SemVer parseSemVer = undefined Expected results: Prelude> parseString parseSemVer mempty "2.1.1" Success (SemVer 2 1 1 [] []) Prelude> parseString parseSemVer mempty "1.0.0-x.7.z.92" Success (SemVer 1 0 0 [NOSS "x", NOSI 7, NOSS "z", NOSI 92] []) Prelude> SemVer 2 1 1 [] [] > SemVer 2 1 0 [] [] True 2.