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 were ever created.
The first theory about software—prior to 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), where as software engineering focuses on more practical concerns.
However, prior to 1946, software as we now understand it—programs stored in the memory of stored-program digital computers—did not yet exist. The first electronic computing devices were instead rewired in order to "reprogram" them.