 Getting ready to code Lecture 1 Match 4, 2013. Course syllabus 

Slides:



Advertisements
Similar presentations
CS101: COMPUTER PROGRAMMING Lecture 1: Introduction to Computer and Programming.
Advertisements

Dr. Ken Hoganson, © August 2014 Programming in R COURSE NOTES 2 Hoganson Language Translation.
ICS103 Programming in C Lecture 1: Overview of Computers & Programming
Lecture 1: Overview of Computers & Programming
Copyright © 2002 W. A. Tucker1 Chapter 1 Lecture Notes Bill Tucker Austin Community College COSC 1315.
B-1 Lecture 2: Problems, Algorithms, and Programs © 2000 UW CSE University of Washington Computer Programming I.
1 Lecture 1  Getting ready to program  Hardware Model  Software Model  Programming Languages  The C Language  Software Engineering  Programming.
Chapter 1 Introduction to C Programming. 1.1 INTRODUCTION This book is about problem solving with the use of computers and the C programming language.
1 ICS103 Programming in C Lecture 2: Introduction to C (1)
C++ Programming: From Problem Analysis to Program Design, Third Edition Chapter 1: An Overview of Computers and Programming Languages C++ Programming:
Copyright © 2001 by Wiley. All rights reserved. Chapter 1: Introduction to Programming and Visual Basic Computer Operations What is Programming? OOED Programming.
CHAPTER 1: Programming Fundamentals CSEB113 PRINCIPLES of PROGRAMMING by Badariah Solemon 1BS (May 2013)
CHAPTER 1: INTORDUCTION TO C LANGUAGE
 2000 Prentice Hall, Inc. All rights reserved. 1 Introduction to Computers and C Programming Outline Introduction What Is a Computer? Computer Organization.
Principles of Programming Chapter 1: Introduction  In this chapter you will learn about:  Overview of Computer Component  Overview of Programming 
Principles of Programming - NI July Chapter 1: Introduction In this chapter you will learn about: Overview of PC components The different types.
PROGRAMMING LANGUAGES The Study of Programming Languages.
“C” Programming Language What is language ? Language is medium of communication. If two persons want to communicate with each other, they have to use.
 2008 Pearson Education, Inc. All rights reserved Introduction to Computers, the Internet and World Wide Web.
© Janice Regan, CMPT 128, Jan CMPT 128 Introduction to Computing Science for Engineering Students Creating a program.
COMPUTER SOFTWARE Section 2 “System Software: Computer System Management ” CHAPTER 4 Lecture-6/ T. Nouf Almujally 1.
Learning Objectives Data and Information Six Basic Operations Computer Operations Programs and Programming What is Programming? Types of Languages Levels.
CHAPTER 1 Overview of Programming and Problem Solving.
Evolution of Programming Languages Generations of PLs.
Computer Programming A program is a set of instructions a computer follows in order to perform a task. solve a problem Collectively, these instructions.
C++ Programming Language Lecture 1 Introduction By Ghada Al-Mashaqbeh The Hashemite University Computer Engineering Department.
Programming With C.
King Saud University College of applied studies and community services CSC 1101 Computer Programming I Lecture 2.
Robert Crawford, MBA West Middle School.  Explain how the binary system is used by computers.  Describe how software is written and translated  Summarize.
C++ Programming: From Problem Analysis to Program Design, Third Edition Chapter 1: An Overview of Computers and Programming Languages.
INTRODUCTION TO COMPUTING CHAPTER NO. 04. Programming Languages Program Algorithms and Pseudo Code Properties and Advantages of Algorithms Flowchart (Symbols.
CSEB114: Principle of Programming Chapter 1: Introduction to Computer and Programming.
Basic of Programming Language Skill Area Computer System Computer Program Programming Language Programmer Translators.
CHAPTER 1 INTRODUCTION 1 st Semester H King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1.
Chapter One An Introduction to Programming and Visual Basic.
Programming in C++ Dale/Weems/Headington Chapter 1 Overview of Programming and Problem Solving.
Chapter 1 Computers, Compilers, & Unix. Overview u Computer hardware u Unix u Computer Languages u Compilers.
Programming Fundamentals Lecture No. 2. Course Objectives Objectives of this course are three fold 1. To appreciate the need for a programming language.
CHAPTER 1: Introduction to Computers and Programming CSEB113 PRINCIPLES of PROGRAMMING CSEB134 PROGRAMMING I by Badariah Solemon 1BS (May 2012)
Principles of Programming Chapter 1: Introduction  In this chapter you will learn about:  Overview of Computer Component  Overview of Programming 
The Instruction Set Architecture. Hardware – Software boundary Java Program C Program Ada Program Compiler Instruction Set Architecture Microcode Hardware.
Getting ready. Why C? Design Features – Efficiency (C programs tend to be compact and to run quickly.) – Portability (C programs written on one system.
Chapter 11  Getting ready to program  Hardware Model  Software Model  Programming Languages  Facts about C++  Program Development Process  The Hello-world.
An overview of C Language. Overview of C C language is a general purpose and structured programming language developed by 'Dennis Ritchie' at AT &T's.
ITP 109 Week 2 Trina Gregory Introduction to Java.
Lecture #1: Introduction to Algorithms and Problem Solving Dr. Hmood Al-Dossari King Saud University Department of Computer Science 6 February 2012.
1 Types of Programming Language (1) Three types of programming languages 1.Machine languages Strings of numbers giving machine specific instructions Example:
CSC141 Introduction to Computer Programming Programming Language.
Introduction to Computer Programming Concepts M. Uyguroğlu R. Uyguroğlu.
Chapter 1 slides1 What is C? A high-level language that is extremely useful for engineering computations. A computer language that has endured for almost.
Some of the utilities associated with the development of programs. These program development tools allow users to write and construct programs that the.
Software Engineering Algorithms, Compilers, & Lifecycle.
CSCI-235 Micro-Computer Applications
C Programming Hardik H. Maheta.
Instructor: Chien-Ho Ko
Microprocessor and Assembly Language
ICS103 Programming in C Lecture 1: Overview of Computers & Programming
Chapter 1: An Overview of Computers and Programming Languages
CHAPTER 1: Introduction to Computers and Programming
Introduction to C Programming Language
C++ Programming: From Problem Analysis to Program Design
Choice of Programming Language
TRANSLATORS AND IDEs Key Revision Points.
Translators & Facilities of Languages
Computer Science I CSC 135.
Computers: Hardware and Software
(Course Introduction)
Chapter One: An Introduction to Programming and Visual Basic
Introduction to Computer Programming
PROGRAMMING FUNDAMENTALS Lecture # 03. Programming Language A Programming language used to write computer programs. Its mean of communication between.
Presentation transcript:

 Getting ready to code Lecture 1 Match 4, 2013

Course syllabus 

Why study programming?   Autonomous vehicle project     Brain analysis through eye blink detection    Mobile robot control 

Example Face and eyes detection program

Continuation

Demonstration  Face recognition program

What is Programming?  Programming is instructing a computer to do something for you with the help of a programming language  The two roles of a programming language:  Technical: It instructs the computer to perform tasks.  Conceptual: It is a framework within which we organize our ideas about things and processes.  In programming, we deal with two kind of things:  Data - representing 'objects' we want to manipulate  Procedures -'descriptions' or 'rules' that define how to manipulate data. 7

Programming Language  Formal Language used to communicate to a computer.  A programming language contains instructions for the computer to perform a specific action or a specific task:  'Calculate the sum of the numbers from 1 to 10‘  'Print “I like programming”‘  'Output the current time' 8

Programming Language  Can be classified into as a  special-purpose and  general-purpose programming languages.  Special-purpose : is design for a particular type of application  Structured Query Language (SQL)  General-purpose : can be used to obtain solutions for many types of problems 1. Machine Languages 2. Assembly Languages 3. High-Level Languages 9

Machine Language  The only language that the processor actually 'understands‘  Consists of binary codes: 0 and 1  Example:  Each of the lines above corresponds to a specific task to be done by the processor. 10

Machine Language Programming in machine code is difficult and slow since it is difficult to memorize all the instructions. Mistakes can happen very easily. Processor and Architecture dependent Simple add numbers program 1.Copy the number in memory location 2000 to register 1. 2.Copy the number in memory location 2004 to register 2. 3.Add the contents of register 2 to the contents of register 1, leaving the answer in register 1. 4.Copy the contents of register 1 to memory location Register is a small amount of storage available as part of a CPU. Machine language Machine instructions are written in hexadecimal system

Assembly Language  Enables machine code to be represented in words and numbers.  Example of a program in assembler language:  Easier to understand and memorize (called Mnemonics), compared to machine code but still quite difficult to use.  Processor and Architecture dependent 12 LOAD A, 9999 LOAD B, 8282 ADD B MOV C, A LOAD C, #0002 DIV A, C STORE A, 7002

High-level Computer Languages  Use more English words. They try to resemble English sentences. Therefore, it is easier to program in these languages.  The programming structure is problem oriented - does not need to know how the computer actually executes the instructions.  Processor independent - the same code can be run on different processors.  Examples: Basic, Fortran, Pascal, Cobol, C, C++, Java  A high level language needs to be analyzed by the compiler and then compiled into machine code so that it can be executed by the processor. 13

High-level Computer Languages  High-level computer languages simplify our programming life in several ways. First, you don't have to express your instructions in a numeric code.  To add two numbers, for example, you might write the following: total = mine + yours; The compiler is a program that translates the high-level language program into the detailed set of machine language instructions the computer requires.

Why C? Design Features – Efficiency (C programs tend to be compact and to run quickly.) – Portability (C programs written on one system can be run on other systems with little or no modification.) – Power and Flexibility (OS and programing languages are written in C.) – Programmer Oriented (It gives you access to hardware, and it enables you to manipulate individual bits in memory) – Shortcomings ( you can make programming errors that are very difficult to trace )

Why C?  If you want a job writing software, one of the first questions you should be able to answer yes to is "Oh say, can you C?”  C languages programs are always in demand. company/senior-quantitative-programmer-c- c?utm_source=Indeed&utm_medium=organic&utm_campaign =Indeed

Where C is applied?

History of C Language Why it is named 'C' ?  Because based on ' B '; developed at B ell Laboratories  Developed by Dennis Ritchie at Bell Laboratories in the 1960s  In cooperation with Ken Thomson it was used for Unix systems  The C Language was only vaguely defined, not standardized, so that almost everyone had his own perception of it, to such an extend that an urgent need for a standard code was creeping up  In 1983, the American National Standards Institute (ANSI) set up X3J11, a Technical Committee to draft a proposal for the ANSI standard, which was approved in 1989 and referred to as the ANSI/ISO 9899 : 1990 or simply the ANSI C, which is now the global standard for C. 18

19 History of C Language

C – An Imperative Language #include int main(void) { printf(”Hello world.\n"); return 0; } 20  C is a highly imperative language  We must tell it exactly how to do what;  the means and functions to use;  which libraries to use;  when to add a new line;  when an instruction is finished;  in short: everything and anything… A simple program

Programming Mechanics  When you write a program in the C language, you store what you write in a text file called a source code file.  Most C systems (MS Windows, Linux, Mac, ) require that the name of the file end in.c (for example, wordcount.c and budget.c). The hello.c Program #include int main(void) { printf(”Hello world.\n"); return 0; } st an d ard Library, i nput- o utput, h eader-file Begin of program Function for printing text End of statement Insert a new line End of Segment 21

Overview of a C program 22

Object Code Files, Executable Files, and Libraries 1.The compiler converts your source code to an intermediate code (object code file), and the linker combines this with other code to produce the executable file. 2.The object file contains machine language code, it is not ready to run; 3.The first element missing from the object code file is something called startup code; 4.The second missing element is the code for library routines 5.The role of the linker is to bring together these three elements—your object code, the standard startup code for your system, and the library code—and put them together into a single file, the executable file. 23

Process of compiling and running a C program 24

Using C: Seven Steps 1. Define the program objectives; 2. Design the program; 3. Write the code; 4. Compile; 5. Run the program; 6. Test and debug the program; 7. Maintain and modify the program. 25

Define the program objectives  Start with a clear idea of what you want the program to do;  Think in terms of the information your program needs;  And the information the program should report back to you;  Think in general terms, not in terms of some specific computer language. 26

Design the program  What should the user interface be like?  How should the program be organized?  Who will the target user be?  How much time do you have to complete the program?  Think in general terms, not about specific code. 27

Write the Code Now that you have a clear design for your program, you can begin to implement it by writing the code. #include int main(void) { int dogs; printf("How many dogs do you have?\n"); scanf("%d", &dogs); printf("So you have %d dog(s)!\n", dogs); return 0; } 28

Compile  The compiler is a program whose job is to convert source code into executable code ;  Executable code is code in the native language, or machine language, of your computer;  C compilers also incorporate code from C libraries into the final program; the libraries contain a fund of standard routines, such as printf() and scanf(), for your use. (More accurately, a program called a linker) 29

Run the Program  The executable file is a program you can run. 30

Test and Debug the Program  The fact that your program runs is a good sign, but it's possible that it could run incorrectly;  Some of your programs have mistakes—bugs;  Debugging is the process of finding and fixing program errors;  The compiler catches many kinds of errors, and there are things you can do to help yourself track down the ones that the compiler doesn't catch. 31

Maintain and modify the program  You could add a clever new feature.  You might adapt the program so that it runs on a different computer system.  All these tasks are greatly simplified if you document the program clearly and if you follow sound design practices. 32

Questions?