When we talk about programming code we refer to the language by which the computers, comprises a set of instructions and data to be processed automatically.
The computer code it can be binary (interpretable only by computers), source code (interpretable by human beings), and in its legal or political aspect it can be free software, open source, freeware, shareware or proprietary / traditional proprietary software.
The free software or Free Software has a clear definition in this regard, according to the Free Software Foundation it is one that can be used for any purpose, studied (knowing what it does), copied and improved. There is a great variety of free software licenses, the GNU GPL being the reference of all, but we can also mention the MIT, BSD, Mozilla, Apache or Creative Commons licenses.
The open source software (open source) is basically the same as free software, except that you are not reluctant to mix proprietary software with free software. There is also open source software that cannot be used for any purpose, therefore it would not be free.
The freeware has little to do with free software, since the only free thing is its distribution: in general it cannot be modified, studied or commercialized, so it is obvious that it comes without source code (without "the recipe of the Program").
Shareware is similar to freeware but with an extra limitation: usage time. These programs are usually disabled in a few days, they are demo / light versions of complete proprietary programs.
The proprietary software traditional (in the style of Windows) does not allow its use for any purpose, does not allow its study (except by paying fortunes to its creators), does not allow its free copy or its improvement by anyone: it is the total inverse of free software, because Windows and GNU / Linux they are so confronted.