SlideShare a Scribd company logo
1 of 41
By
Salamudeen Alhassan
 What Is Programming?
 Developing instructions for carrying out a task
involving a set of objects.
 Computer
 A programmable device that can store,
retrieve, and process data.
 Data
 Information in a form that a computer can use
(e.g. letters, words, integer numbers, real
numbers, dates, times, coordinates on a map, e.c.t.)
 Information
 Any knowledge that can be communicated including
abstract ideas and concepts such as “the Earth is
round.”
 Object
 A collection of data values and associated Operations.
Virtually any kind of information can be represented
as an object.
 Computer program (computer programming)
 Instructions defining a set of objects and
orchestrating their interactions to solve a problem
 A computer is not intelligent. It cannot analyze a
problem and come up with a solution.
 A human (the programmer) must analyze the
problem, develop the objects and instructions for
solving the problem, and then have the computer
carry out the instructions.
 What’s the advantage of using a computer if it can’t
solve problems? Once we have written a solution for
the computer, the computer can repeat the solution
very quickly and consistently, again and again.
 In this way, the computer frees people from
repetitive and boring tasks.
 To write a program for a computer to follow,
we must go through a two phase process:
◦ Problem solving
◦ implementation
 Problem-Solving Phase
◦ Analysis and specification. Understand
(define) the problem and identify what the
solution must do.
◦ General solution (algorithm). Specify the
objects and their interactions that solve the
problem.
◦ Verify. Follow the steps exactly to see if the
solution really does solve the problem.
 Implementation Phase
◦ Concrete solution (program).Translate the object
specifications and algorithms (the general solution) into
a programming language.
◦ Test. Have the computer carry out the program and then
check the results. If you find errors, analyze the
program and the general solution to determine the
source of the errors, and then make corrections.
 Once a program has been written, it enters a third
phase: maintenance.
 Maintenance Phase
◦ Use. Use the program.
◦ Maintain. Modify the program to meet changing
requirements or to correct any errors that show up
in using it.
 Class
 A description of the representation of a specific
kind of object, in terms of data and operational
behaviours.
 Algorithm
 Instructions for solving a problem in a finite
amount of time using a finite amount of data.
 A program is an algorithm that is written for a
computer. Java programs are generally referred to
as applications
 Programming language
 A set of rules, symbols, and special words used to
construct a computer program.
 A programming language is a simplified form of
English (with math symbols) that adheres to a strict
set of grammatical rules.
 Code
 Instructions for a computer that are written in a
programming language.
 Translating an algorithm into a programming
language is called coding the algorithm.
 Documentation
◦ The written text and comments that make an
application easier for others to understand, use, and
modify
 All data in a computer are stored and used in binary
codes, consisting of strings of 1s and 0s.
 Instructions and data are stored together in the computer’s
memory using these binary codes.
 Machine language
 The language, made up of binary coded instructions, that
is used directly by the computer.
 Assembly language
 A low level programming language in which a mnemonic
represents each machine language instruction for a
particular computer.
 Typical instructions for addition and subtraction
might look like this:
Assembly Language Machine Language
ADD 100101
SUB 010011
 Although humans find it easier to work with
assembly language, the computer cannot directly
execute the instructions. Because a computer can
process its own instructions as a form of data, it is
possible to write a program to translate assembly
language instructions into machine code. Such a
program is called an assembler.
 Assembly language represents a step in the right
direction, but it still forces programmers to think in
terms of individual machine instructions.
 Eventually, computer scientists developed high-level
programming languages. These languages are easier
to use than assembly languages or machine code
because they are closer to English and other natural
languages.
 Assembler
◦ A program that translates an assembly language program into
machine code.
 A program called a compiler translates algorithms
written in certain high-level languages (Java,
C++,Visual Basic, and Ada, for example) into machine
language.
 Compiler
◦ A program that translates code written in a high-level language
into machine code.
 The text of an algorithm written in a high-level
language is called source code. To the compiler,
source code is just input data—letters and numbers. It
translates the source code into a machine language
form called object code
 Source code
◦ Instructions written in a high-level programming
language
 Object code
◦ A machine language version of a source code.
High-Level Programming Language allow
applications to be compiled in different systems
 Java source code is translated into a standard machine
language called Bytecode.
 Bytecode
◦ A standard machine language into which Java
source code is compiled.
 No computers actually use Bytecode as their machine
language.
 Instead, for a computer to run Bytecode, it must have
another program called the Java Virtual Machine
(JVM) that serves as a language interpreter for the
Bytecode
A Java Compiler Produces Bytecode that Can Be Run on Any
Machine with the JVM
 Direct execution of code differs significantly from
interpretation of code.
 A computer can directly execute a program that is
compiled into machine language.
 Direct execution
◦ The process by which a computer performs the
actions specified in a machine language program.
 Interpretation
◦ The translation, while a program is running, of
nonmachine language instructions (such as Bytecode)
into executable operations.
 When a program is used to make one computer act
like another computer, we call it a virtual machine.
 Virtual machine
◦ A program that makes one computer act like
another
 The instructions in a programming language reflect
the operations a computer can perform:
◦ A computer can transfer data from one place to
another.
◦ A computer can input data from an input device (a
keyboard or mouse, for example) and output data to
an output device (a screen, for example).
◦ A computer can store data into and retrieve data
from its memory and secondary storage (parts of a
computer that we discuss in the next section).
 The instructions in a programming language reflect
the operations a computer can perform:
◦ A computer can compare data values for equality or
inequality and make decisions based on the result.
◦ A computer can perform arithmetic operations
(addition and subtraction, for example) very
quickly.
◦ A computer can branch to a different section of the
instructions.
 A programming language contains instructions, called
declarations, which we use to specify the data and
operations in classes.
 Programming languages require that we use certain
control structures to organize the instructions that
specify the behaviors of objects.
 Instructions that describe behavior can be organized
in four ways in most programming languages:
sequentially, conditionally, repetitively, and with
subprograms. Java adds a fifth way: asynchronously
 A sequence is a series of operations that are executed
one after another.
 Selection, the conditional control structure, executes
different operations depending on certain conditions.
 The repetitive control structure, the loop, repeats
operations while certain conditions are met.
 The subprogram allows us to organize our code into
units that correspond to specific object behaviors;
Java calls these units methods.
 Asynchronous control lets us write code that handles
events, such as the user clicking a button on the
screen with the mouse.
 Early programming languages focused their attention
on the operations and control structures of
programming. These procedural languages paid little
explicit attention to the relationships between the
operations and the data.
 At that time, a typical computer program used only
simple data types such as integers and real numbers,
which have obvious sets of operations defined by
mathematics.
 Problem with new data type such as date, time etc.
 Data type
◦ The specification in a programming language of
how information is represented in the computer as
data and the set of operations that can be applied
to it.
 Modern programming languages such as Java
allow us to collect data and its associated
operations into objects. For this reason, they
are called object-oriented programming
languages.
 Advantage of an object:
◦ It makes the relationships between the data and
operations explicit.
◦ Each object is a complete, self-contained unit
that can be reused again in other applications.
◦ Reusability enables us to write a
significant portion of our code using
existing objects, thereby saving a
considerable amount of time and effort.
 A class is a description of an object. When we need
an object in an application, we must create one from
such a description. Java provides an operation to let
us do so, and we say that the operation instantiates
the class.
 Instantiate
◦ To create an object based on the description
supplied by a class.
 One characteristic of an object-oriented programming
language is the presence of a large library of classes.
Within the library, classes are usually collected into
groups called packages.
 Package
◦ A collection of related classes
 We solve problems everyday
 learning environment, we usually are given most of
the information we need: a clear statement of the
problem, the necessary input, and the required output.
 In the problem-solving phase of computer
programming, we actually design algorithms. This
means we must be conscious of the strategies we use
to solve problems so that we can apply them to
programming problems effectively.
 Ask Questions
 Look for Things That Are Familiar
 Solve by Analogy
 Means-Ends Analysis
 Divide and Conquer
 The Building-Block Approach
 Merging Solutions

More Related Content

Similar to Understanding Programming Fundamentals (20)

SPCC:System programming and compiler construction
SPCC:System programming and compiler constructionSPCC:System programming and compiler construction
SPCC:System programming and compiler construction
 
6272 cnote
6272 cnote6272 cnote
6272 cnote
 
C progrmming
C progrmmingC progrmming
C progrmming
 
Chapter 5
Chapter 5Chapter 5
Chapter 5
 
Chapter 1
Chapter 1Chapter 1
Chapter 1
 
Programming Paradigm & Languages
Programming Paradigm & LanguagesProgramming Paradigm & Languages
Programming Paradigm & Languages
 
Programming Paradigm & Languages
Programming Paradigm & LanguagesProgramming Paradigm & Languages
Programming Paradigm & Languages
 
Ic lecture8
Ic lecture8 Ic lecture8
Ic lecture8
 
10tait
10tait10tait
10tait
 
Chapter 10
Chapter 10 Chapter 10
Chapter 10
 
UNIT 2 ECSE-2.pptx
UNIT 2 ECSE-2.pptxUNIT 2 ECSE-2.pptx
UNIT 2 ECSE-2.pptx
 
Introduction to Programming Concepts By Aamir Saleem Ansari
Introduction to Programming Concepts By Aamir Saleem AnsariIntroduction to Programming Concepts By Aamir Saleem Ansari
Introduction to Programming Concepts By Aamir Saleem Ansari
 
PROBLEM SOLVING
PROBLEM SOLVINGPROBLEM SOLVING
PROBLEM SOLVING
 
Programming Languages An Intro
Programming Languages An IntroProgramming Languages An Intro
Programming Languages An Intro
 
Beekman5 std ppt_13
Beekman5 std ppt_13Beekman5 std ppt_13
Beekman5 std ppt_13
 
Richa garg itm
Richa garg itmRicha garg itm
Richa garg itm
 
Chapter1.pdf
Chapter1.pdfChapter1.pdf
Chapter1.pdf
 
Stnotes doc 5
Stnotes doc 5Stnotes doc 5
Stnotes doc 5
 
Programming for Problem Solving
Programming for Problem SolvingProgramming for Problem Solving
Programming for Problem Solving
 
Programming
ProgrammingProgramming
Programming
 

Recently uploaded

Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Class 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfClass 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfakmcokerachita
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Celine George
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application ) Sakshi Ghasle
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting DataJhengPantaleon
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfSumit Tiwari
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppCeline George
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 

Recently uploaded (20)

Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Class 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfClass 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdf
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application )
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website App
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 

Understanding Programming Fundamentals

  • 2.
  • 3.  What Is Programming?  Developing instructions for carrying out a task involving a set of objects.  Computer  A programmable device that can store, retrieve, and process data.  Data  Information in a form that a computer can use (e.g. letters, words, integer numbers, real numbers, dates, times, coordinates on a map, e.c.t.)
  • 4.  Information  Any knowledge that can be communicated including abstract ideas and concepts such as “the Earth is round.”  Object  A collection of data values and associated Operations. Virtually any kind of information can be represented as an object.  Computer program (computer programming)  Instructions defining a set of objects and orchestrating their interactions to solve a problem
  • 5.  A computer is not intelligent. It cannot analyze a problem and come up with a solution.  A human (the programmer) must analyze the problem, develop the objects and instructions for solving the problem, and then have the computer carry out the instructions.  What’s the advantage of using a computer if it can’t solve problems? Once we have written a solution for the computer, the computer can repeat the solution very quickly and consistently, again and again.
  • 6.  In this way, the computer frees people from repetitive and boring tasks.  To write a program for a computer to follow, we must go through a two phase process: ◦ Problem solving ◦ implementation
  • 7.
  • 8.  Problem-Solving Phase ◦ Analysis and specification. Understand (define) the problem and identify what the solution must do. ◦ General solution (algorithm). Specify the objects and their interactions that solve the problem. ◦ Verify. Follow the steps exactly to see if the solution really does solve the problem.
  • 9.  Implementation Phase ◦ Concrete solution (program).Translate the object specifications and algorithms (the general solution) into a programming language. ◦ Test. Have the computer carry out the program and then check the results. If you find errors, analyze the program and the general solution to determine the source of the errors, and then make corrections.  Once a program has been written, it enters a third phase: maintenance.
  • 10.  Maintenance Phase ◦ Use. Use the program. ◦ Maintain. Modify the program to meet changing requirements or to correct any errors that show up in using it.
  • 11.  Class  A description of the representation of a specific kind of object, in terms of data and operational behaviours.  Algorithm  Instructions for solving a problem in a finite amount of time using a finite amount of data.  A program is an algorithm that is written for a computer. Java programs are generally referred to as applications
  • 12.  Programming language  A set of rules, symbols, and special words used to construct a computer program.  A programming language is a simplified form of English (with math symbols) that adheres to a strict set of grammatical rules.  Code  Instructions for a computer that are written in a programming language.  Translating an algorithm into a programming language is called coding the algorithm.
  • 13.
  • 14.
  • 15.  Documentation ◦ The written text and comments that make an application easier for others to understand, use, and modify
  • 16.  All data in a computer are stored and used in binary codes, consisting of strings of 1s and 0s.  Instructions and data are stored together in the computer’s memory using these binary codes.  Machine language  The language, made up of binary coded instructions, that is used directly by the computer.  Assembly language  A low level programming language in which a mnemonic represents each machine language instruction for a particular computer.
  • 17.  Typical instructions for addition and subtraction might look like this: Assembly Language Machine Language ADD 100101 SUB 010011
  • 18.  Although humans find it easier to work with assembly language, the computer cannot directly execute the instructions. Because a computer can process its own instructions as a form of data, it is possible to write a program to translate assembly language instructions into machine code. Such a program is called an assembler.
  • 19.  Assembly language represents a step in the right direction, but it still forces programmers to think in terms of individual machine instructions.  Eventually, computer scientists developed high-level programming languages. These languages are easier to use than assembly languages or machine code because they are closer to English and other natural languages.
  • 20.  Assembler ◦ A program that translates an assembly language program into machine code.  A program called a compiler translates algorithms written in certain high-level languages (Java, C++,Visual Basic, and Ada, for example) into machine language.  Compiler ◦ A program that translates code written in a high-level language into machine code.
  • 21.  The text of an algorithm written in a high-level language is called source code. To the compiler, source code is just input data—letters and numbers. It translates the source code into a machine language form called object code  Source code ◦ Instructions written in a high-level programming language  Object code ◦ A machine language version of a source code.
  • 22. High-Level Programming Language allow applications to be compiled in different systems
  • 23.  Java source code is translated into a standard machine language called Bytecode.  Bytecode ◦ A standard machine language into which Java source code is compiled.  No computers actually use Bytecode as their machine language.  Instead, for a computer to run Bytecode, it must have another program called the Java Virtual Machine (JVM) that serves as a language interpreter for the Bytecode
  • 24. A Java Compiler Produces Bytecode that Can Be Run on Any Machine with the JVM
  • 25.  Direct execution of code differs significantly from interpretation of code.  A computer can directly execute a program that is compiled into machine language.  Direct execution ◦ The process by which a computer performs the actions specified in a machine language program.  Interpretation ◦ The translation, while a program is running, of nonmachine language instructions (such as Bytecode) into executable operations.
  • 26.  When a program is used to make one computer act like another computer, we call it a virtual machine.  Virtual machine ◦ A program that makes one computer act like another
  • 27.  The instructions in a programming language reflect the operations a computer can perform: ◦ A computer can transfer data from one place to another. ◦ A computer can input data from an input device (a keyboard or mouse, for example) and output data to an output device (a screen, for example). ◦ A computer can store data into and retrieve data from its memory and secondary storage (parts of a computer that we discuss in the next section).
  • 28.  The instructions in a programming language reflect the operations a computer can perform: ◦ A computer can compare data values for equality or inequality and make decisions based on the result. ◦ A computer can perform arithmetic operations (addition and subtraction, for example) very quickly. ◦ A computer can branch to a different section of the instructions.
  • 29.  A programming language contains instructions, called declarations, which we use to specify the data and operations in classes.  Programming languages require that we use certain control structures to organize the instructions that specify the behaviors of objects.  Instructions that describe behavior can be organized in four ways in most programming languages: sequentially, conditionally, repetitively, and with subprograms. Java adds a fifth way: asynchronously
  • 30.  A sequence is a series of operations that are executed one after another.
  • 31.  Selection, the conditional control structure, executes different operations depending on certain conditions.
  • 32.  The repetitive control structure, the loop, repeats operations while certain conditions are met.
  • 33.  The subprogram allows us to organize our code into units that correspond to specific object behaviors; Java calls these units methods.
  • 34.  Asynchronous control lets us write code that handles events, such as the user clicking a button on the screen with the mouse.
  • 35.  Early programming languages focused their attention on the operations and control structures of programming. These procedural languages paid little explicit attention to the relationships between the operations and the data.  At that time, a typical computer program used only simple data types such as integers and real numbers, which have obvious sets of operations defined by mathematics.  Problem with new data type such as date, time etc.
  • 36.  Data type ◦ The specification in a programming language of how information is represented in the computer as data and the set of operations that can be applied to it.  Modern programming languages such as Java allow us to collect data and its associated operations into objects. For this reason, they are called object-oriented programming languages.
  • 37.  Advantage of an object: ◦ It makes the relationships between the data and operations explicit. ◦ Each object is a complete, self-contained unit that can be reused again in other applications. ◦ Reusability enables us to write a significant portion of our code using existing objects, thereby saving a considerable amount of time and effort.
  • 38.  A class is a description of an object. When we need an object in an application, we must create one from such a description. Java provides an operation to let us do so, and we say that the operation instantiates the class.  Instantiate ◦ To create an object based on the description supplied by a class.
  • 39.  One characteristic of an object-oriented programming language is the presence of a large library of classes. Within the library, classes are usually collected into groups called packages.  Package ◦ A collection of related classes
  • 40.  We solve problems everyday  learning environment, we usually are given most of the information we need: a clear statement of the problem, the necessary input, and the required output.  In the problem-solving phase of computer programming, we actually design algorithms. This means we must be conscious of the strategies we use to solve problems so that we can apply them to programming problems effectively.
  • 41.  Ask Questions  Look for Things That Are Familiar  Solve by Analogy  Means-Ends Analysis  Divide and Conquer  The Building-Block Approach  Merging Solutions