🎧 New: AI-Generated Podcasts Turn your study notes into engaging audio conversations. Learn more

Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...

Full Transcript

Computer Language Return to Table https://njctl.org/video/?v=jt48ebp8ljU of Contents Computers and Abstraction A computer is an electrical machine, which means it uses elect...

Computer Language Return to Table https://njctl.org/video/?v=jt48ebp8ljU of Contents Computers and Abstraction A computer is an electrical machine, which means it uses electrical switches to work. It is comprised of a very large number of "tiny switches" called transistors which are either open or closed (on or off). As computers became more complex, more and more transistors became necessary to store information. Integrated circuits (chips) were invented to hold more transistors. Modern integrated circuits contain up to 40 billion transistors. That is a lot of information! Machine Language Inside the computer, all information is stored as what is called bits. A bit is a single unit of information. Each bit can only be set to one of two values: 0 or 1. A "bit" is shorthand for a binary ("bi" is latin for two) digit. Each transistor stores one bit of data, since they also have one of two options: 0 or 1, on or off. Machine Languages are written in 0's and 1's and are the only languages which a computer can actually "understand." Machine Language Computers run on Machine Code which looks something like this: 01110000 01110010 01101001 01101110 01110100 00101000 00100010 01001000 0110111101110111 00100000 01100100 01101001 01100100 00100000 01111001 01101111 01110101 00100000 01100111 01100101 01110100 00100000 01101000 01100101 01110010 01100101 00111111 00100001 00100000 00100000 01000100 01101001 01100100 00100000 01111001 01101111 01110101 00100000 01110101 01110011 01100101 00100000 01100001 00100000 01100010 01101001 01101110 01100001 01110010 01111001 00100000 01110100 01110010 01100001 01101110 01110011 01101100 01100001 01110100 01101111 01110010 00100000 01101111 01101110 00100000 01111001 01101111 01110101 01110010 00100000 01100011 01101111 01101101 01110000 01110101 01110100 01100101 01110010 00111111 00100000 00100000 01001111 01110010 00100000 01100100 01101001 01100100 00100000 01111001 01101111 01110101 00100000 01110100 01110010 01100001 01101110 01110011 01101100 01100001 01110100 01100101 00100000 01100110 01110010 01101111 01101101 00100000 01100010 01101001 01101110 01100001 01110010 01111001 00100000 01100010 01111001 00100000 01101000 01100001 01101110 01100100 00111111 00100000 00100000 01000101 01101001 01110100 01101000 01100101 01110010 00100000 01110111 01100001 01111001 00101100 00100000 01100111 01101111 01101111 01100100 00100000 01101010 01101111 01100010 00100001 00100010 00101001 Machine Language Confusing right? It takes a specially trained eye to read the code and interpret it. This is where programmers came in. Programmers understood this code like another language and were able to translate information into 0's and 1's using punch cards with holes. These cards were manually inserted into a reader which translated them into on/off commands to store in the transistors. If the machine did not execute the program correctly, it meant that there was an error in the code. These errors had to be found manually by reviewing the punch cards one by one. Not only was this a difficult skill to master, but finding and correcting errors was a tedious and arduous task. Bytes versus Bits Every bit in a computer is represented by a transistor which can be on or off...1 or 0. One 1/0 (“on/off”) bit is the basic unit of memory. One bit can’t tell you much and is difficult to interpret, so they started getting grouped together in 8's. A group of eight bits is called a byte. You will see why a group of 8 is ideal for computers as the course continues. This is the first step of what is called Abstraction. Abstraction Abstraction is a way to represent essential features without needing to know or understand all of the background details. For example, when you drive a car, you only need to know how to use the steering wheel, the pedals, the gear shift, etc. You don't need to understand how the engine works, or how gasoline makes the car move. The driver only needs to focus on driving the car. When you bake a cake, you don't need to understand how your oven works. You don't need to understand the electronics on the inside. You just turn the dial, and the inside of the oven heats up to the desired temperature, so that you can focus all of your energy on baking a delicious cake. Abstraction A map contains less information than the real Earth therefore it is an abstraction. Its purpose is to help us find information on it more quickly than we would be able to searching the Earth. Abstraction Through abstraction, high­level computer languages were developed, which were easier for people to understand. These languages could be translated into machine language by a compiler. The computer then executed the machine language code. Abstraction 01110000 01110010 print("Hello World!") 01101001 01101110... High­level language: Low­level machine code: easy to write and edit difficult to write and edit Early Programming Languages The first programming languages, as we know them, began appearing after the compiler was invented in 1952 by Grace Hopper. A compiler acts like a translator between the programmer and the computer. It takes a "higher level" language (COBOL, in Hopper's case) which is easier for humans to understand and converts it to machine language, which a computer can execute. COBOL paved the way for new ways of programming such as Fortran in 1957. Fortran was the first of the third generation programming languages that utilized actual English words/syntax. Early Programming Languages Programs would be written in Fortran, using English characters, then manually sent to a compiler that converted the code into machine language, which could then be sent into the computer to execute the program. The compiler not only converted programming languages into machine code, but also, and more importantly, it "debugged" programs. Debugging is a critical reality of programming since errors (bugs) are an inevitable feature of writing code. Finding and fixing those bugs (debugging) is an integral aspect of coding. Early Programming Languages The compiler greatly decreased the amount of time programmers spent debugging by detecting errors and letting them know on which line of code they occurred. Today, a compiler is built into almost all IDEs. With this we are able to write code, compile (test for errors), and execute (run it) all within the same environment. Essentially, we do not worry about compilers anymore because they are always there; the program will not run/execute until it passes successfully through the compiler. If you would like to read more about the history of computers, check this out: https://www.explainthatstuff.com/historyofcomputers.html Higher Level Programming Languages Even with the invention of the compiler, programming in the third generation languages was not easy. In the 1970's two researchers at Bell Labs created the "C" language, from which many of the languages we use today (including Java) are derived. Also about that time "Object Oriented Programming", which we will learn about, made it easier for teams of programmers to collaborate on large, complicated projects. So, what did the first programs in the 1970's do? The 1st Programs Simple...they commanded the computer to output to the screen. Hello, World "Hello, World" is the first program in the original book on the C language, and it has become the traditional first program in most programming courses. It may seem rudimentary now, given what programs can do, but back then, it was huge. It changed programming forever and made it more accessible and possible for anyone to learn it. This is the first program every new programmer creates to this day! Programming Languages Just as there are many languages spoken around the world, there are many languages used to code. While they are different than one another, their basic logic, reasoning, and constructs are similar. Learning one will make it easier to learn the others as needed later in life. Some languages include: Java, HTML, C++, Python, JavaScript, PHP, SQL, Pascal, Visual Basic, C, Ruby, C#, Objective­C, etc. (By the way, Java is not the same thing as JavaScript.) Software Abstraction Here is an illustration of the levels of abstraction for programming languages. High­level computer language abstraction Graphical Language Abstraction Level JAVA, Python, C++ C COBOL Machine Code Low­level computer language Hardware Abstraction And your computer hardware itself also has levels of abstraction. High­level hardware abstraction Computer Abstraction Level Video/Special Purpose Cards Motherboard Memory Chips Logic Gates Transistors Low­level hardware abstraction

Use Quizgecko on...
Browser
Browser