Presentation is loading. Please wait.

Presentation is loading. Please wait.

Software - How to make a computer useful. SWC1 What is software really? Software is the ”magic wand”, which transforms the computer from dead metal to.

Similar presentations


Presentation on theme: "Software - How to make a computer useful. SWC1 What is software really? Software is the ”magic wand”, which transforms the computer from dead metal to."— Presentation transcript:

1 Software - How to make a computer useful

2 SWC1 What is software really? Software is the ”magic wand”, which transforms the computer from dead metal to a useful tool The function of a computer is almost entirely determined by the software For a DVD player, a specific movie is the ”software” for the player; we are not as such con- cerned about the player itself

3 SWC1 What is software really? More technical: Very accurate instructions to the computer, concerning how to react to various types of input The input could be: –A mouse click or movement –Pressing keys on a keyboard –Data in a file –Data from the Internet –Various other sources

4 SWC1 How to create software Initially, we have some sort of idea about what the software is supposed to do This must in turn be evolved to a very detailed specification concerning the functionality of the software A specification will be a collection of rules defining the behavior of the software, in all possible scenarios Formulating such rules may be quite hard in some situations…

5 SWC1 How to create software Example: Multiplication Multiplying two (large) numbers may be hard for a human being, but the rules are quite clear Quite easy to make a program, which can multiply two numbers A computer can perform multipli- cation much faster than any human being

6 SWC1 How to create software Example: Chess Chess is hard, even though the rules are precise! What is hard about chess? To measure, if some specific move makes your position better, and by how much If you can define a good measure for the ”quality” of a position, you just need to try a lot of them… The best chess programs are fairly equal to the best human chess players

7 SWC1 How to create software Eksempel: Perception of emotions Human beings are good – some better than others – at perceiving other peoples emotions just by looking at them It is very hard to define precise rules for this – we ”just do it” Even the best software – used e.g. in a robot – is much poorer at perceiving emotions than a human being

8 SWC1 How to create software If we are able to describe a set of rules for how to achieve a certain behavior, how do we then describe these rules to a computer!? In what language do we describe the rules? Recall that the computer can basically only do binary addition… How do we bridge the gap, and find a way to describe the rules, so both we and the computer agree on the interpretation of the rules?

9 SWC1 The long road… Human language Programming language (Java) CPU- language (assembler) Micro- code 0’s and 1’s Idea Pro- gram Human beings (Brain) Software (Compiler) Computer hardware

10 SWC1 Human language First step is to formulate the rules for the behavior in ordinary human language Must be as concise as possible Example (from chess): –If your king is in check, you must 1.Move your king to a position where it is not in check, or 2.Move another piece so that the king is no longer in check –If both 1 and 2 are impossible, you have lost Problem: Ordinary language is not very precise, and filled with assumptions

11 SWC1 Programming language We must now formulate the rules in a different language, which another program can translate into a language which the computer understands This language bridges the gap between humans and computer A compromise between being logically concise, and being humanly understandable

12 SWC1 Programming language if (myPieces.King.Status == Check) then {// NOTE: This is not precise Java if (board.noCheck(myPieces.King).exists == true) then (myPieces.King.move()) else if (myPieces.avoidCheck().exists == true) then (myPieces.avoidCheck().move()) else myGame.status = lost; }

13 SWC1 The language of the CPU The program, which translates from our programming language to the language of the CPU, is known as a compiler The language of the CPU is often called assembler code Humans can read assembler code, but it is quite hard, and requires lots of practice…

14 SWC1 Assembler code MOV AH, 08 INT 21 CMP AL, 42 JZ 0116 MOV BH, 12 INT 32 NJZ 0100 Uhm… what!?

15 SWC1 Micro-code Assembler code is almost impos- sible to understand for humans, but the CPU understands! The CPU makes yet another translation, to micro code The part of the CPU which performs the actual calculation understands micro code Extremely hard to understand

16 SWC1 Micro code 0AB C1292CB9A 882E1107AE …or just

17 SWC1 0’s and 1’s The CPU can process micro code instructions quite effectively This is the realm of the transistors! In terms of language, we have traveled a very long road, involving humans, other software, and the computer itself Still quite hard to produce software, but (fortunately) much easier than at the dawn of computers


Download ppt "Software - How to make a computer useful. SWC1 What is software really? Software is the ”magic wand”, which transforms the computer from dead metal to."

Similar presentations


Ads by Google