Introduction To Computers and Logic
Introduction To Computers and Logic
Topic Outline
• Introduction to Computers and Logic
• Hardware
• Software
• How computers store data
• Machine Cycle
• How a program works
• Programming Process
• Introduction to Java
CpE 112 – Programming Logic and Design 2
Intended Learning Outcomes
• Define what is computer
• Understand computer components and
operations
• Enumerate and describe different
computers
• Explain how the computer works and how
data is stored and manipulated.
• Describe the steps involved in the
programming process
CpE 112 – Programming Logic and Design 3
What is computer?
• software
- is a collection of programming code
installed on your computer's hard drive.
- cannot be held in your hand.
CpE 112 – Programming Logic and Design 8
Hardware
• Input devices
- An input device is any hardware device that sends data to the
computer.
Example:
1. Operating System
- is the program that, after being initially loaded into the computer
by a boot program, manages all of the other application programs in
a computer.
Example:
2. BIOS
Example:
1. Presentation Software
2. Spreadsheet Software
3. Database Software
4. Multimedia Software
5. Simulation Software
6.Word Processing Software
It is the process by which a computer processor retrieves a program instruction from its
memory, determines what actions the instruction requires, and carries out those actions.
This cycle is repeated continuously from bootup to when the computer is shut down.
Instruction Phase:
• Fetch - get an instruction from Main Memory
• Decode - translate it into computer commands
• [
Execution Phase
• Execute - actually process the command
• Store - write the result to Main Memory
High-level languages allow you to create powerful and complex programs without knowing how the CPU
works, using words that are easy to understand.
Example:
1. Ada
2. BASIC
3. FORTRAN
4. COBOL
5. Pascal
6. C and C++
7. C#
8. Java
9. JavaScript
10. Python
11. Ruby
12. Visual Basic
CpE 112 – Programming Logic and Design 35
How a Program Works
1. Problem Definition
2.Problem Analysis
3.Algorithm design and representation
(Pseudocode or flowchart)
4.Coding and debugging
CpE 112 – Programming Logic and Design 40
Program Development Life Cycle
1. Problem Definition
● A clearly defined problem is already half
the solution.
● Computer programming requires us to
define the problem first before we even try
to create a solution.
● Let us now define our example problem:
“Create a program that will determine the
number of times a name occurs in a list.”
CpE 112 – Programming Logic and Design 41
Program Development Life Cycle
• 2. Problem Analysis
● After the problem has been adequately defined, the
simplest and yet the most efficient and effective approach
to solve the problem must be formulated.
● Usually, this step involves breaking up the problem into
smaller and simpler subproblems.
● Example Problem: – Determine the number of times a
name occurs in a list
● Input to the program: – list of names (let's call this
nameList) – name to look for (let's call this keyName)
● Output of the program: – the number of times the name
occurs in a list CpE 112 – Programming Logic and Design 42
Program Development Life Cycle
– A programming language
– A development environment
– An application environment
– A deployment environment
● As a programming language
- Java can create all kinds of applications
that you could create using any conventional
programming language.
● As a development environment
- Java technology provides you with a
large suite of tools: – A compiler – An
interpreter – A documentation generator –
A class file packaging tool and so on...
• JRE – runs code compiled for a JVM and performs class loading (through the
class loader), code verification (through the bytecode verifier) and finally
code execution
• Class Loader – responsible for loading all classes needed for the Java program
– adds security by separating the namespaces for the classes of the local file
system from those that are imported from network sources – After loading
all the classes, the memory layout of the executable is then determined. This
adds protection against unauthorized access to restricted areas of the code
since the memory layout is determined during runtime
• Bytecode verifier – tests the format of the code fragments and checks the
code fragments for illegal code that can violate access rights to objects
- What is computer?
• Hardware
• Machine Cycle
• Introduction to Java
- History
- What is Java Technology?
- Java Features