Intro Fortran 1
Intro Fortran 1
What is a Computer?
Computer Software
Computer Hardware
Fetch-Decode-Execute Cycle
CPU Families
Exercises
memory
Programs that control the operations of the computer are stored inside the
computer
Word processors
Game programs
Database systems
Graphics programs
Multimedia
Department of Computer applications
Science, ABU, Zaria Programming In Fortran 6
Computer Hardware
The CPU can read and write to RAM but the CPU can read from ROM but cannot write to
ROM
The CPU components are connected by a group of electrical wires called the
CPU bus.
The Control Unit fetches the current instruction from memory, decodes it and instructs the ALU to execute
the instruction.
The execution of an instruction may generate further data fetches from memory
Instruction
Cycle
Main Memory
1 Control Unit
Fetch 2 Decode
cpu
RAM
Execution
Cycle
Execute
Store 3
4
Arithmetic/Logic Unit
The question now is: Is it possible to write a single program that can be
understood and correctly executed on machines with different processors?
We’ll address this question in a subsequent lecture.
Department of Computer Science, ABU, Zaria Object-Oriented Programming I 15
Drill Questions
A computer program must be clear so that only one meaning can be derived from it,
1. Machine languages.
2. Assembly languages.
3. High-level languages.
Machine languages and assembly languages are also called low-level languages
Machine friendly
No translation required
Disadvantages
Not portable
Assembly language programs have the same advantages and disadvantages as machine
language programs.
Advantages
Portable or machine independent
Programmer-friendly
Disadvantages
Not as efficient as low-level languages
Need to be translated
Advantages
Low memory utilization
Relatively efficient
The most common form of programming in use today.
Disadvantages
Difficulty of reasoning about programs
Difficulty of parallelization.
Tend to be relatively low level.
Advantages
Conceptual simplicity
Models computation better
Increased productivity.
Disadvantages
Can have a steep learning curve, initially
Doing I/O can be cumbersome
Advantages
Small and clean syntax
Better support for reasoning about programs
They allow functions to be treated as any other data values.
They support programming at a relatively higher level than the imperative languages
Disadvantages
Difficulty of doing input-output
Functional languages use more storage space than their imperative cousins
Department of Computer Science, ABU, Zaria Object-Oriented Programming I 26
Programming Paradigms: Logic
A program in the logic paradigm consists of a set of predicates and rules of inference.
Predicates are statements of fact like the statement that says: water is wet.
Example: Prolog
Advantages
Good support for reasoning about programs
Can lead to concise solutions to problems
Disadvantages
Slow execution
Limited view of the world
That means the system does not know about facts that are not its predicates and rules of inference.
Difficulties in understanding and debugging large programs
Languages with features from different paradigms are often too complex.
The Java programming language is perhaps the most popular object-oriented language today.