It seems to be a naive question, but I was unable to find an explicit definition and difference in meaning of the words "software", "program", "application", and "gadget". What is the correct (at least theoretically) way to use each of these words?
The differences are mostly connotative and contextual.
"Software" can refer to the entire field, or in the specific to the general part of something that isn't hardware or to a collection of things that aren't necessarily part of the same program/app. ("An iPhone is great hardware, but it would be nothing without the software").
"Application" is a complete unit that may consist of more than one module in more than one language on more than one computer, all working together. It may not, in which case it is pretty much the same as a "program".
"Program" has the connotation of being a discrete unit, and while it is used interchangeably with "application", it seems awkward to refer to a "web program" instead of a "web app", or a "client/server program", instead of a "client/server app". "Program" is often used to refer to a complete operational unit as seen from a developer rather than a user perspective (it seems old-fashioned to refer, as a user, to installing a "program" instead of an "app"), and often for things that are not intended for public use, such as a testing program or proof of concept program.
"Gadget" (which I take to mean the same as "widget") usually means something smaller than an app, (though it is one), usually because it has less than a full-featured gui, it often runs inside or attached to something else, or is used casually to do one single thing, like checking the weather, rather than with prolonged interaction.
"Program" refers to an executable sequence of instructions that can be directly run by a computer (as opposed to a library, which can only be run by an outside program).
"Program" and "Application" are mostly interchangeable, though "Application" almost always refers to a program for a specific task that has some kind of user interface (as opposed to services/daemons, drivers, etc.).
"Software" is an umbrella term for all computer instructions, whether it be a program, library, framework, OS, or sometimes even the code itself.
"Gadget" is just a useful piece of electronic hardware, usually handheld, often shiny and overpriced.
I would say that the terms "program" and "application" are used synonymously. However, the term "software" can be more generic and does not necessarily always mean "program" or "application" (e.g. a software "library" or "framework" is not a "program" or "application", but are used to facilitate the functional requirements of "programs" or "applications").
This is what I know from my understanding within the context of a desktops, mobile devices or servers.
Software: Requires installation that is hardware specific. For example Windows 7 is software, Microsoft office is software, etc. Main thing here is there is an installation process.
Application: Doesn't require installation, when downloaded can be run it without making it hardware aware. For example java applications can be run on macs and pcs without installation due the virtual machine. If you can drag the download to your desktop and just click the executable and it runs, it would be called an application.
Program: Instruction for a computer to follow. For example the code you would run in a batch process is a program. There is no installation required, you are basically telling the computer to run some code to perform a task.