what is the source code?

671 views

What is the source code for a program? And why is it kept under secret, is it always part of the production version?

In: 2

10 Answers

Anonymous 0 Comments

EDIT: fixed a duplicate paragraph.

First I’ll explain what a program is.

A program is just a set of instructions in a specific format a computer can read telling it what to do. Sometimes a program or set of programs are used to run other programs (as in the case of an operating system).

A program is basically transformed source code. The transformation process (compilation) may take the source code, combine it with the product of other source code transformations and turn it into (but not always) a machine readable binary set of of instructions targeted to run on a particular CPU and operating system combination.

Because CPUs and computer configurations may differ some clever programmers developed programs (specifically called run-times) which let other developers write code that is compiled at the last possible moment (when the execution context is definitely known ie. what kind of CPU and operating system combination is present). This Just in Time compilation allows the run-time to target efficient machine-readable code that’s specific to the instruction set on the CPU.

Some languages (the syntax convention used in the source code) have programs which are distributed in source code format. Examples of this are Javascript, HTML (well HTML is technically not a language but rather a specification) and something called Python are examples of languages whose programs are distributed in source code format. Python may be compiled at the last moment (but that is more like caching the machine readable instructions).

You asked about secrecy.

There are several ways the the secrecy of a program might be protected. Applications distributed in compiled form are kind of difficult but not impossible to reverse engineer back into their source code form, and languages such as JavaScript may be obfuscated into something a human would find very hard to read but again not impossible as could ostensibly write a program to make an obfuscated program more readable. In fact some languages or rather run-times have a feature which allows the compiled code to be reflected or interrogated at run-time as an enabler of a feature you might want (such as a late-binding plugin). On the other hand it would be impossible to reverse engineer a remote application exposed through an API such as over a computer network since such programs are black-boxes only exposing touch points ie their binaries sit on some far away machine and you use a protocol that accepts just the data needed to run the computation you want – there is nothing for you to decompile even if you wanted to.

Some languages like Typescript may be transpiled (kind of like recompiled) down to JavaScript so that when run in a browser execution context the browser might understand it since browsers are not able to run Typescript natively.

There are also visual languages such as Squeak which take take visual building blocks as the source code of its programs. You can be assured that somewhere this visual program is transpiled into something some run-time somewhere will understand.

You are viewing 1 out of 10 answers, click here to view all answers.