Mohamed Nuzrath Introduction to Programming Mohamed Nuzrath Mohamed

  • Slides: 19
Download presentation
© Mohamed Nuzrath Introduction to Programming Mohamed Nuzrath

© Mohamed Nuzrath Introduction to Programming Mohamed Nuzrath

© Mohamed Nuzrath What is a Computer Program? � Set of Instructions � Written

© Mohamed Nuzrath What is a Computer Program? � Set of Instructions � Written � In in a computer programming language order to carryout/ do a job/task

© Mohamed Nuzrath What is Programming? � The Process of Developing a Computer Program

© Mohamed Nuzrath What is Programming? � The Process of Developing a Computer Program

© Mohamed Nuzrath Who is a Programmer? �A Person who writes/develops a software/ program.

© Mohamed Nuzrath Who is a Programmer? �A Person who writes/develops a software/ program.

© Mohamed Nuzrath Is Programming Difficult ?

© Mohamed Nuzrath Is Programming Difficult ?

© Mohamed Nuzrath Which Programming Language is Best

© Mohamed Nuzrath Which Programming Language is Best

Types of Languages © Mohamed Nuzrath How Human/Natural Language is Constructed A-Z a-z 0

Types of Languages © Mohamed Nuzrath How Human/Natural Language is Constructed A-Z a-z 0 -9 +-/% WORD Spelling mistakes 4 x. Appl should be Apple SENTENCE PARAGRAPH Grammatical Mistakes She go to school – should be she goes to school

© Mohamed Nuzrath How a Computer Programming Language is constructed A-Z a-z 0 -9

© Mohamed Nuzrath How a Computer Programming Language is constructed A-Z a-z 0 -9 {}[], ; *%=+ COMMAND Syntax Errors: in java the key word while is written as While or WHILE SATEMENT / INSTRUCTION Logical Errors: PROGRAM average = n 1+n 2+n 3/3 ; Should be Average = (n 1+n 2+n 3)/3

© Mohamed Nuzrath Software Development Methods Structured Programming Object Oriented Programming

© Mohamed Nuzrath Software Development Methods Structured Programming Object Oriented Programming

© Mohamed Nuzrath What is Structured Programming �A � software development discipline/methodology which produces

© Mohamed Nuzrath What is Structured Programming �A � software development discipline/methodology which produces easy to maintainable software

Why is it Easy to Maintain? � Because © Mohamed Nuzrath this approach has

Why is it Easy to Maintain? � Because © Mohamed Nuzrath this approach has two features: A Modularized Approach Use of only the Basic 3 Control Constructs SEQUENCE , SELECTION & REPETITION and avoids GOTO or Branching

Modularized Approach © Mohamed Nuzrath LIBRARY SYSTEM REGISTRATIONS SITUTAION X AMEND DETAILS REMOVE MEMBER

Modularized Approach © Mohamed Nuzrath LIBRARY SYSTEM REGISTRATIONS SITUTAION X AMEND DETAILS REMOVE MEMBER SITUTAION 1 SITUATION 2 SITUTAION Y SITUTAION Z Modules

© Mohamed Nuzrath What is Modularized Approach ? � Structured programming is Problem based

© Mohamed Nuzrath What is Modularized Approach ? � Structured programming is Problem based That is at the beginning you take the whole system as a problem, then identify sub problems and then sub-sub problems You keep on continuing this until you can’t break a problem anymore. Each module is an Independent Unit so making modifications to one module is easier and it does not have any side effects/ripple on other modules

© Mohamed Nuzrath What is Branching GOTO 270 GOTO 45 GOTO 22

© Mohamed Nuzrath What is Branching GOTO 270 GOTO 45 GOTO 22

Basic 3 Control Constructs SEQUENCE SELECTION REPETITION © Mohamed Nuzrath

Basic 3 Control Constructs SEQUENCE SELECTION REPETITION © Mohamed Nuzrath

© Mohamed Nuzrath SEQUENCE Instructions will be executed in the given order Example :

© Mohamed Nuzrath SEQUENCE Instructions will be executed in the given order Example : Start Input n 1, n 2, n 3 Tot = n 1+n 2+n 3 Display Tot Stop

SELECTION © Mohamed Nuzrath Represents a choice between two or more actions Example :

SELECTION © Mohamed Nuzrath Represents a choice between two or more actions Example : Start Input avg. Marks If avg. Marks >= 50 Then Display “PASS” Else Display “FAIL” End If Stop

REPETITION / ITERATION © Mohamed Nuzrath Set of instructions are to be executed repeatedly

REPETITION / ITERATION © Mohamed Nuzrath Set of instructions are to be executed repeatedly based on a condition Example : Start Count = 1 While Count <= 6 Display Count=Count+1 End While Stop

? Do you have any I do not fear the man who practices 10,

? Do you have any I do not fear the man who practices 10, 000 kicks But I do fear the man who practices 1 kick 10, 000 times © Mohamed Nuzrath