Ada Lovelace described how the analytical engine could be programmed using loops, variables, conditional statements, and subroutines. She also wrote an algorithm for calculating Bernoulli numbers using the machine, which is regarded as the first computer program ever written.