1 / 14

Introduction to Programming

Introduction to Programming. Programming. Process of implementing a solution to a problem in a computer language Writing Testing Debugging Maintaining. Central Processing Unit. MEMORY. 76. Register A. Instr Addr. 1: SET A,10 2: READ B 3: ADD A,B 4: WRITE A …. 1. 30. Register B.

jagger
Download Presentation

Introduction to Programming

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Introduction to Programming

  2. Programming Process of implementing a solution to a problem in a computer language • Writing • Testing • Debugging • Maintaining

  3. Central Processing Unit MEMORY 76 Register A InstrAddr 1: SET A,10 2: READ B 3: ADD A,B 4: WRITE A …. 1 30 Register B CPU The CPU fetches an instruction using the instruction address register, and then executes the that instructions, and then prepares for the next instruction

  4. Instructions • Instructions to a CPU are simple • Must be “executed” by hardware • Encoded as numbers • Math: Add, subtract, compare values • I/O: read, write • Memory: load/store • Execution in hardware = designing a circuit using “logic gates” : AND,OR,NOT and combining them together in a circuit • This is done by Electrical and Computer Engineers

  5. Sequential Execution • Processors execute instructions one-by-one • The instruction address is updated to point to the next instruction • When we write code, we expect one instruction to be followed sequentially by the next • We can choose a different instruction to be next, but to do so, we have to update the instruction register in a special way

  6. State of the Machine • The state of the machine • The contents of the memory and machine registers at a specific point in time • Instructions change the state of the machine • Instructions have a predictable change on the state of the machine • Programming is about finding a sequence of instructions that will change from one state of the machine to a desired state of the machine.

  7. Early Programs • Early programmers wrote in Machine Language • Instructions were manually encoded as numbers Each instruction was dialed in by flipping switches, and connecting input and output of different units. ENIAC (from Wikipedia)

  8. Assembly Language • Assembly Language • A human readable version of machine language • Still writing code directly for the machine Assembly still used for certain critical sections of code where performance matters. Requires years of training andexpertise to be a goodassembly language programmer.

  9. Early Languages • FORTRAN • FORTRAN was an early language (1950’s) A Compiler converts the FORTRAN code into Assembly Language, and theAssembler converts to Machine Language.

  10. Mid-Level Languages • C Language • C is a mid-level language (1970’s) Compiler still translates to machine language – but the compiler does more work than in the older languages – so the source code is a little more readable.

  11. High-Level Languages • SQL is a high-level language • Instructions are interpreted as commands to a database engine – and one instruction in SQL can generate millions of machine language instructions. The problem with high level languages is that they limit what we can do with the machine – if the language doesn’t support it we cannot do it.E.g. cannot display graphics with SQL commands

  12. Object Oriented • Object Oriented Programming (OOP) • A style of programming that organizes code and data together • In languages like C, there is code, and there is data; and they can be treated separately. • Very difficult to maintain as the project grows large • OOP organizes things into classes • classes define the data that are stored there • classes define the operations on the data • objects are instances of a class • This concept helps to quickly organize code and create high quality systems

  13. OOP Languages • C++ is an OOP language

  14. Other Languages LISP Smalltalk C#

More Related