Such code updates the ball position, using the following formula:
new_position = current_position + current_speed * delta_time
Then it checks if the new position would cross a boundary, in such a case it makes the ball bounce, reverting the speed and updating its position.