Download Lecture-1

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Abstraction (computer science) wikipedia , lookup

C Sharp (programming language) wikipedia , lookup

Computer cluster wikipedia , lookup

Interpreter (computing) wikipedia , lookup

Compiler wikipedia , lookup

History of compiler construction wikipedia , lookup

Software bug wikipedia , lookup

Transcript
Programming Fundamental
Instructor Name:
Lecture-1
Today’s Lecture
 Course Pre-requisite (Background)
 Introduction to computer & Computer Software
 Computer Environments
 Different Programming Languages (Overview)
 C++ - Introduction
 Problem Analysis & Solution Design
2
Course Prerequisite (Background & Objectives)
 Students with little or No prior programming experience
 Understand computational approach to problem solving
 have Good mathematical Skills
 Course Objective:
 aims to provide students problem solving skills
 Enable students to analyze problem and write solutions in C++
3
Introduction to Computer
What is Computer:
 A device that takes the data as input , process it and then return the result
as an information(output).
Input
(Data)
Data Processing
Output
 Any calculating device that automate the work.
 A computer is a general purpose device that can be programmed to carry
out a set of arithmetic or logical operations automatically.
4
Introduction to Computer
Components of Computer:
 Computer system made up of two major components
Computer System
Hard ware
Software
5
Introduction to Computer
Hardware
 Computer hardware is the collection of physical elements that constitutes a
computer system.
 In simple all visible and touchable parts of computer
6
Introduction to Computer
Software:
 Software is a program that enables a computer to perform a specific task, as
opposed to the physical components of the system (hardware).
 Computer software, or simply software is any set of machine-readable
instructions that directs a computer's processor to perform specific
operations.
7
Introduction to Computer
H/W& S/W Relationship
 Nothing useful can be done with the hardware on its own & software can’t
be utilized without hardware
 Both hardware and Software are Complimentary to each other
8
Computer Software
Software Categories
9
Computer Software
System Software
 Operating system is a program that manages interactions between:




users and hardware;
users and software;
hardware and software;
... and so much more.
 Device Drivers are Software use to communicate between the devices and
computers.
 Utility Software Perform a very specific task, usually related to managing
system resources e.g. utility compression, defragmentaion
Computer Software
Application Software:
 Application software is a set of one or more programs designed to carry out
operations for a specific application. Application software cannot run on itself
but is dependent on system software to execute.
11
Computer Environment
Personal Computer
12
Computer Environment
Time Sharing Environment
13
Computer Environment
Client/Server Environment
14
Computer Languages
15
Computer Languages
Machine Languages
 Machine code or machine language is a set of instructions executed directly by
a computer's Central Processing Unit (CPU).
 While easily understood by computers, machine languages are almost
impossible for humans to use because they consist entirely of numbers.
16
Computer Languages
Assembly Language
 Low level Language and just one level higher than machine language
 Works directly with microprocessor
 Embedded Systems depends on Assembly language
17
Computer Languages
High Level languages
 language with strong abstraction from the details of the computer
 may use natural language elements
 Easier to use
 making the process of developing a program simpler and more
understandable
 programs written in a high-level language must be translated into
machine language by a compiler or interpreter.
18
C++ - Introduction
19
C++ - Introduction
History of C++
 The C language was developed in late 60’s and early 70’s, in Bell
Laboratories.
 Before this B and BCPL language were invented to write the Operating
system.
 Dennis Ritchie developed a general purpose language, called C
language, by using different features of BCPL and B languages.
20
C++ - Introduction
21
C++ - Introduction
What is IDE?
 An integrated development environment (IDE) or interactive development
environment is a software application that provides comprehensive
facilities to computer programmers for software development.
 Program is created in Editor and stored on Disk.
 C++ program is stored with extension “.cpp”
22
C++ - Introduction
What is Preprocessor?
 The preprocessors are the directives, which give instruction to the
compiler to preprocess the information before actual compilation starts
 All preprocessor directives begin with #, and only white-space characters
may appear before a preprocessor directive on a line. Preprocessor
directives are not C++ statements, so they do not end in a semicolon (;).
 For example
 #include <iostream>
 #define PI 3.14159
23
C++ - Introduction
What is Compiler?
 A compiler is a computer program that processes statements written in a
particular programming language (source code) and turns them into
machine language (object code) that a computer processor uses.
24
C++ - Introduction
Compiler vs. Interpreter
Compiler
Interpreter
Takes Entire program as input
Takes Single instruction as input
Intermediate Object Code is Generated
No Intermediate Object Code is
Generated
Program need not be compiled every
time
Program is translated every time
Errors displayed after compilation
Errors displayed for every instruction
interpreted (if any)
25
C++ - Introduction
What is Linker?
 a program used with a compiler or assembler to provide links to the
libraries needed for an executable program.
 a program that takes one or more object files generated by a compiler and
combines them into a single executable file, library file, or another object
file.
26
C++ - Introduction
What is Loader?
 a loader is the part of an operating system that is responsible for loading
programs and libraries.
 A loader loads the programs into the main memory from the storage
device.
27
C++ - Introduction
What is Debugger?
 a computer program that assists in the detection and correction of errors in
computer programs.
 used to correct the logical errors
 control our program while it is running
 stop the execution of program at some point and can check the values
in different variables, can change these values etc.
NOTE: VARIABLES WILL BE DISCUSSED IN NEXT LECTURE
28
Problem Analysis & Solution Design
 Good Problem Analysis produce effective Solution
 Following are the keys to write good program
 Paying attention to detail
 Think about reusability
 Think about user interface
 Think computer is a dump machine
 Comment code library.
29
Problem Analysis & Solution Design
Paying attention to detail
 Always analyzes the problem statement very carefully and in detail
 Don’t conclude result by considering one aspect only
 Pay attention to all the aspects of the problem
 Pay attention to the calculations involved in the program
 Think about the flow of information provided
 Think Logically about the programstatement
30
Problem Analysis & Solution Design
Think about reusability
 always keep in mind that it could be reused at some other time to solve
same kind problem
Think about Interface
 provide an easy to understand and easy to use interface that is self
explanatory.
31
Problem Analysis & Solution Design
Think computer as dump
 Computers are incredibly stupid. They do exactly what you tell them to
do: no more,
 no less-- unlike human beings. Computers can't think by
themselves.
Comment code library





Always comment the code liberally
Comment statements do not affect the performance of the program
Comments are not compiled by the compiler
No Memory is used
Comments are used to explain the functionality of certain piece of
code
 Helps other programmers and yourself for understand code at later
stages
32
33