150 likes | 299 Views
Unit 4 . Introduction to Computer Programming. Programming Topics. Concepts & definitions software, program, language types, compiler, IDE, problem solving, debugging Program language elements Executable statements and comments
E N D
Unit 4 Introduction to Computer Programming
Programming Topics • Concepts & definitions • software, program, language types, compiler, IDE, problem solving, debugging • Program language elements • Executable statements and comments • Keywords, variables, functions, procedures, data (literal, variable) • Syntax correctness (like spelling) • Logic correctness (like grammar sequence) • Using a programming language – e.g. Turing • Comments & style (heading section) • Text output & formatting • Numerical output & calculations (operators, BEDMAS) • Variables, constants, assignment, and input statements • Graphic procedures (drawing font) • Loops (repetition) • Decision points (selection) • Interfacing & advanced procedures, processes & functions
What is a Computer Program? • A sequence of instructions written in a computer language, which performs some task.
Types of Programming Languages • High level: Uses human-like commands. Example languages: Basic, Java, C , C++, VB, Fortran, Cobol, Turing • Low Level: more technical assembler languages designed for a specific microprocessor (e.g. Pentium 4, Motorola 68000, Intel 8088, PIC16F627). • Binary: Machine language (1's and 0's) for digital circuits.
The Compiler Program • A compiler (or an interpreter) is a special program that translates from high-level (source code) to low-level (object code) before the program is executed by the CPU. • The object code can be 'run' or executed. SOURCE CODE e.g. put "Hello" OBJECT CODE (executable binary code) 10101000010…. COMPILER or INTERPRETER program
Integrated Development Environment (IDE) • A program used to create, edit, compile, run, and debug (repair) programs in a given language. • The IDE may also include features like colour coding of different keywords help the programmer. • It is the main tool to create source code, compile, and test a program • More advanced IDE’s exist: http://www.indigorose.com/autoplay-media-studio/screenshots-autoplay-media-studio/
Problem Solving Approach • Describe the problem to be solved • Analyze information, break into sub-problems as needed • Define IPO steps (what outputs needed, what inputs & processing needed). Use pseudo code & flow charts to display it • Code into a programming language • Test & debug
Pseudo Code & Flow Charts & Screen Shots • Planning tools for problem solving • Complete before coding your program Pseudo code • Point form solution step-by-step in English (which is also used to document the program with comments) Flow Chart • Diagram to illustrate sequence of different steps Screen Shots • Sketch a sequence of screen displays to the user like a story board
start Input Processing Task If … ? yes no Output Basic Flow Chart Symbols Selection / Decision (if, then, else) Start / End Process Input or Output Flow lines C connector
Screen Shots • Divide a page into 6 boxes • Create a story board of your program’s main screens • Used mainly to decide user interface graphic design and layout
Rubric for Programming • Uses planning tools for problem solving • Follows the problem solving process steps • Completes pseudo code & flow charts • Uses good programming style • documentation heading section, comments, good variable names, etc • Program Coding • Program runs ( no syntax errors) • Program provides the solution to the problem • Efficient use of language ( e.g. minimum lines of code)
Can you answer these questions? • What is a computer program? • Define high-level programming languages? • What is a compiler? • What is an IDE? • What are the general problem solving steps? • Use pseudo code and flow charts to solve a given problem • Show that you can create and analyze Turing programs
Interfacing • Interfacing is the hardware and/or software required to connect 2 different analog or digital systems. Digital Computer Interface Analog System (A/V, motion, sensors, etc)
Why interfacing • Changes may be needed between different parts of a system • Possible reasons include: • Different voltage, current requirements • Analog versus digital • Different protocols • Common PC interfaces: • USB, Serial/Parallel Port, Internal buses, etc.
Parallel Port Interface Example Vcc Device Npn Transistor 0 v