The Student Room Group

How was programing invented?

How for example does a java code or whatever programing language actually work? surely when you're writing a code that code must just be the top layer of a code underneath it which makes the code you just typed work.. alien technology swear down.. has to be. if you sit down and think about it, your mind will explode.

Posted from TSR Mobile

Scroll to see replies

computers, microchips, codes etc have always blown my mind....i try not to make sense of it
Did a presentation on this back in the day. Cba to explain. Maybe later
Something with more knowledge about computer science will probably answer, but I always thought that programming languages turned your inputs into binary codes that the computer can read, which it then runs off.
Okay, this is my crudely written attempt at explaining. If I'm wrong, please correct me. :smile:

All computers are based from what is known as the 'Stored Program' model, where it will execute instructions on at a time from a memory location. I won't go into the basics, but it will be in binary. The computer and what/whoever wrote the code will know what the binary patterns correspond to. A programmer will write this in assembly code, which are just mnemonics for the binary patterns. It looks something like this:

LOAD 3A54
ADD #47
SAVE 3A54

These vary depending on the type of chip inside each computer. So, if you wanted to program like this, you'd have to write unique code for each type. That's time-consuming, and also because of the simplicity, very difficult to make anything meaningful.

So what computer scientists began to do, was to develop programming languages. These would allow the programmer to write code in an easy-to-read style, and then when they 'compile' the code, it is automatically translated to the machine/assembly code by the compiler program. Modern programming languages even add extra things, like 'if' statements and something called 'object-oriented programming', which is basically what we use when writing programs. (Java, C#, etc.)
the clickies go clack and then keys push push -..
Reply 6
Original post by UnknownRoyalist
Did a presentation on this back in the day. Cba to explain. Maybe later



translation: i dont know
Original post by Armin.
translation: i dont know


Want my .doc attached?
The explanation for it would be to long. To even make sense of it you'd need to understand how a computer works etc, etc.
First computers were mechanical. Dunno whether that helps.

http://en.wikipedia.org/wiki/Difference_engine

(edited 9 years ago)
Original post by ChaoticButterfly
First computers were mechanical. Dunno whether that helps.

http://en.wikipedia.org/wiki/Difference_engine



Correct. Going waaay back - look up analytical engine or Charles Babbage if you're interested.
Programming languages are just multiple ways of accomplishing the same thing, just with varying levels of difficulty. Anything you can do in Java you can do using 1s and 0s, though I wouldn't want to be the one to try it.
Original post by A Mysterious Lord
Programming languages are just multiple ways of accomplishing the same thing, just with varying levels of difficulty. Anything you can do in Java you can do using 1s and 0s, though I wouldn't want to be the one to try it.


That to do with 'high level languages' and 'machine code' ?
Reply 13
Original post by UnknownRoyalist
Want my .doc attached?



I can imagine you using this as a chat up line on the ladies.


"Hey girl do you want me to show you my .doc?"

nerd
Original post by ChaoticButterfly
That to do with 'high level languages' and 'machine code' ?


Essentially yes, that's why high level languages need to be compiled/interpreted, so the computer understands it as binary (machine code).
Original post by A Mysterious Lord
Essentially yes, that's why high level languages need to be compiled/interpreted, so the computer understands it as binary (machine code).


So is say Microsoft word like the highest form of a language. Or is it based on something like C++? Or am I miss understanding.

What is the binary physically? Is it on/off of the current?
(edited 9 years ago)
Original post by Armin.
I can imagine you using this as a chat up line on the ladies.


"Hey girl do you want me to show you my .doc?"

nerd


Original post by Armin.
I can imagine you using this as a chat up line on the ladies.


"Hey girl do you want me to show you my .doc?"

nerd


:toofunny:

+Rep
(edited 9 years ago)
Original post by ChaoticButterfly
So is say Microsoft word like the highest form of a language. Or is it based on something like C++? Or am I miss understanding.

What is the binary physically? Is it on/off of the current?


Microsoft Word was written in C++.

I'm not sure what the whole process is, binary is the lowest level of code, so the machine interprets the high level language as a sequence of bits (1s and 0s).

I've not studied this for 8 years :tongue:
Reply 19
Original post by sarcasmrules
Okay, this is my crudely written attempt at explaining. If I'm wrong, please correct me. :smile:

All computers are based from what is known as the 'Stored Program' model, where it will execute instructions on at a time from a memory location. I won't go into the basics, but it will be in binary. The computer and what/whoever wrote the code will know what the binary patterns correspond to. A programmer will write this in assembly code, which are just mnemonics for the binary patterns. It looks something like this:

LOAD 3A54
ADD #47
SAVE 3A54

These vary depending on the type of chip inside each computer. So, if you wanted to program like this, you'd have to write unique code for each type. That's time-consuming, and also because of the simplicity, very difficult to make anything meaningful.

So what computer scientists began to do, was to develop programming languages. These would allow the programmer to write code in an easy-to-read style, and then when they 'compile' the code, it is automatically translated to the machine/assembly code by the compiler program. Modern programming languages even add extra things, like 'if' statements and something called 'object-oriented programming', which is basically what we use when writing programs. (Java, C#, etc.)


That's a good explanation. Just to note; Java (and some other languages) isn't actually compiled directly to architecture/OS specific code, but rather to an intermediate language. This is then interpreted at run-time by the Java Virtual Machine which runs on a specific OS/architecture and translates the intermediate language's instructions into instructions that match both the architecture (CPU type) and OS API. This means a Java executable/library only has to be compiled once and is instantly ready to run on any OS/architecture that supports the Java Virtual Machine.

Whereas C/C++ code has to be compiled as many times as there are target platforms e.g. x86 Windows, x64 Windows, x86 Linux, x64 Linux etc.

Quick Reply

Latest

Trending

Trending