DEV Community

Cover image for Code execution: explain like I'm five
Arika O
Arika O

Posted on

8 1

Code execution: explain like I'm five

We write code for computers, using programming languages that are easy to read for us but impossible to understand by a computer. So we translate that code into machine code and then computers can read it and do something with it. That something is often refered to as executing or running the code. But what does that mean?

The code we write is usually just a list of instructions for the computer the carry out. So, if for example we create a program that is supposed to show us a blue triangle on the screen, running the code will do exactly that: it will try and show us a blue triangle on the screen.

IMPORTANT
Notice the word try. As mentioned in the previous post, just because the code compiled, it doesn't mean the execution of the program will be successful. We can get execution errors, which happen while the computer is trying to run our code. These errors are refered to as runtime errors.

An execution error occurs when a program is asked to do something that it cannot and results in a crash. The most used example of a run time error is asking a program to divide by 0. The code contains no syntax or logic errors but when it runs it can't perform the task that it has been programmed to carry out - you can read more about this [here](https://www.zmescience.com/science/news-science/divide-zero-mechanical-calculator/#:~:text=Division%20by%20zero%20is%20a,the%20answer%20i

Sentry blog image

How I fixed 20 seconds of lag for every user in just 20 minutes.

Our AI agent was running 10-20 seconds slower than it should, impacting both our own developers and our early adopters. See how I used Sentry Profiling to fix it in record time.

Read more

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay