Introduction To Programming - TMF 1414 Lecture 1 - PDF

Summary

This document is a lecture on the introductory concepts of computer programming. It covers computer history from early mechanical devices to modern microprocessors, different generations of computers, programming languages, and the components of a computer. The summary is based on the first page.

Full Transcript

TMF 1414 Introduction to Programming Lecture 01: Introduction 1 What is a Computer? What is inside a computer? Content Programming languages What does it take to become a programmer? 2 What is...

TMF 1414 Introduction to Programming Lecture 01: Introduction 1 What is a Computer? What is inside a computer? Content Programming languages What does it take to become a programmer? 2 What is a computer? It is an electronic device that stores and process data. It is all around us It consists Hardware Example: Motherboard, mouse, keyboard, CPU & etc. Software Example: Window XP, MS Word… 3 History of Computers - Long, Long Ago beads on rods to count and calculate still widely used in Asia! 4 History of Computers - Long, Long Ago 🞂 Napier’s Bones ◦ John Napier invented logarithms in 1917, which allows multiplication to be performed via addition ◦ The Napier’s Bones were invented to ease the calculation ◦ Napier’s Bones led directly to Napier’s the invention of slide rule Bones (1632). ◦ Slide rule also used in Mercury, Gemini and Apollo 5 space program by NASA Slide History of Computers - 19th Century first stored program - metal cards first computer manufacturing still in use today! 6 Charles Babbage - 1792- 1871 🞂 Difference Engine c.1822 ◦ huge calculator, never finished 🞂 Analytical Engine 1833 ◦ could store numbers ◦ calculating “mill” used punched metal cards for instructions ◦ powered by steam! ◦ accurate to six decimal places 7 Modern Compute r 8 Vacuum Tubes - 1941 - 1956 🞂 First Generation Electronic Computers used Vacuum Tubes 🞂 Vacuum tubes are glass tubes with circuits inside. 🞂 Vacuum tubes have no air inside of them, which protects the circuitry. 9 first fully electronic digital computer built in the U.S. Created at the UNIVAC - University of Pennsylvania 1951 ENIAC weighed 30 tons contained 18,000 vacuum tubes Cost a paltry $487,000 10 Grace Hopper Programmed UNIVAC Recipient of Computer Science’s first “Man of the Year Award” 11 1956 – Computers began to Second incorporate Generati Transistors on – 1956- Replaced 1963 vacuum tubes with Transistors 12 1964-1971 Third Generati Integrated Circuit on – Operating System 1964- 1971 Getting smaller, cheaper 13 Third Generation Computers used Integrated Circuits (chips). Integrated Integrated Circuits are Circuits transistors, resistors, and capacitors integrated together into a single “chip” 14 The First Microprocessor – 1971 The 4004 had 2,250 transistors four-bit chunks (four 1’s or 0’s) 108Khz Called “Microchip” 15 Very Large Scale Integrated Circuit (VLSIC) Transistors, resistors, What is a and capacitors 4004 had 2,250 Microchip? transistors Pentium IV has 42 MILLION transistors Each transistor 0.13 microns (10-6 meters) 16 MICROCHIPS! 4th Generati on – Getting smaller 1971- and smaller, but we are still using present microchip technology 17 Birth of Personal Computers - 1975 🞂 256 byte memory (not Kilobytes or Megabytes) 🞂 2 MHz Intel 8080 chips 🞂 Just a box with flashing lights 🞂 cost $395 kit, $495 assembled. 18 IBM PC - 1981 IBM-Intel-Microsoft joint venture First wide-selling personal computer used in business 8088 Microchip - 29,000 transistors 4.77 Mhz processing speed 256 K RAM (Random Access Memory) standard One or two floppy disk drives 19 Apple Computers Founded 1977 Apple II released 1977 widely used in schools Macintosh (left) released in 1984, Motorola 68000 Microchip processor first commercial computer with graphical user interface (GUI) and pointing device (mouse) 20 Generations of Electronic Computers 21 1990s: Pentiums and Power Macs Early 1990s began penetration of computers into every niche: every desk, most homes, etc. Faster, less expensive computers paved way for this Windows 95 was first decent GUI for “PCs” Macs became more PC compatible - easy file transfers Prices have plummeted $2000 for entry level to $500 $6000 for top of line to $1500 22 Great increases in speed, storage, and 21st memory Increased networking, Century speed in Internet Widespread use of CD- Computi RW PDAs ng Cell Phone/PDA WIRELESS!!! 23 🞂 Hardware What is ◦ Central Processing Unit (CPU) Intel Duo Core, AMD& etc ◦ Memory inside a Hard disc, RAM ◦ Storage Devices Pen Drive, CD, DVD, Diskette comput ◦ Input Devices Keyboard, Mouse, Scanner… er? ◦ Output Devices Monitor, projector, speaker… ◦ Communication Devices Modem, Wireless card, Switches and Hub, router… 24 What is Software Also known as computer programs inside a A collection of instruction for computer to operate comput Can be written in many types of languages Collections of important program er? to operate the basic operation of a computer is Operating System Example of OS: Microsoft (cont’) Windows, DOS, OS X (MAC), UNIX and etc 25 Programming Languages A programming language is a machine – readable artificial language to express computations that can be performed by a machine. In simple term, the language that can instruct computer to perform certain operation! 26 How Computer Works? Memory (RAM) CPU Input device Output (CU & ALU) device 27 How Computer Interacts? High Level Language Low Level Hey, do you Language hear me? Operating System Human Malay n ese 28 C hi How Computer Interacts? Low Level Language Operating System pi l C L a ng uage m er C o v el Comp il Le e er i gh uag H ng Visual Basic La Word MS 29 How Computer Interacts? Low Level Language Operating Computer alone 🡪 Dead System pi l C om Computer+OS 🡪 Alive er Computer+OS+Compiler🡪 Interact Comp il er 30 Types of Programming Languages Basically there are 3 types of programming language: Machine languages Assembly languages High-level languages 31 Machine Languages Basically machine cannot understand human language. Computer only understand numbers.(Digital format) Machines languages are machine-dependents, but it generally consists string of numbers (eventually will reduce to 1s and 0s) Example: 1000100111 (Binary system) +130042774 32 Assembly languages 🞂 Machine language is hard to understand and write. 🞂 An English-like abbreviations formed the basic languages. 🞂 A translator program called assemblers will later convert the assembly language to machine language 🞂 Example of assembly languages syntax: ◦ LOAD ◦ ADD ◦ STORE 33 High-level language 🞂 Assembly language is easier to use and learn compare to machine language, but it is still very tedious to write a complex program which involve a lot of operation. 🞂 High-level languages are developed, where single statements can accomplish substantial tasks. 🞂 It make programming more easier and fun. 🞂 Translator programs called compiler convert high- level language to machine language 🞂 Example of High-level language ◦ C, C++, JAVA, FOTRAN, COBOL, PYTHON, PHP…. 34 Computer Sample Languages Machine Languages 100111100101111101111111110100100101100001010 1001001011110101011101010100010101010111111 Assembly Language LOAD BASEPAY ADD OVERPAY STORE GROSSPAY High level languages GROSSPAY = BASEPAY + OVERPAY Summary View 35 Translating a High Level Language into Binary High Level Object Binary Language code Language int x = 2; … 001000101 int y = 2; LDX 02 101100100 int sum; LDA 02 010110010 sum = x + y; Compiler ABC X Linker 110110100 printf(“%d”,sum STA 3e8 101101001 ); … 001000101 C source Intermediate The code code executable Somewhat like program assembly 36 Newer Programming Languages Graphical-based programming language with scripts Only simple knowledge on logic is needed in programming Example: Visual.NET (C, C++, C#, Basic) JAVA WEB Programming Multimedia programming (FLASH…) 37 Types of programming paradigms Imperative Paradigm Procedural /Structured programming Object oriented programming Parallel processing approach Declarative Paradigm Logic programming Functional Programming Database processing approach 38 A High-Level Explanation The difference between Imperative and Declarative programming is related to how a program works vs. what a program does. Imperative programming is about how a program works while Declarative programming is about what a program does. Let’s look at an example. Building a House “Imperatively” Imperative is about the HOW. For example, if I was writing an imperative program for building a house, it would go something like this: Build the foundation Put in the framework Install the utilities Add the walls Finishing touches In this imperative program, I have told you the exact steps to take in order to build the house. These instructions aren’t the most detailed in the world, but I have told you all the steps you need to take in order to arrive at a finished product. 39 Building a House “Declaratively” Declarative is about the WHAT. Building a house declaratively would include the following steps: I don’t care how you build it, but I want a nice fireplace, a lakefront view, and a big kitchen. Simple right? In this declarative program, I have told you the outputs that I want. I know that if I give you inputs in the form of money, I will get the desired outputs. 40 Procedural/structured programming In this course you are learning procedural / structured programming It features close relation to machine architecture. It is based on Von Neumann architecture. It works by changing the program state through assignment statements. It performs step by step task by changing state. The main focus is on how to achieve the goal. In this course, C language is chosen as a tool to learn procedural / structured programming. Why C? Is C language still relevant nowadays? 41 Why c not other programming languages? 1. As a middle-level language, C combines the features of both high-level and low-level languages. It can be used for low-level programming, such as scripting for drivers and kernels and it also supports functions of high-level programming languages, such as scripting for software applications etc. 2. C is a structured programming language which allows a complex program to be broken into simpler programs called functions. It also allows free movement of data across these functions. 3. Various features of C including direct access to machine level hardware APIs, the presence of C compilers, deterministic resource use and dynamic memory allocation make C language an optimum choice for 42 scripting applications and drivers of embedded systems. Why c not other programming languages? 4. C language is case-sensitive which means lowercase and uppercase letters are treated differently. 5. C is highly portable and is used for scripting system applications which form a major part of Windows, UNIX, and Linux operating system. 6. C is a general-purpose programming language and can efficiently work on enterprise applications, games, graphics, and applications requiring calculations, etc. 7. C language has a rich library which provides several built-in functions. It also offers dynamic memory allocation. 8. C implements algorithms and data structures swiftly, facilitating faster computations in programs. This has enabled the use of C in applications requiring higher 43 degrees of calculations like MATLAB and Mathematica. Is c still relevant in 2023? 44 🞂 Need to know Math? ◦ Yes & No, you only need to know the simple arithmetic operation. The analytical skill is more important What does 🞂 The Importance of Design ◦ You need to design a solution for a it take to problem 🞂 Importance of Patience ◦ Programming may be frustrating but become a very rewarding (in term of satisfactory and monetary) programm 🞂 Importance of precision ◦ You need to be able to think er? logically, precisely and in rigorous way! 🞂 Framing Problems Correctly ◦ Become a good problem solver, not a problem creator! 45 Look at the example code After reading it, code 4 ways to it, and run (execute) learn it, and then modify it!! programm Write your own code ing faster ASAP!! Seek out more sources 46 Fill in the blanks in each of the following: a) Computers process data under the control of sequences of instructions called computer ____ b)___ is a type of computer language that uses English like abbreviations for machine language instructions. c) languages are most convenient to the programmer for writing programs quickly and easily. d) The only language a computer can directly understand is that computer’s. e) The programs that translate high-level language programs into machine language are called __ 4 7

Use Quizgecko on...
Browser
Browser