SlideShare a Scribd company logo
1 of 54
Chapter 1
An Overview of Computers and
Programming Languages
© Janice Regan 2003
Chapter Objectives
Learn about different types of computers
Explore the hardware and software
components of a computer system
Learn about the language of a computer
Learn about the evolution of programming
languages
Examine high-level programming languages
© Janice Regan 2003
Chapter Objectives
Discover what a compiler is and what it does
Examine how a Java program is processed
Learn what an algorithm is and explore
problem-solving techniques
Become aware of structured and object-
oriented programming design methodologies
© Janice Regan 2003
Introduction
Computers have greatly effected our daily
lives – helping us complete many tasks
Computer programs (software) are designed
specifically for each task
Software is created with programming
languages
Java is an example of a programming language
© Janice Regan 2003
An Overview of the History of
Computers
1950s: Very large devices available to a select
few
1960s: Large corporations owned computers
1970s: Computers get smaller and cheaper
1990s: Computers get cheaper and faster and
are found in most homes
© Janice Regan 2003
Elements of a Computer System
A computer has 2 components
 Hardware
 Software
© Janice Regan 2003
Hardware Components of a
Computer
Central Processing Unit (CPU)
Main Memory
© Janice Regan 2003
Hardware Components of a
Computer
© Janice Regan 2003
Main Memory
Ordered sequence of cells (memory cells)
Directly connected to CPU
All programs must be brought into main
memory before execution
When power is turned off, everything in main
memory is lost
© Janice Regan 2003
Main Memory with 100 Storage
Cells
© Janice Regan 2003
Secondary Storage
Provides permanent storage for information
Examples of secondary storage:
 Hard Disks
 Floppy Disks
 ZIP Disks
 CD-ROMs
 Tapes
© Janice Regan 2003
Input Devices
Definition: devices that feed data and
computer programs into computers
Examples:
 Keyboard
 Mouse
 Secondary Storage
© Janice Regan 2003
Output Devices
Definition: devices that the computer uses to
display results
Examples:
 Printer
 Monitor
 Secondary Storage
© Janice Regan 2003
Software
Software consists of programs written to
perform specific tasks
Two types of programs
 System Programs
 Application Programs
© Janice Regan 2003
System Programs
System programs control the computer
The operating system is first to load when you
turn on a computer
© Janice Regan 2003
Operating System (OS)
OS monitors overall activity of the computer
and provides services
Example services:
 memory management
 input/output
 activities
 storage management
© Janice Regan 2003
Application Programs
Written using programming languages
Perform a specific task
Run by the OS
Example programs:
 Word Processors
 Spreadsheets
 Games
© Janice Regan 2003
Language of a Computer
Machine language: the most basic language of
a computer
A sequence of 0s and 1s
Every computer directly understands its own
machine language
A bit is a binary digit, 0 or 1
A byte is a sequence of eight bits
© Janice Regan 2003
Evolution of Programming
Languages
Early computers programmed in machine
language
Assembly languages were developed to make
programmer’s job easier
In assembly language, an instruction is an
easy-to-remember form called a mnemonic
Assembler: translates assembly language
instructions into machine language
© Janice Regan 2003
Instructions in Assembly and
Machine Language
© Janice Regan 2003
Evolution of Programming
Languages
High-level languages make programming
easier
Closer to spoken languages
Examples:
 Basic
 FORTRAN
 COBOL
 C/C++
 Java
© Janice Regan 2003
Evolution of Programming
Languages
 To run a Java program:
1. Java instructions need to be translated into an
intermediate language called bytecode
2. Then the bytecode is interpreted into a particular
machine language
© Janice Regan 2003
Evolution of Programming
Languages
 Compiler: A program that translates a program
written in a high-level language into the
equivalent machine language. (In the case of
Java, this machine language is the bytecode.)
 Java Virtual Machine (JVM) - hypothetical
computer developed to make Java programs
machine independent
© Janice Regan 2003
Processing a Java Program
 Two types of Java programs: applications and applets
 Source program: Written in a high-level language
 Linker: Combines bytecode with other programs provided by
the SDK and creates executable code
 Loader: transfers executable code into main memory
 Interpreter: reads and translates each bytecode instruction
into machine language and then executes it
© Janice Regan 2003
Processing a Java Program
© Janice Regan 2003
Problem-Solving Process
1. State the Problem
2. Analyze the problem: outline solution requirements
and design an algorithm
3. Design an algorithm to solve the problem
4. Implement the algorithm in a programming
language (Java) and verify that the algorithm works
5. Maintain the program: use and modify if the
problem domain changes
© Janice Regan 2003
Problem-Analysis-Coding-
Execution Cycle
Algorithm: A step-by-step problem-solving
process in which a solution is arrived at in a
finite amount of time
© Janice Regan 2003
Algorithms
Definition of an Algorithm?
What makes a good algorithm?
Example
© Janice Regan 2003
Definition
An algorithm is
 Any set of instructions that specifies a series
of steps to correctly solve the problem
There may be many different algorithms
to solve a given problem
Some algorithms may be more efficient
than others
© Janice Regan 2003
Algorithms and Programs
 An algorithm is a finite set of instructions that
explains the required solution step-by-step
 A computer can be instructed to implement many
algorithms with a finite number of steps or
instructions
 A program is a set of computer instructions that
implements an algorithm
© Janice Regan 2003
Why Should I Write Algorithms?
A computer program solves a scientific
programming problem with a computer
 a simulation problem, a data analysis
application, a control system, etc.
To write a computer program you need to
know the series of steps your are
implementing to solve your problem, You
need to know your algorithm!
© Janice Regan 2003
Important
 The sequence or order of the steps is usually of
critical importance in writing a correct algorithm
 You must be exact when specifying an algorithm that
is to be translated into a computer program
 What is the difference between A*B+C and
(A*B)+C? Be careful, the computer will do exactly
what you ask, even it is not what you really want it to
do!!
© Janice Regan 2003
Problem Solving Methodology and
Algorithms
 Problem Specification: State the problem clearly
 Analysis: Input, Output, How to go from input to
output
 Design: Develop a step by step method
 Test Plan: How do you test to determine your
algorithm works
 Implementation or coding
 Testing
 Refinement
© Janice Regan 2003
Problem Specification I
Any problem solving process consists
of
Input  Algorithm  Output
Determine what information is
available as input to your algorithm
Determine what information is desired
as output from your algorithm
© Janice Regan 2003
Specification and Analysis
What needs to be done to the input to
determine the output?
 Determine a series of steps that will transform
the input data into the output results
 Then enumerate all the special cases that the
must be handled
 If necessary modify or redesign your series of
steps to handle all special cases
© Janice Regan 2003
Verifying Algorithms
You written your algorithm, is it ready to be
translated into a program?
 Verify that it gives the desired results.
 Verify that all special cases are handled
 Verify that the algorithm ends after the outputs are
determined
You have a series of items to verify, you also have
made a good start on determining what tests need
to be included in your test plan.
© Janice Regan 2003
Summary: Writing Algorithms?
 You will succeed in writing algorithms if you
 First think about the problem, its input data and
required results (output)
 Next determine a series of steps that will transform the
input data into the output results
 Then enumerate all the special cases that the must be
handled
 If necessary modify or redesign your series of steps so
that all special cases are handled
 Verify your algorithm
© Janice Regan 2003
Example: Problem Specification
You are spending the weekend with a group of
friends. Your contribution to making breakfast
is making the coffee. The friend in charge of
grocery shopping has told you the coffee is in
the freezer.
© Janice Regan 2003
Example: Analysis and Design
You see a coffee maker on the kitchen counter
with a box of coffee filters.
You might decide to subdivide the problem of
making the coffee into the following steps
© Janice Regan 2003
Example: Algorithm
1. Take the coffee out of the freezer
2. Put the coffee in a filter
3. Put the filter in the coffee maker
4. Put water in the coffee maker
5. Turn on the coffee maker
6. Put the rest of the coffee back in the freezer
© Janice Regan 2003
Example: refinement I
 You look for the coffee in the freezer and
you find whole coffee beans. You know
that you need ground coffee beans to
make coffee.
 Refinement of step 2
a) Find the coffee grinder
b) Put the coffee beans into the grinder
c) Grind the coffee beans
d) Put the ground coffee in the filter
© Janice Regan 2003
Example: refinement II
 You need to decide when the coffee is
properly ground
 Refinement of step 2c
c) Grind the coffee beans
i. Stop grinding
ii. Check to see if the coffee beans are properly
ground
iii. Continue grinding if they are not
iv. Repeat until the coffee is properly ground
© Janice Regan 2003
Example: refinement III
 What if you use the last of the coffee
and have none left to put back in the
freezer?
 Refinement of step 6
6. If there are any coffee beans left put
them back in the freezer
© Janice Regan 2003
Example: refined algorithm I
1. Take the coffee out of the freezer
2. Put coffee in a filter
a) Find the coffee grinder
b) Put the coffee beans into the grinder
c) Grind the coffee beans
i. Stop grinding
ii. Check to see if the coffee beans are properly
ground
iii. Continue grinding if they are not
iv. Repeat until the coffee is properly ground
d) Put the ground coffee in the filter
© Janice Regan 2003
Example: refined algorithm II
3. Put the filter in the coffee maker
4. Put water in the coffee machine
5. Turn on the coffee machine
6. If there are any coffee beans left put the
rest of the coffee back in the freezer
© Janice Regan 2003
Choices
There may be several algorithms to solve a
given problem
 Which algorithm is the best?
 How do we chose?
© Janice Regan 2003
Properties of Good Algorithms
 Efficiency
 Simplicity
 Precision
 Effectiveness
 Generality
 Levels of Abstraction
 Correctness
 Finiteness
 Maintainability
© Janice Regan 2003
Class discussion
Algorithm for solving a quadratic equation
© Janice Regan 2003
Problem-Analysis-Coding-
Execution Cycle
© Janice Regan 2003
Programming Methodologies
Two basic approaches to programming design:
 Structured design
 Object-oriented design
© Janice Regan 2003
Structured Design
1. A problem is divided into smaller
subproblems
2. Each subproblem is solved
3. The solutions of all subproblems are then
combined to solve the problem
© Janice Regan 2003
Object-Oriented Design (OOD)
 In OOD, a program is a collection of
interacting objects
 An object consists of data and operations
 Steps in OOD:
1. Identify objects
2. Form the basis of the solution
3. Determine how these objects interact
© Janice Regan 2003
Chapter Summary
 A computer system is made up of hardware and
software components
 Computers understand machine language; it is easiest
for programmers to write in high-level languages
 A compiler translates high-level language into
machine language
 High-level language steps to execute a program: edit,
compile, link, load, and execute
© Janice Regan 2003
Chapter Summary
Algorithm: step-by-step problem-solving
process in which a solution is arrived at in a
finite amount of time
Three steps to problem solving: analyze the
problem and design an algorithm, implement the
algorithm in a programming language, and
maintain the program
Two basic approaches to programming design:
structured and object-oriented

More Related Content

Similar to Computer and programming language

L1. Basic Programming Concepts.pdf
L1. Basic Programming Concepts.pdfL1. Basic Programming Concepts.pdf
L1. Basic Programming Concepts.pdfMMRF2
 
C programming for Computing Techniques
C programming for Computing TechniquesC programming for Computing Techniques
C programming for Computing TechniquesAppili Vamsi Krishna
 
Programming requirements for beginning in software engineering.pptx
Programming requirements for beginning in software engineering.pptxProgramming requirements for beginning in software engineering.pptx
Programming requirements for beginning in software engineering.pptxTeddyDaka
 
Software Design
Software DesignSoftware Design
Software DesignSpy Seat
 
An overview of computers and programming languages
An overview of computers and programming languages An overview of computers and programming languages
An overview of computers and programming languages Ahmad Idrees
 
Fundamentals of programming with C++
Fundamentals of programming with C++Fundamentals of programming with C++
Fundamentals of programming with C++Seble Nigussie
 
Chapter 2(1)
Chapter 2(1)Chapter 2(1)
Chapter 2(1)TejaswiB4
 
Software development slides
Software development slidesSoftware development slides
Software development slidesiarthur
 
Computer and programing basics.pptx
Computer and programing basics.pptxComputer and programing basics.pptx
Computer and programing basics.pptxgaafergoda
 
Logic Formulation 1
Logic Formulation 1Logic Formulation 1
Logic Formulation 1deathful
 
LKGtoPG - Basics of C Language
LKGtoPG - Basics of  C LanguageLKGtoPG - Basics of  C Language
LKGtoPG - Basics of C Languagelkgtopg jobs
 
Introduction to Computer Programming
Introduction to Computer ProgrammingIntroduction to Computer Programming
Introduction to Computer ProgrammingProf. Erwin Globio
 

Similar to Computer and programming language (20)

01CHAP_1.PPT
01CHAP_1.PPT01CHAP_1.PPT
01CHAP_1.PPT
 
L1. Basic Programming Concepts.pdf
L1. Basic Programming Concepts.pdfL1. Basic Programming Concepts.pdf
L1. Basic Programming Concepts.pdf
 
6272 cnote
6272 cnote6272 cnote
6272 cnote
 
C progrmming
C progrmmingC progrmming
C progrmming
 
Slide 01
Slide 01Slide 01
Slide 01
 
C programming for Computing Techniques
C programming for Computing TechniquesC programming for Computing Techniques
C programming for Computing Techniques
 
Programming requirements for beginning in software engineering.pptx
Programming requirements for beginning in software engineering.pptxProgramming requirements for beginning in software engineering.pptx
Programming requirements for beginning in software engineering.pptx
 
Software Design
Software DesignSoftware Design
Software Design
 
An overview of computers and programming languages
An overview of computers and programming languages An overview of computers and programming languages
An overview of computers and programming languages
 
Fundamentals of programming with C++
Fundamentals of programming with C++Fundamentals of programming with C++
Fundamentals of programming with C++
 
Chapter 2(1)
Chapter 2(1)Chapter 2(1)
Chapter 2(1)
 
01 Programming Fundamentals.pptx
01 Programming Fundamentals.pptx01 Programming Fundamentals.pptx
01 Programming Fundamentals.pptx
 
PPS Unit-1.pdf
PPS Unit-1.pdfPPS Unit-1.pdf
PPS Unit-1.pdf
 
Software development slides
Software development slidesSoftware development slides
Software development slides
 
Computer and programing basics.pptx
Computer and programing basics.pptxComputer and programing basics.pptx
Computer and programing basics.pptx
 
Logic Formulation 1
Logic Formulation 1Logic Formulation 1
Logic Formulation 1
 
Chapter 1 - Prog101.ppt
Chapter 1 - Prog101.pptChapter 1 - Prog101.ppt
Chapter 1 - Prog101.ppt
 
LKGtoPG - Basics of C Language
LKGtoPG - Basics of  C LanguageLKGtoPG - Basics of  C Language
LKGtoPG - Basics of C Language
 
Introduction to Computer Programming
Introduction to Computer ProgrammingIntroduction to Computer Programming
Introduction to Computer Programming
 
Algorithm.pdf
Algorithm.pdfAlgorithm.pdf
Algorithm.pdf
 

More from Xad Kuain

avl insertion-rotation
avl insertion-rotationavl insertion-rotation
avl insertion-rotationXad Kuain
 
History evaluation
History evaluationHistory evaluation
History evaluationXad Kuain
 
How to build a lamp server-sample
How to build a lamp server-sampleHow to build a lamp server-sample
How to build a lamp server-sampleXad Kuain
 
Oracle 11g Database Administration
Oracle 11g Database Administration Oracle 11g Database Administration
Oracle 11g Database Administration Xad Kuain
 
Computer Graphics & linear Algebra
Computer Graphics & linear Algebra Computer Graphics & linear Algebra
Computer Graphics & linear Algebra Xad Kuain
 
Quality assurance by Sadquain
Quality assurance by Sadquain Quality assurance by Sadquain
Quality assurance by Sadquain Xad Kuain
 
C programming
C programmingC programming
C programmingXad Kuain
 

More from Xad Kuain (8)

Avl trees
Avl treesAvl trees
Avl trees
 
avl insertion-rotation
avl insertion-rotationavl insertion-rotation
avl insertion-rotation
 
History evaluation
History evaluationHistory evaluation
History evaluation
 
How to build a lamp server-sample
How to build a lamp server-sampleHow to build a lamp server-sample
How to build a lamp server-sample
 
Oracle 11g Database Administration
Oracle 11g Database Administration Oracle 11g Database Administration
Oracle 11g Database Administration
 
Computer Graphics & linear Algebra
Computer Graphics & linear Algebra Computer Graphics & linear Algebra
Computer Graphics & linear Algebra
 
Quality assurance by Sadquain
Quality assurance by Sadquain Quality assurance by Sadquain
Quality assurance by Sadquain
 
C programming
C programmingC programming
C programming
 

Recently uploaded

chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptkotipi9215
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio, Inc.
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxTier1 app
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number SystemsJheuzeDellosa
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - InfographicHr365.us smith
 
cybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningcybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningVitsRangannavar
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfPower Karaoke
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 

Recently uploaded (20)

chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.ppt
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number Systems
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - Infographic
 
cybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningcybersecurity notes for mca students for learning
cybersecurity notes for mca students for learning
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdf
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 

Computer and programming language

  • 1. Chapter 1 An Overview of Computers and Programming Languages
  • 2. © Janice Regan 2003 Chapter Objectives Learn about different types of computers Explore the hardware and software components of a computer system Learn about the language of a computer Learn about the evolution of programming languages Examine high-level programming languages
  • 3. © Janice Regan 2003 Chapter Objectives Discover what a compiler is and what it does Examine how a Java program is processed Learn what an algorithm is and explore problem-solving techniques Become aware of structured and object- oriented programming design methodologies
  • 4. © Janice Regan 2003 Introduction Computers have greatly effected our daily lives – helping us complete many tasks Computer programs (software) are designed specifically for each task Software is created with programming languages Java is an example of a programming language
  • 5. © Janice Regan 2003 An Overview of the History of Computers 1950s: Very large devices available to a select few 1960s: Large corporations owned computers 1970s: Computers get smaller and cheaper 1990s: Computers get cheaper and faster and are found in most homes
  • 6. © Janice Regan 2003 Elements of a Computer System A computer has 2 components  Hardware  Software
  • 7. © Janice Regan 2003 Hardware Components of a Computer Central Processing Unit (CPU) Main Memory
  • 8. © Janice Regan 2003 Hardware Components of a Computer
  • 9. © Janice Regan 2003 Main Memory Ordered sequence of cells (memory cells) Directly connected to CPU All programs must be brought into main memory before execution When power is turned off, everything in main memory is lost
  • 10. © Janice Regan 2003 Main Memory with 100 Storage Cells
  • 11. © Janice Regan 2003 Secondary Storage Provides permanent storage for information Examples of secondary storage:  Hard Disks  Floppy Disks  ZIP Disks  CD-ROMs  Tapes
  • 12. © Janice Regan 2003 Input Devices Definition: devices that feed data and computer programs into computers Examples:  Keyboard  Mouse  Secondary Storage
  • 13. © Janice Regan 2003 Output Devices Definition: devices that the computer uses to display results Examples:  Printer  Monitor  Secondary Storage
  • 14. © Janice Regan 2003 Software Software consists of programs written to perform specific tasks Two types of programs  System Programs  Application Programs
  • 15. © Janice Regan 2003 System Programs System programs control the computer The operating system is first to load when you turn on a computer
  • 16. © Janice Regan 2003 Operating System (OS) OS monitors overall activity of the computer and provides services Example services:  memory management  input/output  activities  storage management
  • 17. © Janice Regan 2003 Application Programs Written using programming languages Perform a specific task Run by the OS Example programs:  Word Processors  Spreadsheets  Games
  • 18. © Janice Regan 2003 Language of a Computer Machine language: the most basic language of a computer A sequence of 0s and 1s Every computer directly understands its own machine language A bit is a binary digit, 0 or 1 A byte is a sequence of eight bits
  • 19. © Janice Regan 2003 Evolution of Programming Languages Early computers programmed in machine language Assembly languages were developed to make programmer’s job easier In assembly language, an instruction is an easy-to-remember form called a mnemonic Assembler: translates assembly language instructions into machine language
  • 20. © Janice Regan 2003 Instructions in Assembly and Machine Language
  • 21. © Janice Regan 2003 Evolution of Programming Languages High-level languages make programming easier Closer to spoken languages Examples:  Basic  FORTRAN  COBOL  C/C++  Java
  • 22. © Janice Regan 2003 Evolution of Programming Languages  To run a Java program: 1. Java instructions need to be translated into an intermediate language called bytecode 2. Then the bytecode is interpreted into a particular machine language
  • 23. © Janice Regan 2003 Evolution of Programming Languages  Compiler: A program that translates a program written in a high-level language into the equivalent machine language. (In the case of Java, this machine language is the bytecode.)  Java Virtual Machine (JVM) - hypothetical computer developed to make Java programs machine independent
  • 24. © Janice Regan 2003 Processing a Java Program  Two types of Java programs: applications and applets  Source program: Written in a high-level language  Linker: Combines bytecode with other programs provided by the SDK and creates executable code  Loader: transfers executable code into main memory  Interpreter: reads and translates each bytecode instruction into machine language and then executes it
  • 25. © Janice Regan 2003 Processing a Java Program
  • 26. © Janice Regan 2003 Problem-Solving Process 1. State the Problem 2. Analyze the problem: outline solution requirements and design an algorithm 3. Design an algorithm to solve the problem 4. Implement the algorithm in a programming language (Java) and verify that the algorithm works 5. Maintain the program: use and modify if the problem domain changes
  • 27. © Janice Regan 2003 Problem-Analysis-Coding- Execution Cycle Algorithm: A step-by-step problem-solving process in which a solution is arrived at in a finite amount of time
  • 28. © Janice Regan 2003 Algorithms Definition of an Algorithm? What makes a good algorithm? Example
  • 29. © Janice Regan 2003 Definition An algorithm is  Any set of instructions that specifies a series of steps to correctly solve the problem There may be many different algorithms to solve a given problem Some algorithms may be more efficient than others
  • 30. © Janice Regan 2003 Algorithms and Programs  An algorithm is a finite set of instructions that explains the required solution step-by-step  A computer can be instructed to implement many algorithms with a finite number of steps or instructions  A program is a set of computer instructions that implements an algorithm
  • 31. © Janice Regan 2003 Why Should I Write Algorithms? A computer program solves a scientific programming problem with a computer  a simulation problem, a data analysis application, a control system, etc. To write a computer program you need to know the series of steps your are implementing to solve your problem, You need to know your algorithm!
  • 32. © Janice Regan 2003 Important  The sequence or order of the steps is usually of critical importance in writing a correct algorithm  You must be exact when specifying an algorithm that is to be translated into a computer program  What is the difference between A*B+C and (A*B)+C? Be careful, the computer will do exactly what you ask, even it is not what you really want it to do!!
  • 33. © Janice Regan 2003 Problem Solving Methodology and Algorithms  Problem Specification: State the problem clearly  Analysis: Input, Output, How to go from input to output  Design: Develop a step by step method  Test Plan: How do you test to determine your algorithm works  Implementation or coding  Testing  Refinement
  • 34. © Janice Regan 2003 Problem Specification I Any problem solving process consists of Input  Algorithm  Output Determine what information is available as input to your algorithm Determine what information is desired as output from your algorithm
  • 35. © Janice Regan 2003 Specification and Analysis What needs to be done to the input to determine the output?  Determine a series of steps that will transform the input data into the output results  Then enumerate all the special cases that the must be handled  If necessary modify or redesign your series of steps to handle all special cases
  • 36. © Janice Regan 2003 Verifying Algorithms You written your algorithm, is it ready to be translated into a program?  Verify that it gives the desired results.  Verify that all special cases are handled  Verify that the algorithm ends after the outputs are determined You have a series of items to verify, you also have made a good start on determining what tests need to be included in your test plan.
  • 37. © Janice Regan 2003 Summary: Writing Algorithms?  You will succeed in writing algorithms if you  First think about the problem, its input data and required results (output)  Next determine a series of steps that will transform the input data into the output results  Then enumerate all the special cases that the must be handled  If necessary modify or redesign your series of steps so that all special cases are handled  Verify your algorithm
  • 38. © Janice Regan 2003 Example: Problem Specification You are spending the weekend with a group of friends. Your contribution to making breakfast is making the coffee. The friend in charge of grocery shopping has told you the coffee is in the freezer.
  • 39. © Janice Regan 2003 Example: Analysis and Design You see a coffee maker on the kitchen counter with a box of coffee filters. You might decide to subdivide the problem of making the coffee into the following steps
  • 40. © Janice Regan 2003 Example: Algorithm 1. Take the coffee out of the freezer 2. Put the coffee in a filter 3. Put the filter in the coffee maker 4. Put water in the coffee maker 5. Turn on the coffee maker 6. Put the rest of the coffee back in the freezer
  • 41. © Janice Regan 2003 Example: refinement I  You look for the coffee in the freezer and you find whole coffee beans. You know that you need ground coffee beans to make coffee.  Refinement of step 2 a) Find the coffee grinder b) Put the coffee beans into the grinder c) Grind the coffee beans d) Put the ground coffee in the filter
  • 42. © Janice Regan 2003 Example: refinement II  You need to decide when the coffee is properly ground  Refinement of step 2c c) Grind the coffee beans i. Stop grinding ii. Check to see if the coffee beans are properly ground iii. Continue grinding if they are not iv. Repeat until the coffee is properly ground
  • 43. © Janice Regan 2003 Example: refinement III  What if you use the last of the coffee and have none left to put back in the freezer?  Refinement of step 6 6. If there are any coffee beans left put them back in the freezer
  • 44. © Janice Regan 2003 Example: refined algorithm I 1. Take the coffee out of the freezer 2. Put coffee in a filter a) Find the coffee grinder b) Put the coffee beans into the grinder c) Grind the coffee beans i. Stop grinding ii. Check to see if the coffee beans are properly ground iii. Continue grinding if they are not iv. Repeat until the coffee is properly ground d) Put the ground coffee in the filter
  • 45. © Janice Regan 2003 Example: refined algorithm II 3. Put the filter in the coffee maker 4. Put water in the coffee machine 5. Turn on the coffee machine 6. If there are any coffee beans left put the rest of the coffee back in the freezer
  • 46. © Janice Regan 2003 Choices There may be several algorithms to solve a given problem  Which algorithm is the best?  How do we chose?
  • 47. © Janice Regan 2003 Properties of Good Algorithms  Efficiency  Simplicity  Precision  Effectiveness  Generality  Levels of Abstraction  Correctness  Finiteness  Maintainability
  • 48. © Janice Regan 2003 Class discussion Algorithm for solving a quadratic equation
  • 49. © Janice Regan 2003 Problem-Analysis-Coding- Execution Cycle
  • 50. © Janice Regan 2003 Programming Methodologies Two basic approaches to programming design:  Structured design  Object-oriented design
  • 51. © Janice Regan 2003 Structured Design 1. A problem is divided into smaller subproblems 2. Each subproblem is solved 3. The solutions of all subproblems are then combined to solve the problem
  • 52. © Janice Regan 2003 Object-Oriented Design (OOD)  In OOD, a program is a collection of interacting objects  An object consists of data and operations  Steps in OOD: 1. Identify objects 2. Form the basis of the solution 3. Determine how these objects interact
  • 53. © Janice Regan 2003 Chapter Summary  A computer system is made up of hardware and software components  Computers understand machine language; it is easiest for programmers to write in high-level languages  A compiler translates high-level language into machine language  High-level language steps to execute a program: edit, compile, link, load, and execute
  • 54. © Janice Regan 2003 Chapter Summary Algorithm: step-by-step problem-solving process in which a solution is arrived at in a finite amount of time Three steps to problem solving: analyze the problem and design an algorithm, implement the algorithm in a programming language, and maintain the program Two basic approaches to programming design: structured and object-oriented