DEV Community

Discussion on: Explain Artifacts (Deployment) Like I'm Five

Collapse
 
dmfay profile image
Dian Fay

Source code by itself is just static information on a computer somewhere. In order to accomplish anything, it has to be executed. This can entail a lot of extra work to produce something which can be executed: something written in C has to be compiled and linked. Java code has to be compiled to bytecode. Even though JavaScript is an interpreted language and JavaScript code can be run directly, if you're writing a library for use in a runtime like Node.js it has to be packaged in order to be useful to other projects. An artifact is the result of any of these different processes: code which has been prepared to run. It's usually compressed in a tarball or zip (Java JARs and WARs are just renamed zip files) for convenience.

Deployment is the process of putting an artifact where it needs to be and performing any tasks it needs in order to fulfill its purpose. Artifacts can be a huge range of things: desktop applications, web servers, "servlets" in Java which get dropped into a servlet container like Tomcat or Glassfish to become a functioning web application, tools, utility libraries, hardware drivers. For a web application, deployment could look like pushing the artifact to a server, extracting it, running some initialization scripts, and finally executing the code that starts the application listening for HTTP requests. A desktop application gets bundled into an installer and made available for download. A utility library is pushed to a repository where its dependents can access it: the npm public registry, Maven Central, private Artifactory or Nexus servers for proprietary code.