4 answers
Updated
1051 views
What is code made of?
How do you code? #coding #programming #computer-science #cs
Login to comment
4 answers
Updated
Fred’s Answer
Code is made of instructions for the computer to follow. Things like "print this to the screen", or "open and read this file" or "ask the user this question". It's a lot like building with Legos. No individual piece does much by itself, but when you combine them all, you can build something pretty huge and magical. Combining them in different ways can result in a vastly different result.
Updated
avi’s Answer
Code is the "language" a computer understand built with two distinct types of data: on and off 1/0
In fact, a computer is really just a collection of on/off switches (transistors). Anything that a computer can do is nothing more than a unique combination of some transistors turned on and some transistors turned off.
Binary code is the representation of these combinations as 1s and 0s, where each digit represents one transistor. Binary code is grouped into bytes, groups of 8 digits representing 8 transistors. For example, 11101001. Modern computers contain millions or even billions of transistors, which means an unimaginably large number of combinations.
In fact, a computer is really just a collection of on/off switches (transistors). Anything that a computer can do is nothing more than a unique combination of some transistors turned on and some transistors turned off.
Binary code is the representation of these combinations as 1s and 0s, where each digit represents one transistor. Binary code is grouped into bytes, groups of 8 digits representing 8 transistors. For example, 11101001. Modern computers contain millions or even billions of transistors, which means an unimaginably large number of combinations.
Updated
Mickael’s Answer
Hi Derek,
Code is a language to tell the processor and hardware in general to do something. Consider the hardware as being a bunch of switches and you code open and close these switches to perform something.
Usually though, you do not code in the processor language. Over the years, people came with various programming languages, with different level of abstractions, to make coding easier. But that mean there are other software that translate that code written in this language into a binary format that your operating system and hardware understand. That is called compiling (translating code into binary) and linking (take all binary and make them an executable for your Operating system to run).
There are things that come from your operating system for free (like Windows or Linux or MacOS - to mention the most known) that you do not even need to program. An example would be how your program gets loaded in memory or when should your program gives up the CPU for another program to run ...
At the end, the processor gets a binary line that represents what the line of code should do, and thanks to micro-language in the processor, decode the instruction, check where the data is, perform the operation, saves the data and run the next instruction ...
To help the Operating System, there is some code called drivers that defines services for your hardware. For example, read a block from your hard drive or send a message through your network adapter. The Operating System only knows the service but the specifics of the vendors is in the drivers. They are all code, running on the various pieces of your machine to make it works.
I hope I helped more than I confused you.
Code is a language to tell the processor and hardware in general to do something. Consider the hardware as being a bunch of switches and you code open and close these switches to perform something.
Usually though, you do not code in the processor language. Over the years, people came with various programming languages, with different level of abstractions, to make coding easier. But that mean there are other software that translate that code written in this language into a binary format that your operating system and hardware understand. That is called compiling (translating code into binary) and linking (take all binary and make them an executable for your Operating system to run).
There are things that come from your operating system for free (like Windows or Linux or MacOS - to mention the most known) that you do not even need to program. An example would be how your program gets loaded in memory or when should your program gives up the CPU for another program to run ...
At the end, the processor gets a binary line that represents what the line of code should do, and thanks to micro-language in the processor, decode the instruction, check where the data is, perform the operation, saves the data and run the next instruction ...
To help the Operating System, there is some code called drivers that defines services for your hardware. For example, read a block from your hard drive or send a message through your network adapter. The Operating System only knows the service but the specifics of the vendors is in the drivers. They are all code, running on the various pieces of your machine to make it works.
I hope I helped more than I confused you.
Updated
Srushti’s Answer
Hello,
Computer code is a set of rules or instructions. It is made up of words and numbers and when you put them in the right order it will tell your computer what you want it to do. You can program lots of things with code.
A programming language is a formal language comprising a set of strings that produce various kinds of machine code output. Programming languages are one kind of computer language, and are used in computer programming to implement algorithms. Most programming languages consist of instructions for computers. There are many programming languages used to code like java, C, C++, C#, python, Scala, JavaScript, PHP, etc.
If you want to learn to code- as a beginner, first thing I would suggest is to choose one coding language by doing your research about it. Once you choose the language, you can start with some online courses(e.g. Coursera, Udemy, geeksforgeeks, tutorials point) to know the basics. Then you can start coding on leetcode or HackerRank which has coding questions with levels like Easy, medium, hard. So start with easy questions, first try to develop logic by writing it in on a paper then try coding it - you can look at the solution but once you know the solution try coding it again before moving to the next question. Best way to learn is by practicing as much as you can.
Thanks!
Computer code is a set of rules or instructions. It is made up of words and numbers and when you put them in the right order it will tell your computer what you want it to do. You can program lots of things with code.
A programming language is a formal language comprising a set of strings that produce various kinds of machine code output. Programming languages are one kind of computer language, and are used in computer programming to implement algorithms. Most programming languages consist of instructions for computers. There are many programming languages used to code like java, C, C++, C#, python, Scala, JavaScript, PHP, etc.
If you want to learn to code- as a beginner, first thing I would suggest is to choose one coding language by doing your research about it. Once you choose the language, you can start with some online courses(e.g. Coursera, Udemy, geeksforgeeks, tutorials point) to know the basics. Then you can start coding on leetcode or HackerRank which has coding questions with levels like Easy, medium, hard. So start with easy questions, first try to develop logic by writing it in on a paper then try coding it - you can look at the solution but once you know the solution try coding it again before moving to the next question. Best way to learn is by practicing as much as you can.
Thanks!