TMF1013 : Introduction To Computing TMF1013 : Introduction To Computing Lecture 1 : Fundamental of Computer Lecture 1 : Fundamental of Computer Computer Computer Foudamentals Foudamentals
TMF1013 : Introduction To ComputingTMF1013 : Introduction To Computing
Lecture 1 : Fundamental of ComputerLecture 1 : Fundamental of Computer
Computer Computer FoudamentalsFoudamentals
TMF1013 : Introduction To ComputingTMF1013 : Introduction To Computing
Lecture 1 : Fundamental of ComputerLecture 1 : Fundamental of Computer
ComputerComputer
is a device that can input and store a set of instructions designed to perform a specific task, input and store data, process the stored data according to the instructions, and produce output to be relayed to its user
TMF1013 : Introduction To ComputingTMF1013 : Introduction To Computing
Lecture 1 : Fundamental of ComputerLecture 1 : Fundamental of Computer
Computer SoftwareComputer Softwaresoftware is a synonym for program classify as applications software and systems software
Applications softwarerefers to programs that solve some specific problems
Systems softwarerefers to programs that make the computer usable and accessible to the developers and programmers of applications software
TMF1013 : Introduction To ComputingTMF1013 : Introduction To Computing
Lecture 1 : Fundamental of ComputerLecture 1 : Fundamental of Computer
Operating SystemOperating Systemmanages overall operation of the computer system
OS Tasks•validate user•make others systems software available to users•allocate memory and processor time to programs•manage available secondary memory•manage disk and tape file•control various input & output
Example : DOS, UNIX, GUI OS - Win95, Win NT..
TMF1013 : Introduction To ComputingTMF1013 : Introduction To Computing
Lecture 1 : Fundamental of ComputerLecture 1 : Fundamental of Computer
Computer ProgrammingComputer Programming
• Instructions given to the computer for problem solving in a particular programming language
• Programming refers to the creation of a list of stored instructions that tell the computer what to do
• When to write programs• before, when the computer was needed for a job• a lot of software available , if nothing available & suitable, programs will have to be written or existing software can be customized
TMF1013 : Introduction To ComputingTMF1013 : Introduction To Computing
Lecture 1 : Fundamental of ComputerLecture 1 : Fundamental of Computer
ProgrammingProgramming
•A program is a logical pattern of instructions to solve a problem •steps
•define the problem•develop an algorithm - define how the problem is to be solved•do program coding by following the syntax of the progamming language•test the program for logic errors and debug it for bugs•prepare documentation which includes user instructions, an explanation of the logic of the program and information about the input and output
TMF1013 : Introduction To ComputingTMF1013 : Introduction To Computing
Lecture 1 : Fundamental of ComputerLecture 1 : Fundamental of Computer
Programming LanguagesProgramming Languages
•Is an artificial and formal language that has a limited vocabulary consisting of a set of keywords for making up instructions and a set of precise grammar rules.
•Programmers write computer instruction in programming languages, some directly understandable by one computer and others that require intermediate steps
•Different languages are used for different types of applications
•3 main categories•Machine language (1st generation)•Assembly language (2nd generation)•High level language
TMF1013 : Introduction To ComputingTMF1013 : Introduction To Computing
Lecture 1 : Fundamental of ComputerLecture 1 : Fundamental of Computer
Machine LanguagesMachine Languages
•Is the natural language of a computer•doesn’t need to be translated - immediate execution•consists binary string 1s and 0s•difficult to learn•instruction corresponds to a basic capability of computer - simple problems require large numbers of instruction•machine-dependent•not portable
•0101 1000 0001 0000 1100 0000 0001 0000
TMF1013 : Introduction To ComputingTMF1013 : Introduction To Computing
Lecture 1 : Fundamental of ComputerLecture 1 : Fundamental of Computer
Assembly Languages
•Consist of English-like abbreviations that are less cryptic that machine language
•have to translated into machine language
•each computer type has its own assembly language
•L 1, GROSSPAY•S 1, TAX•ST 1, NETPAY
TMF1013 : Introduction To ComputingTMF1013 : Introduction To Computing
Lecture 1 : Fundamental of ComputerLecture 1 : Fundamental of Computer
High-Level LanguagesHigh-Level Languages
• Quite English-like• a single instruction can be written to correspond to many operation at the machine level
• netpay = grosspay - tax;• easy to learn• have to be converted to machine languages• portable• FORTRAN, COBOL BASIC, Pascal• 4th generation• 5th generation
TMF1013 : Introduction To ComputingTMF1013 : Introduction To Computing
Lecture 1 : Fundamental of ComputerLecture 1 : Fundamental of Computer
Natural languages ( 5th generation)• resembles spoken English• also referred as knowledge-based languages
Language Translators•a type of system software which includes assemblers, interpreters and compilers. The processes of translation to machine-readable code is different in each of these.•Assemblers are translators that convert low-level assembly language to machine language•compilers and interpreters translate high level language source code into machine language object code.
TMF1013 : Introduction To ComputingTMF1013 : Introduction To Computing
Lecture 1 : Fundamental of ComputerLecture 1 : Fundamental of Computer
Compilers•It translates the complete program all at one•object code produced can be saved and run when needed•Efficient - run programs after they are translated
Interpreters•translates each line of instruction as it goes through the program•the object code produced cannot be saved•program must be interpreted every time it is executed•good for correcting programs but slower than compilers to run finished programs
TMF1013 : Introduction To ComputingTMF1013 : Introduction To Computing
Lecture 1 : Fundamental of ComputerLecture 1 : Fundamental of Computer
Problem SolvingProblem Solvingis the process of transforming the description of a problem into the solution of that problem by using our knowledge of the problem domain and relying on our ability to select and use appropriate problem-solving strategies, techniques, and tools.
An algorithmAn algorithmis a sequence of a finite number of steps arranged in a specific logical order, which, when executed, produce the solution for a problem
TMF1013 : Introduction To ComputingTMF1013 : Introduction To Computing
Lecture 1 : Fundamental of ComputerLecture 1 : Fundamental of Computer
Pseudocode languagePseudocode languageis a semiformal, English-like language with a limited vocabulary that can be used to design and describe algorithm
Flowcharting•Flowchart is a graph consisting of geometrical shapes that are connected by flow lines•the shapes represent the types of statements in an algorithm
TMF1013 : Introduction To ComputingTMF1013 : Introduction To Computing
Lecture 1 : Fundamental of ComputerLecture 1 : Fundamental of Computer
Programming process• Define the problem• Planning the solution
•using flowchart,pseudocode, structure charts• Coding the program
•using programming language• Testing program
•desk-checking, debugging for error - syntax & logic error
• Documenting program•description of programming life cycle•program description, flowcharts and pseudocode,data….
TMF1013 : Introduction To ComputingTMF1013 : Introduction To Computing
Lecture 1 : Fundamental of ComputerLecture 1 : Fundamental of Computer
Basic Control structure for pseudocode language
• sequence control structure• selection control structure• nested selection structure• repetition control structure
TMF1013 : Introduction To ComputingTMF1013 : Introduction To Computing
Lecture 1 : Fundamental of ComputerLecture 1 : Fundamental of Computer
Sequence Control Structureis a series of steps or statements that are executed in the order in which they are written in an algorithms.
Example
Read taxable incomeread filing statuscompute income taxprint income tax
TMF1013 : Introduction To ComputingTMF1013 : Introduction To Computing
Lecture 1 : Fundamental of ComputerLecture 1 : Fundamental of Computer
Selection Control Structuredefines two course of action, depending on the outcome of a condition. A condition is an expression that, when evaluated, computes to either true or false.
If conditionthen-part
elseelse-part
end_if
TMF1013 : Introduction To ComputingTMF1013 : Introduction To Computing
Lecture 1 : Fundamental of ComputerLecture 1 : Fundamental of Computer
Nested Selected Structureis a basic selection structure that contains other if/else structuresin its then-part or else-part
if status is equal to 1print “Single”
else if status is equal to 2….
TMF1013 : Introduction To ComputingTMF1013 : Introduction To Computing
Lecture 1 : Fundamental of ComputerLecture 1 : Fundamental of Computer
Repetition Control StructureSpecifies a block of one or more statements that are repeatedly executed until a condition is satisfied
While conditionloop-body
end_while
TMF1013 : Introduction To ComputingTMF1013 : Introduction To Computing
Lecture 1 : Fundamental of ComputerLecture 1 : Fundamental of Computer
Conventions For Pseudocoding
Each pseudocode statement includes keywords that describe operations and some appropriate, English like descriptions of operand.
Should be written on a separate line. If a statement requires more than one line, the continuation lines should be indented
should begin with unambiguous word such as compute, set and initialize. Statements in a sequence structure can be grouped into a block by enclosing them between the keywords begin and end
For selection control structure, use an if/else statement. In an if/else statement, the then-part and, if used, the else-part should be indented. Terminate each if statement with keyword end_if
For the repetition control structure, use the while statement and indent the loop-body. Termninate each while statement with the keyword end_while
TMF1013 : Introduction To ComputingTMF1013 : Introduction To Computing
Lecture 1 : Fundamental of ComputerLecture 1 : Fundamental of Computer
What is pseudocode?
Pseudocode consists of short, English phrases used to explain specific tasks within a program's algorithm. Pseudocode should not include keywords in any specificcomputer languages. It should be written as a list of consecutive phrases. You should not use flowcharting symbols but you can draw arrows to show loopingprocesses. Indentation can be used to show the logic in pseudocode as well. One programmer should be able to take another programmer's pseudocode and generate a program based on that pseudocode.
TMF1013 : Introduction To ComputingTMF1013 : Introduction To Computing
Lecture 1 : Fundamental of ComputerLecture 1 : Fundamental of Computer
Why is pseudocode necessary?
The programming process is a complicated one. You must first understand the program specifications, of course, Then you need to organize your thoughts and create the program. This is a difficult task when the program is not trivial (i.e. easy). You must break the main tasks that must be accomplished into smaller ones in order to be able to eventually write fully developed code. Writing pseudocode WILL save you time later during the construction & testing phase of a program's development.
TMF1013 : Introduction To ComputingTMF1013 : Introduction To Computing
Lecture 1 : Fundamental of ComputerLecture 1 : Fundamental of Computer
How do I write pseudocode?
First you may want to make a list of the main tasks that must be accomplished on a piece of scratch paper. Then, focus on each of those tasks. Generally, you should try to break each main task down into very small tasks that can each be explained with a short phrase. There may eventually be a one-to-one correlation between the lines of pseudocode and the lines of the code that you write after you have finished pseudocoding.