Introduction to Computer Programming Chapter One Created by: Mr. Hidra
Introduction to Programming language A programming language is a language designed to communicate instructions to a computer. Thus, Programming language is a set of commands, strings or characters readable by programmers but easily translatable to machine code. It has the following ❖ Syntax: Is a set of rules that define how the commands have to be arranged to make sense ❖ Grammar: Is a set of rules of using different punctuation, quotation marks, semicolons, ❖ Semantics: Is a set of meanings assigned to every command of the language and is used to properly translate the program to machine code.
Classification of Programming language Programming Language can be grouped into three namely; 1)Machine Languages, 2)Assembly Languages and 3)High level Languages.
1: Machine Language: Machine language is a collection of binary digits or bits that the computer reads and interprets. Machine language is the only language a computer is capable of understanding. Machine level language is a language that supports the machine side of the programming or does not provide human side of the programming. It consists of (binary) zeros and ones.
2: Assembly Language: Assembly language is easier to use than machine language. An assembler is useful for detecting programming errors. Programmers do not have the absolute address of data items. Assembly language encourage modular programming.
3: High level language High level language is a language that supports the human and the application sides of the programming. Consequently more programming is now done in high level languages. Examples of high-level languages are ✓ BASIC, ✓ FORTRAN etc.
Attribute of good Programming Language Some of very good characteristics of a good programming language are, ❖ Clarity, Simplicity and Unity: ❖ Orthogonality: ❖ Support for Abstraction: ❖ Programming Environment: ❖ Ease of program verification/Reusability: ❖ Portability of programs:
Program performance and features of programming languages Performance of a program, including ❑ Reliability, ❑ Readability, ❑ Writability, ❑ Reusability and ❑ Efficiency.
Programming Development Cycle: The various stages in the development of a computer program are:- ▪Problem Definition. ▪Program Design. ▪Coding. ▪Debugging. ▪Testing. ▪Documentation. ▪Maintenance.
Cont.. 1) Problem Definition: In this step the problem has to be defined formally, by being sure understanding what the program should do, that is, what the output should be. 2) Program Design: The next stage is the program design. The software developer makes use of tools like algorithms and flowcharts to develop the design of the program. ✓Algorithm. ✓Flowchart.
Cont.. 3) Choose the interface: Select the objects. Determine how the input will be obtained and how the output will be displayed. Then create appropriate commands to allow the user to control the program. 4) Coding: Coding is the technical word for writing the program, by translate the algorithm into a programming language. For effective coding some of the guide lines which are applied are : ✓ Use of meaningful names and labels of variables, ✓ Simple and clear expressions, ✓ Making use of comments and indenting the code properly, ✓ Avoiding jumps in the program to transfer control.
Cont.. 5) Debugging: At this stage the errors in the programs are detected and corrected. Debugging is also known as program validation. Some common errors which might occur in the programs include: ✓ UN initialization of variables. ✓ Reversing of order of operands. ✓ Confusion of numbers and characters. ✓ Inverting of conditions. Eg: - Jumping on zero instead of on not zero.
Cont.. 6) Testing:- The program is tested on a number of suitable test cases. A test plan of the program has to be done at the stage of the program design itself. This ensures a thorough understanding of the specifications. The most trivial and the most special cases should be identified and tested. It is always useful to include the maximum and minimum values of all variables as test data.
Cont.. 7) Complete the documentation: Organize all the material that describes the program. Documentation is intended to allow another person, or the programmer at a later date, to understand the program. Internal documentation consists of statements in the program that are not executed, but point out the purposes of various parts of the program. Documentation might also consist of a detailed description of what the program does and how to use the program (for instance, what type of input is expected). For commercial programs, documentation includes an instruction manual. Other types of documentation are the ✓Flowchart and ✓Pseudocode
Programming Tools Tools used to convert algorithms into computer programs: 1: Pseudocode: An informal high-level description of the operating principle of a computer program. It uses the structural conventions of a programming language, but is intended for human reading rather than machine reading. 2: Flowcharts: Graphically depict the logical steps to carry out a task and show how the steps relate to each other.
Pseudocode vs Flowcharts Pseudocode • Artificial and Informal language • Helps programmers to plan an algorithm • Similar to everyday English • Not an actual programming language Flowcharts • A graphical way of writing pseudocode • Rounded rectangle –terminal • Parallelogram –input / output • Rectangle –actions • Diamonds –decision / conditional • Circles –connector
Flowchart Symbols
Example Flowchart
Programming Language Generations 1GL or first-generation language: This was (and still is) machine language or the level of instructions and data that the processor is actually given to work on. 2GL or second-generation language: Is assembler(sometimes called "assembly") language. 3GL or third-generation language: Is a "high-level" programming language, such as HTML, C, or Java. A compiler converts the statements of a specific high-level programming language into machine language. A 3GL language requires a considerable amount of programming knowledge. 4GL or fourth-generation language: Is designed to be closer to natural language than a 3GL language. Languages for accessing databases are often described as 4GLs. 5GL or fifth-generation language: Is programming that uses a visual or graphical development interface to create source language that is usually compiled with a 3GL or 4GL language compiler.
This Makes and End of Chapter One Questions…..?

Introduction to computer programming language

  • 1.
  • 2.
    Introduction to Programminglanguage A programming language is a language designed to communicate instructions to a computer. Thus, Programming language is a set of commands, strings or characters readable by programmers but easily translatable to machine code. It has the following ❖ Syntax: Is a set of rules that define how the commands have to be arranged to make sense ❖ Grammar: Is a set of rules of using different punctuation, quotation marks, semicolons, ❖ Semantics: Is a set of meanings assigned to every command of the language and is used to properly translate the program to machine code.
  • 3.
    Classification of Programminglanguage Programming Language can be grouped into three namely; 1)Machine Languages, 2)Assembly Languages and 3)High level Languages.
  • 4.
    1: Machine Language: Machinelanguage is a collection of binary digits or bits that the computer reads and interprets. Machine language is the only language a computer is capable of understanding. Machine level language is a language that supports the machine side of the programming or does not provide human side of the programming. It consists of (binary) zeros and ones.
  • 5.
    2: Assembly Language: Assemblylanguage is easier to use than machine language. An assembler is useful for detecting programming errors. Programmers do not have the absolute address of data items. Assembly language encourage modular programming.
  • 6.
    3: High levellanguage High level language is a language that supports the human and the application sides of the programming. Consequently more programming is now done in high level languages. Examples of high-level languages are ✓ BASIC, ✓ FORTRAN etc.
  • 7.
    Attribute of goodProgramming Language Some of very good characteristics of a good programming language are, ❖ Clarity, Simplicity and Unity: ❖ Orthogonality: ❖ Support for Abstraction: ❖ Programming Environment: ❖ Ease of program verification/Reusability: ❖ Portability of programs:
  • 8.
    Program performance andfeatures of programming languages Performance of a program, including ❑ Reliability, ❑ Readability, ❑ Writability, ❑ Reusability and ❑ Efficiency.
  • 9.
    Programming Development Cycle: Thevarious stages in the development of a computer program are:- ▪Problem Definition. ▪Program Design. ▪Coding. ▪Debugging. ▪Testing. ▪Documentation. ▪Maintenance.
  • 10.
    Cont.. 1) Problem Definition: Inthis step the problem has to be defined formally, by being sure understanding what the program should do, that is, what the output should be. 2) Program Design: The next stage is the program design. The software developer makes use of tools like algorithms and flowcharts to develop the design of the program. ✓Algorithm. ✓Flowchart.
  • 11.
    Cont.. 3) Choose theinterface: Select the objects. Determine how the input will be obtained and how the output will be displayed. Then create appropriate commands to allow the user to control the program. 4) Coding: Coding is the technical word for writing the program, by translate the algorithm into a programming language. For effective coding some of the guide lines which are applied are : ✓ Use of meaningful names and labels of variables, ✓ Simple and clear expressions, ✓ Making use of comments and indenting the code properly, ✓ Avoiding jumps in the program to transfer control.
  • 12.
    Cont.. 5) Debugging: At thisstage the errors in the programs are detected and corrected. Debugging is also known as program validation. Some common errors which might occur in the programs include: ✓ UN initialization of variables. ✓ Reversing of order of operands. ✓ Confusion of numbers and characters. ✓ Inverting of conditions. Eg: - Jumping on zero instead of on not zero.
  • 13.
    Cont.. 6) Testing:- The programis tested on a number of suitable test cases. A test plan of the program has to be done at the stage of the program design itself. This ensures a thorough understanding of the specifications. The most trivial and the most special cases should be identified and tested. It is always useful to include the maximum and minimum values of all variables as test data.
  • 14.
    Cont.. 7) Complete thedocumentation: Organize all the material that describes the program. Documentation is intended to allow another person, or the programmer at a later date, to understand the program. Internal documentation consists of statements in the program that are not executed, but point out the purposes of various parts of the program. Documentation might also consist of a detailed description of what the program does and how to use the program (for instance, what type of input is expected). For commercial programs, documentation includes an instruction manual. Other types of documentation are the ✓Flowchart and ✓Pseudocode
  • 15.
    Programming Tools Tools usedto convert algorithms into computer programs: 1: Pseudocode: An informal high-level description of the operating principle of a computer program. It uses the structural conventions of a programming language, but is intended for human reading rather than machine reading. 2: Flowcharts: Graphically depict the logical steps to carry out a task and show how the steps relate to each other.
  • 16.
    Pseudocode vs Flowcharts Pseudocode •Artificial and Informal language • Helps programmers to plan an algorithm • Similar to everyday English • Not an actual programming language Flowcharts • A graphical way of writing pseudocode • Rounded rectangle –terminal • Parallelogram –input / output • Rectangle –actions • Diamonds –decision / conditional • Circles –connector
  • 17.
  • 18.
  • 19.
    Programming Language Generations 1GLor first-generation language: This was (and still is) machine language or the level of instructions and data that the processor is actually given to work on. 2GL or second-generation language: Is assembler(sometimes called "assembly") language. 3GL or third-generation language: Is a "high-level" programming language, such as HTML, C, or Java. A compiler converts the statements of a specific high-level programming language into machine language. A 3GL language requires a considerable amount of programming knowledge. 4GL or fourth-generation language: Is designed to be closer to natural language than a 3GL language. Languages for accessing databases are often described as 4GLs. 5GL or fifth-generation language: Is programming that uses a visual or graphical development interface to create source language that is usually compiled with a 3GL or 4GL language compiler.
  • 20.
    This Makes andEnd of Chapter One Questions…..?