Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 INTRODUCTION TO COMPUTER SCIENCE CONCEPTS AND PROGRAMMING.

Similar presentations


Presentation on theme: "1 INTRODUCTION TO COMPUTER SCIENCE CONCEPTS AND PROGRAMMING."— Presentation transcript:

1 1 INTRODUCTION TO COMPUTER SCIENCE CONCEPTS AND PROGRAMMING

2 2 Outline Part I: An overview of Computer Science. Part II: Computer hardware and software. Part III: Computer languages.

3 3 Part I: An Overview of Computer Science

4 4 What is Computer Science? The study of how to solve problems with computers: 1) Design and build a computer Cpsc-321 Computer Architecture Cpsc-462 Microcomputer Systems Cpsc-469 Advanced Computer Architecture Cpsc-483 Computer Systems Design and others.

5 5 2) Use and share the computer efficiently: Cpsc-311 Analysis of Algorithms Cpsc-410 Operating Systems Cpsc-431 Software Engineering Cpsc-436 Computer-Human Interaction Cpsc-437 Software Engineering Products and others.

6 6 3) Communicate a solution to a Computer : Cpsc 121- Intro to CS Concepts & Pgming. Cpsc 221- Data Structures and Their Implications. Cpsc 310- Database Systems. Cpsc 332- Programming Language Design. Cpsc 334- Compiler Design. Cpsc 438- Distributed Objects Programming Cpsc 442- Scientific Programming. Cpsc 452- Robotics & Spatial Intelligence. and others. 3

7 7 Semantics Vs. Syntax Syntax: The grammar rules for writing code in a program. Semantics: The meaning of the code. The action that will be executed. How you write the code vs. why you write the code.

8 8 4) Find a solution automatically : -Artificial Intelligence (CPSC 320). 5) Make your solution easier for people to use: - Human-Computer Interaction (CPSC 436). 6) Solve BIG problems: - Software Engineering (CPSC 431). 7) Exploit multiple computers: -Parallel and Distributed systems, Networking.

9 9 Real-life programs are usually: large (thousands of lines of code). created by teams of people. modified over the course of years. Rules and methods are needed to cope with this complexity. Computer Science is more than Programming !

10 10 Part II: Computer Hardware and Software

11 11 Outline The development of modern computer systems. Computer organization. Solving problems on computers. Programming and software engineering.

12 12 The Development of Modern Computer Systems Early electronic computers. Computer Architecture. Time sharing. Microcomputers. Networked computing.

13 13 Early Electronic Computers ENIAC (1946) - Electronic Numerical Integrator and Calculator. –First general purpose purely electronic digital computer. –Built for US Army to make calculations for weather predictions & ballistics tables. –18,000 vacuum tubes, space 50 X 30 ft, weighed 30 tons. –Numbers are entered by manually setting its 6000 switches.

14 14 EDVAC - Electronic Discrete Variable Calculator. –Executed a general instruction set and a stored program. –Both numbers and program instructions were stored electronically in the computer’s memory. UNIVAC - Universal Automatic Computer. –First commercially built computer. –Delivered to the U.S. Census Bureau in 1951 to tabulate the results of the previous year’s census.

15 15 Computer Architecture Generations: –The development of modern computers is often described in terms of the “generation”, in which a particular technology was used. Design: –The overall design of a computer’s electronic circuitry and its logical functionality is called its architecture.

16 16 Mainframes First generation – 1940s/1950s Architecture: Electronic Circuitry: Vacuum Tubes Stored program: Program: machine language. Processing: a single program at a time. Peripheral devices: –Input and output: punched cards. –Data storage: magnetic tapes.

17 17 Second and Third Generations 1960’s Electronic circuitry: transistors to integrated circuits (ICs). –Symbolic Languages: Assembly languages. High-Level languages: FORTRAN - FORmula TRANslation, first high- level language. COBOL - COmmon Business-Oriented Language. LISP - LISt Processing.

18 18 –Translators: translating high-level language to machine-understandable form. Assemblers: converting program instructions from assembly languages into the machine language. Compilers: translating program statements from FORTRAN and COBOL to machine language. Interpreter: translating and executing each program statement dynamically.

19 19 –Operating Systems (OS): a program to control the overall processing of the machine. Batch processing: jobs that were similar in their requirements were grouped together into batches and run sequentially. JCL (Job Control Language): to minimize operator intervention, JCL cards were inserted between the card decks of each job to direct how each job was to be processed. Mass storage: disk drives provide permanent storage and fast access to large quantities of data.

20 20 Microcomputers Fourth generation – 1970s. –Chip circuitry: VLSI - Very Large Scale Integration, which could contain all logic circuits on a single chip. These chips were known as microprocessors. Minicomputers – 1970s. –Lower cost and more accessible computing power. –Architecture is based on the 16-bit (vs. the 32- bit in use for larger computers) representation of data in computer memory.

21 21 PC - Personal Computer – 1970s-1980s. –Low cost computers intended for personal use. Input: keyboard. Output: screen. Data storage: removable floppy disks. Examples: Apple, IBM PC. –DOS - Disk Operation System. DOS was developed by Microsoft for the IBM PC. DOS provides the basic functions for a single user to handle data storage and to control input and output devices and program execution.

22 22 GUI – Graphical User Interface. With the introduction of the Mac (Macintosh) computer by Apple in 1984. Information was presented to the user via pictures, known as icons. A new hand-held input device, called a mouse, was available for selecting choices from the screen. Each graphical image is composed of small dots called pixels which must be manipulated individually by the computer ‘s programs.

23 23 PC software. –Software are programs directing a computer’s operations and solving problems. –Hardware are the physical devices that form the computer itself. –The popularity of PCs grew rapidly in the 1980s as innovative application programs were developed to enable non-technical users to do useful tasks on the computer.

24 24 Word processors allow a user to write and edit text. Spreadsheet programs provider convenient computational power for data stored in tables. Business graphics programs are able to display data in the form of graphs and charts.

25 25 Workstations – 1980s. –For complex number crunching scientific and engineering programs. –For a single user. –Using multiprocessing systems. –Well suited for networking use.

26 26 Networked Computing Computer networks – 1980s-present. –Users access computers which are at a distance. –Users share data. –Users transmit messages between computers. Telephone lines. –An electronic device called a modem allows computers to transmit data over telephone lines,

27 27 LAN – Local Area Network. –A LAN allows computers in reasonable proximity of each other to be connected by cabling over which data can be transmitted from one machine to another without the use of telephone lines. Distributed Computing. –Techniques of shared processing over networks are generally called distributed computing. –A computer that provides the core of the services is called a server. –Any computer requesting a service is known as a client.

28 28 Computer Organization Data representation Main Memory Central Processing Unit Secondary Storage Input / Output

29 29 The information which a computer processes is generally known as data. Individual data values may represent numbers, alphabetic characters, or other coded information. The computer programs which direct the computer’s operations are also data, because the instructions which they contain must be stored in the computer’s memory before they are able to be processed.

30 30 All data is stored and processed in binary form, that is, as a series of 0s and 1s. Each binary digit, called a bit, represents the smallest unit of information which can be stored in the computer. Bits are grouped into longer units known as bytes to hold more meaningful data. –1 byte = 8 bits

31 31 Two standard coding systems. –ASCII – American Standard Code for Information Interchange. “Help”  01001000 01000101 01001100 01010000 128 64 32 16 8 4 2 1 H -> 72 2 7 2 6 2 5 2 4 2 3 2 2 2 1 2 0 0 1 0 0 1 0 0 0 –EBCDIC – Extended Binary Coded Decimal Interchange Code Hello  11001000 11000101 11010011 11010011 11010110

32 32 Main Memory Main memory is that part of a computer’s electronic circuitry which holds in binary form the program to be executed and any data that the program requires. Memory is divided into cells. Each cell is assigned a specific address, from 0 to the maximum size of the computer’s memory capacity.

33 33 The size of a computer’s memory is the number of the addressable cells it contains. Bit1 Byte8 bits Kilobyte2 10 bytes1,000 Megabyte2 10 kilobyte 1,000,000 Gigabyte2 10 megabyte 1,000,000,000 Terrabyte2 10 Gigabytesone trillion e.g. 256K bytes of memory have, 256 * 1024 = 262,144 bytes.

34 34 ROM – Read-Only Memory, is a specialized part of main memory which is designed to prevent data loss when the power to the computer is turned off. –Read-Only. –Permanent. –Typical use: ROM is reserved for critical program instructions which must be immediately available when a computer is first turned on( bootstrap pgm ).

35 35 BootStrap Program Program that is automatically executed when the machine is turned on. It directs the CPU to transfer programs (in most cases it is the Operating System) and data from a predetermined location into the volatile area of main memory. The Op Sys takes over and begins controlling the machine’s activities.

36 36 Central Processing Unit CPU is the heart of a computer. –Control unit contains the circuitry for coordinating the machine’s activities. –Arithmetic/Logic Unit (ALU) contains the circuitry that performs all arithmetic computations and logic operations.

37 37 BUS- For the purpose of transferring bits, a machine’s CPU and Main Memory are connected by a bus. The CPU extracts(reads) data from main memory by supplying the address of the pertinent memory cell along with a read signal. The CPU places(writes) data to memory by provided the address of the destination cell and the data to be stored, along with a write signal.

38 38 CPU Main Mem ALU Control ROM unit Bus Register Mem Volatile Mem

39 39 Register Usage Program Counter (PC) is a special- purpose memory location which always contains the memory address of the instruction that is currently being executed. Instruction Register (IR) is another special-purpose memory cell which contains the instruction currently being processed.

40 40 Hardware Characteristics: CPU synchronizes its operations by the regular pulses emitted by an electronic device called a clock. The speed of a computer can be quoted as: –Clock speed, e.g. 100MHz means 100 million cycles per second(megahertz). –MIPS, a million instructions per second

41 41 Arithmetic/Logical Unit (ALU) performs all arithmetic computations and logical operations. Arithmetic -Add, subtract, multiply, divide, exponentiation etc. Logical -Testing for relationships. A<B;Name = ‘mary’; C >=10;possible Answers? True or False The ALU contains special memory cells, known as registers, in which the arithmetic is carried out.

42 42 reads the individual program instructions from main memory. Executes the instructions 1 at a time until completion. Fetch - Decode - Execute The machine cycle algorithm is continuously repeated until program termination. CPU Machine Cycle

43 43 Fetch: Retrieve a copy of the program command from the address stored in the program counter.  update the program counter to the address of the next instruction.  The instruction just Fetched is placed in the instruction register.

44 44 DECODE:Decode the Bit pattern in the instruction register. EXECUTE:Having decoded the instruction, the control unit enters the execute phase. It activates the correct circuitry to perform the requested task.

45 45  If the instruction is a load from memory, the Control unit causes the load to occur.  If the instruction is for an arithmetic operation, the control unit activates the appropriate circuitry in the ALU with the correct input stored in registers.  When the instruction has been executed, the control unit again begins the machine cycle with the Fetch cmd (the address of the next cmd is in the program counter)

46 46 Diagram of Architecture CPU R1 PC R2 IR R3 R4 control unit ALU bus

47 47 First second third Instr. Instr. Instr. 0 1 2 3 4 … 95 96 97 98 99 …….. memory

48 48 Secondary Storage Mass storage devices. –Tape drives, floppy disk drives, zip disk drives, CD- ROM drives, etc. Static storage( Fixed Size) Slower Access Speed. Non-volatile

49 49 User Input / Output Input devices: –Keyboard, mouse, light pen, etc. Output devices: –Computer screen, printer (dot matrix, ink jet or laser), etc.

50 50 Solving Problems on Computers

51 51 Designing Modular Solutions Top-down 1.Start with what you want. 2.Cut it up in parts. 3.If the parts are trivial to solve, then solve them. 4.If the parts are non trivial, apply top-down again. You will cut up the problem in smaller and smaller sub- problems until they can be solved trivially. Bottom-up 1.Start with what you small parts. 2.Put them together to form large parts. 3.Until you end up with the thing that you wanted.

52 52 Problem with top-down design: –You must know how you break the problem up. –You need intuition to tell you that this is the right way to divide the problem into sub- problems. Problem with bottom-up design: –Where do you start? –Usually used in an evolution way, thus systems start simple, functionality increases as time goes by.

53 53 An example of Top-Down Design Compute Tax Compute adjustments Compute deductions Compute credits Compute adjusted gross income Compute Income Interest & dividends Wages Capital gains Business income Misc. Income

54 54 IPOS Cycle I – Input: Implies 3 Questions: 1) Input what? 2) Input how? 3) Input where?

55 55 Input What? Program & Data Program [Load Module] in machine code form after being compiled & Linked. 05C0 5820C00E Hexidecimal Notation 0000 0101 1100 0000 ….. Binary Notation 0 5 C 0 Hex digits

56 56 Data e.g. Program to calculate a students avg grade String dataNumeric data Bob 72 84 Will be stored in memory using a Binary coding scheme: ASCII or EBCDIC

57 57 How Input? Input Devices: Floppy disk, Magnetic Tape Drive, Disk Drive, CRT, Voice, Light pen, Scanners etc. Where Input? Main Memory of the Computer.

58 58 Processing 2 Categories Arithmetic: Add, subtract,Multiply, Divide Exponentiation Trig functions, etc… Logical:Testing for relationships. A< B;Name = ‘Mary’; C >=10;Possible Answers? (true or false)

59 59 Output - What? Hard copy: physical, tangible, portable. Print outs. Soft copy: visual, CRT displays Output Devices: printers, floppy disk, Mag tape, Mag disk, voice, etc.

60 60 S - Secondary Storage Medium Long Term Storage: Disks, Tapes, etc. Store What? Program Itself. Program output.

61 61 Algorithm Representations Aides to documentation of your Design. Pseudocode: The steps of the algorithm are written in English in a shorthand form which represents the flow of control through the algorithm. It is not language specific. Its purpose is to make the logical sequence of the program clear and is an aide to writing the actual code.

62 62 An Example : A professor who is about to write a program to assign grades to the students in his Programming in C course might express his final grade algorithm in the following pseudocode. Repeat for each student:locate a student’s scores | compute the average quiz score | compute the average homework score | if the midterm exam was a make-up then reduce the exam score by 10% | compute the student’s course grade | post the student’s course grade:

63 63 Flowcharts: –For the problem whose solutions involve decision and repeated steps. –Flowcharts typically show a program’s logic. –Symbols: Start/stop Input/Output Decisions Processing Flow of control

64 64 An Example : An algorithm to control an Automatic Teller Machines (ATMs). Start Stop Read card Correct pwd? Access account info Reject card no yes Deposit Withdraw Inquire ……

65 65 Decision Trees: An example: A telephone company bases its rates for long distance calls on the time of day and day of the week when a call is made. Long distance charges Weekday Weekend 8am to 5pm 5pm to 11pm 11pm to 8am Saturday Sunday 8am to 5pm 5pm to 11pm 11pm to 8am full rate evening rate night rate evening rate night rate

66 66 Programming Programming is the process of translating a problem’s solution into instructions that a computer can process. Software Life Cycle: –Analysis: analyze the problem. –Design: use top-down or bottom-up. –Implementation: use hardware and/or software. –Testing: try it in the lab. –Maintenance: keep it working. Programming

67 67 Paradigms: –Procedural programming: The traditional approach to the programming process. The development of a sequence of commands that, when followed, manipulate data to produce the desired result. Machine languages, Fortran, Cobol, Basic, Pascal, C. –Declarative programming: Task is to discover and implement a general-problem solving algorithm first. Problems can be solved merely by stating them in a form that is compatible with the algo, and then applying the algorithm. It has been used for many years to simulate a system(economic, political, environmemtal(weather)). Prolog, GPSS.

68 68 –Object oriented programming: Like procedural, but has operations on objects only. Operations change the state of an object. Eg., A list of student names is constructed as an object consisting of the list together with a collection of procedures(methods) for manipulating the list(insertions, deletions, sorting the list, detecting if the list is empty…..). Smalltalk, Visual basic, C++, Java.

69 69 Part III: Computer languages

70 70 Why Computer Languages? Compute are stupid. –They do not “understand” things. –They have to be told very precisely what to do. Natural language are ambiguous. –“College Station’s largest (quality (free) newspaper)”.

71 71 High-Level Pascal Pgm Program Example; const x = 12; y = 30; var z: integer; begin z := x + y; end.

72 72 Assembly Program EXAMPLE CSECT Balr 12, 0 Using Base 12 Base L 2, X A 2, Y ST 2, Z BCR 15, 14 X DC F ’12’ Y DC F ’30’ Z DS F END CSECT

73 73 Machine Code( Hexidecimal) 05C0 Balr 12, 0 5820 C00E L 2, X 5A20 C012 A 2, Y 5020 C016 ST 2, Z 07FE BCR 15, 14 0000000C X DC F ’12’ 0000001E Y DC F ’30’ 00000000 Z DS F END EXAMPLE


Download ppt "1 INTRODUCTION TO COMPUTER SCIENCE CONCEPTS AND PROGRAMMING."

Similar presentations


Ads by Google