Career Day: What do Engineers do?
I was asked to present a career day style discussion on software engineering at Mt. SAC’s MESA program. I put together a slide deck about what being a software engineer is and what the job market is like, etc. But I also wanted to blog through it here for folks who were curious but were unable to attend the event.
Overview
There are four main topics in the slide deck:
What the heck do software engineers do?
What is the current job market like?
What is a typical day like for an engineer?
How does one become a software engineer?
In this article I will cover the first.
What do software engineers do?
Software engineers write code
One of the first classes a software engineer takes in college is a programming class. As a rite of passage they are often asked to write a piece of code displays the words “Hello, World!”.
Software engineers write code to make computers complete tasks. It is typically much longer and more complex than this simple example. What types of things do software engineers try to solve with their code?
Engineers solve problems
Engineers write code to solve problems. A fun example engineers are asked to solve in college is the Towers of Hanoi puzzle. In a simple version, there are three disks, one small, one medium, and one large sized in diameter. There disks can slide onto three rods. The goal is to move the disks so that they are in decreasing order on the third rod, but there are three rules:
you may only move one disk at a time
you may only move the top disk from the stack on each rod
you may not place a disk on top of a smaller disk
A person can try their luck at this game by physically moving discs until they get the right answer. A software engineer can write code to search through all possible sequences of disc moves until it finds a solution. Because computers are good at executing simple repeated steps quickly, it can often find the solution faster than a person.
For fun, a piece of code to solve Towers of Hanoi is included below; note that it is not a very long piece of code and it can solve the problem for any number of discs.
static void towerOfHanoi( int n, char from_rod, char to_rod, char aux_rod) { if (n == 0) { return; } towerOfHanoi(n - 1, from_rod, aux_rod, to_rod); System.out.println( "Move disk " + n + " from rod " + from_rod + " to rod " + to_rod); towerOfHanoi(n - 1, aux_rod, to_rod, from_rod); }
While solving puzzles is a fun way to learn to write code to solve problems, there are not many companies that make money solving toy problems. The types of problems software engineers are asked to solve are typically about processing information. For example, imagine when we search for a movie title on Netflix. Some engineer had to write the code that took the search word and looked for all movies that had a movie title that matched that word. Think about all the things popular apps and websites do and know that a software engineer probably had to write the code to accomplish it.
Engineers create algorithms
An algorithm is a “process or set of rules to be followed in calculations especially by a computer.” Software engineers create algorithms to make sure that their code will solve all possible classes of the problem they try to solve. A popular introduction to algorithms involves sorting. Given a list of numbers, we must create a list of steps that puts them in a sorted order. Our list of steps (our algorithm) must lead to a solution no matter what the input list looks like.
There are many sorting algorithms, but let’s look at one of the easier to understand ones, Bubble Sort. The algorithm for Bubble Sort is:
For each spot in the list
If the number at the current spot is greater than the number in the spot to the right, swap the numbers
If we made any swaps go back to step 1 to make sure there aren’t any more out of order numbers
We can walk through what this algorithm would do with the small list (5, 1, 4, 2, 8).
In the first pass, it starts at the first number in the list, “5”, and compares it to the number to the right, “1”. The numbers are out of order, so it swaps them and the list of numbers is now (1, 5, 4, 2, 8). We list all the steps below:
First Pass
( 5 1 4 2 8 ) → ( 1 5 4 2 8 )
( 1 5 4 2 8 ) → ( 1 4 5 2 8 )
( 1 4 5 2 8 ) → ( 1 4 2 5 8 )
( 1 4 2 5 8 ) → ( 1 4 2 5 8 )
Second Pass
( 1 4 2 5 8 ) → ( 1 4 2 5 8 )
( 1 4 2 5 8 ) → ( 1 2 4 5 8 )
( 1 2 4 5 8 ) → ( 1 2 4 5 8 )
( 1 2 4 5 8 ) → ( 1 2 4 5 8 )
Engineers, create algorithms like this for all kinds of problems that they need to write code for. Thinking through the algorithm helps ensure they come up with a solution that works in all cases.
Engineers optimize algorithms
Having a correct algorithm isn’t good enough though. The code engineers write needs to be fast because code today can run on a lot of data. What if we needed to sort a very big list of numbers, is bubble sort going to take too long? When working on sorting problems, the number of times we have to compare numbers determines how long it takes us to sort everything. Check out this visualization of all the comparisons that get made in a bubble sort.
Engineers use their problem solving skills to reduce the number of comparisons their algorithm needs to make and invent new ones. Engineers can then look at how long their code takes to run based on the size of the list that needs to be sorted and compare different sorting algorithms. See one such comparison below.
We can see that Quick Sort performs very quickly even as the size of the list increases. On the other hand, Bubble Sort takes a very long time, especially when it gets to 300K numbers; imagine waiting 500 seconds for your favorite web page to load because an engineer used Bubble Sort.
Engineers work with customers
Engineers work with the customers who will use their code to understand what the customers expect the code to do. This may sound simple, but because code can do anything, honing done the specific thing the customer needs it to do can take a long time. If the scope of the project is large, this can take months. There is a lot of room for miscommunication which is perfectly described by this comic:
Engineers design systems
Engineers thoughtfully how each pieces of code they write will interact with all the other pieces of code they will or have already written. Once code is complete and customers start using it, if software engineers aren’t careful, it can be hard to modify it later. Engineers spend time designing their code into systems that will be easy to modify later.
Maybe all the code that displays a web page will go into one component. Maybe all the code that stores all the data will be put into one single place to make it easy to know where everything is. Maybe the UI will call a different module for each type of thing that it wants to retrieve from the database. An engineer might draw a picture like the one below to describe such a system.
Engineers share designs like this with their team and partner teams and they all discuss if the components are organized well and will be easy to change later. Once the design is agreed on, the work can be split up and the engineers can finally start writing code which is really all most engineers want to do.
Engineers push new code to servers
When an engineer has finished writing new changes in the code base, they need to update the servers executing the code to have those latest changes. Imagine we are at Netflix. There are thousands of servers responding to requests for movies running 24/7. Those servers are running some version of the code the engineers have written. Engineers will write changes to support new features that Netflix wants to launch. The engineers must update the code on the servers without interrupting customer’s experience; its unacceptable these days for a website to be unavailable because of server maintenance. The engineers also need a way to know that their new code works and doesn’t introduce any new problems.
Engineers spend a lot of time testing their code so they can prove that it is working probably. Engineers write lots of alerts and monitoring code to determine if their code is performing well. For example, at Netflix, there may be a monitor to keep track of if a certain movie fails to load for customers too many times in one day. This can let engineers know that maybe a change they made is not working for that movie.
Closing out
This is not a comprehensive list of everything a software engineer does. It is a list of the core things most software engineers do. It is presented at a high level and is intended for folks who are unfamiliar with what this career is. If any of this sounds interesting, keep a look out for the next section of this series that will take a look at what the software engineer job market may look like today and resources on how to research this information on your own.