2 AnswersNew Answer
The earliest vacuum tube (valve) computers were programmed using switches and plugs (connectors) to literally hard wire the 1s and 0s into it. Later models were programmed using punched cards which were prepared using mechanical devices. The earliest semiconductor digital computers were programmed using a switch panel to set the bit pattern for the data and address busses which were then loaded by pressing a button. Do a search for images of the Altair 8800 and Imsai 8800 to see what they looked like. These machines had no assemblers or compilers. The programmer would write out the program and convert it to binary by hand then use these binary patterns to set the switches or wire up the plugs.
An outline (algorithm) for what would have been the first piece of software was written by Ada Lovelace in the 19th century, for the planned Analytical Engine. However, neither the Analytical Engine nor any software for it was ever created. The first theory about software – prior to the creation of computers as we know them today – was proposed by Alan Turing in his 1935 essay Computable numbers with an application to the Entscheidungsproblem (decision problem). This eventually led to the creation of the twin academic fields of computer science and software engineering, which both study software and its creation. Computer science is more theoretical (Turing's essay is an example of computer science), whereas software engineering is focused on more practical concerns.