What is a Build?
A build is a central component of every software project. The term “build” means different things, depending on what programming language you’re using, but generally when developers talk about a build, they mean:
A build is a set of pre-defined, coordinated steps that creates a working, tested and deployable instance of an application.
Builds can be done manually (Boo! We hate manual, remember?) or using automation tools. It’s uncommon these days to have anything other than automated builds. So, what actually happens during a build?
The Three Steps of a Build
When we talk about a build, we mean everything that happens in order to get the application ready for deployment. Deployment is a separate topic, one that we’ll cover in depth in an upcoming article. Here’s what happens in most projects, regardless of whether it’s mobile or web or even a desktop application.
- Compile – If the language you’re using requires your code to be compiled, this will be the first thing that happens in a build. Languages such as Objective C (used in iOS), Java, .NET and others require compilation before the application can actually run. Compilation means taking the source code your developers have written and creating what’s commonly called object code or byte code. Byte code is what computers actually understand. Glazing over yet? Pretty dry stuff, no? Other languages, such as Ruby or Javascript, are not compiled ahead of time but instead are interpreted while the program is running. These are called “interpreted” languages.
- Test – If your project has automated tests (which I know it will because you’re smart like that), the build process will include running all of the tests. By running the tests every time you run a build, you ensure that there’s been nothing introduced into the code that breaks existing stuff. Important!
- Optimize – If you’ve got assets associated with your project such as stylesheets and Javascript (and almost every project does), you’ll want to reduce the size of those asset files so that they either download faster (for web projects) or make the application smaller to download (as in the case of mobile). During optimization, there are tools that take the human-readable versions of these files and make them much smaller by eliminating things like spaces and extraneous characters.
How Does a Build Run?
Builds are typically performed by writing other code called a build script. Just like a movie or TV show script, a build script orchestrates exactly what is supposed to happen in the order required to achieve a successful build. Your developers will write this build script as a part of setting up the build environment, and then make changes to this script as the project evolves.
As we’ve talked about, modern languages have great tools for automating the build process.
In a well-designed project environment, a build will run every time a developer checks in new code. We talked about this process in depth in our article on continuous integration.
As a general rule, the more automated your build process, the less mistakes you’ll make and the sooner you’ll catch errors that slip through.
Just Remember
- A build is a set of pre-defined, coordinated steps that create a working, tested and deployable instance of your application
- Builds are managed by writing other code, called a build script
- Build automation should be a part of your project from day one, promoting a culture of “doing things once” and letting machines do the repetitive work
Your Assignment
- Schedule a 30-minute meeting with your development team to walk through how a build works for your project. Write down all of the steps in terms you understand and ask questions about what’s not clear
- How many of the steps we talked about above were a part of your build?