SlideShare a Scribd company logo
1 of 49
Program Design &
               Problem-Solving
                    Techniques
             Module Pre-Requisites:
             None




http://ashesh.ramjeeawon.info
Management Student/ Freelance Developer
University of Mauritius                   1
Problem Solving – Program Design: Algorithm /Pseudocode


Today’s Session

 Steps in program development
 Algorithmic Problem Solving
 How to write Pseudocode?
 Meaningful names
 Structure Theorem
 Communication between modules
 Module Cohesion and Coupling
 Sequential File update
                                                              2
Problem Solving – Program Design: Algorithm /Pseudocode


Problem Solving - Big Problemo!!!




                                                               3
Problem Solving – Program Design: Algorithm /Pseudocode


How Do We Write a Program?

 A computer is not intelligent. It cannot analyze a problem and come up with a
  solution. A human (the programmer) must analyze the problem, develop the
  instructions for solving the problem, and then have the computer carry out the
  instructions.
 To write a program for a computer to follow, we must go through a two-phase
  process: problem solving and implementation




                                                                                   4
Problem Solving – Program Design: Algorithm /Pseudocode


Problem-Solving Phase
 Analysis and Specification. Understand (define) the problem and
  what the solution must do.

 General Solution (Algorithm). Specify the required data types and
  the logical sequences of steps that solve the problem.

 Verify. Follow the steps exactly to see if the solution really does
  solve the problem.




                                                                        5
Problem Solving – Program Design: Algorithm /Pseudocode


Implementation Phase
 Concrete Solution (Program). Translate the algorithm (the general
  solution) into a programming language.

 Test. Have the computer follow the instructions. Then manually
  check the results. If you find errors, analyze the program and the
  algorithm to determine the source of the errors, and then make
  corrections.

 Once a program has been written, it enters a third phase:
  maintenance.




                                                                       6
Problem Solving – Program Design: Algorithm /Pseudocode


Maintenance Phase
 Use. Use the program.

 Maintain. Modify the program to meet changing requirements or to
  correct any errors that show up while using it.

 The programmer begins the programming process by analyzing the
  problem, breaking it into manageable pieces, and developing a
  general solution for each piece called an algorithm. The solutions to
  the pieces are collected together to form a program that solves the
  original problem. Understanding and analyzing a problem take up
  much more time than Figure 1.1 implies. They are the heart of the
  programming process.




                                                                          7
Problem Solving – Program Design: Algorithm /Pseudocode




                                                          8
Problem Solving – Program Design: Algorithm /Pseudocode


Compiler and Interpreters




                                                               9
Steps in program development



Ref:

                                      10
Problem Solving – Program Design: Algorithm /Pseudocode


Steps in program development

1. Define the problem into three separate
   components:
   inputs
   outputs
   processing steps to produce required outputs.




                                                              11
Problem Solving – Program Design: Algorithm /Pseudocode


Steps in program development



 1. Outline the solution.
     Decompose the problem to smaller steps.
     Establish a solution outline.
     Initial outline may include:
          major processing steps involved
          major subtasks
          user interface
          major control structures
          major variable and record structures
          mainline logic
                                                              12
Problem Solving – Program Design: Algorithm /Pseudocode


Steps in program development

1. Develop the outline into an algorithm.
   The solution outline is now expanded into an
    algorithm.
      What is an algorithm? – a set of precise steps that
       describe exactly the tasks to be performed and the
       order in which they are to be carried out.
      Pseudocode will be used to represent the solution
       algorithm




                                                              13
Problem Solving – Program Design: Algorithm /Pseudocode



Steps in program development

1. Test the algorithm for correctness.
   Very important in the development of a
    program, but often forgotten
   Major logic errors can be detected and
    corrected at an early stage
   Go through the algorithm step-by-step with
    test data to ensure the program will actually
    do what it is supposed to do.


                                                              14
Problem Solving – Program Design: Algorithm /Pseudocode



Steps in program development
1. Code the algorithm into a specific
   programming language.
   Start to code the program into a chosen
    programming language after all design
    considerations from Steps 1–4 are met.




                                                              15
Problem Solving – Program Design: Algorithm /Pseudocode



Steps in program development
1. Run the program on the computer.
   This step uses a program compiler and
    programmer-designed test data to machine-
    test the code for
      syntax errors
      logic errors




                                                              16
Problem Solving – Program Design: Algorithm /Pseudocode



Steps in program development
1. Document and maintain the program.
   Is really an ongoing task from the initial
    definition of the problem to the final test
   Documentation involves:
      external documentation
      internal documentation




                                                              17
Problem Solving – Program Design: Algorithm /Pseudocode




     Algorithmic Problem Solving




                                                          18
Problem Solving – Program Design: Algorithm /Pseudocode


An introduction to algorithms and pseudocode

 What is an algorithm?
  Lists the steps involved in accomplishing a task
   (like a recipe)
  Defined in programming terms as ‘a set of
   detailed and ordered instructions developed to
   describe the processes necessary to produce
   the desired output from a given input’




                                                              19
Problem Solving – Program Design: Algorithm /Pseudocode


An introduction to algorithms and pseudocode

 What is an algorithm?
  An algorithm must:
      Be lucid, precise and unambiguous
      Give the correct solution in all cases
      Eventually end




                                                              20
Problem Solving – Program Design: Algorithm /Pseudocode


An introduction to algorithms and pseudocode

 What is pseudocode?
  Structured English (formalised and abbreviated
   to look like high-level computer language)




                                                              21
Problem Solving – Program Design: Algorithm /Pseudocode

How to write pseudocode


 There are six basic computer operations:
  1. A computer can receive information
  2. A computer can put out information
  3. A computer can perform arithmetic
  4. A computer can assign a value to a variable or
     memory location
  5. A computer can compare two variables and
     select one of two alternate actions
  6. A computer can repeat a group of actions
                                                             22
Problem Solving – Program Design: Algorithm /Pseudocode


Exercise Time

 Do some reading on the website below:
 http://www.cs.dartmouth.edu/~fabio/teaching/c




                                                              23
Problem Solving – Program Design: Algorithm /Pseudocode


Meaningful names

 When designing an algorithm, a
  programmer must introduce some unique
  names which represents variables or
  objects in the problem.
 Names should be meaningful.
 Names should be transparent to
  adequately describe variables (Number1,
  number2, etc.).

                                                              24
Problem Solving – Program Design: Algorithm /Pseudocode


Meaningful names

 Underscore is used when using more than
  one word (sales_tax or word_count).
 Most programming language does not
  tolerate a space in a variable as space
  would signal the end of a variable name.
 Another method is to use capital letters as
  a word separator (salesTax or
  wordCount).

                                                              25
Problem Solving – Program Design: Algorithm /Pseudocode


The Structure Theorem




                                                              26
Problem Solving – Program Design: Algorithm /Pseudocode


The Structure Theorem

1. Sequence
   Straightforward execution of one processing
    step after another
   Represents the first four basic computer
    operations
     1.   Receive information
     2.   Put out information
     3.   Perform arithmetic
     4.   Assign values


                                                              27
Problem Solving – Program Design: Algorithm /Pseudocode


The Structure Theorem

   A typical sequence statement in an algorithm might
    read:
             Add 1 to pageCount
             Print heading line1
             Print heading line2
             Set lineCount to zero
             Read customer record
   These instructions illustrate the sequence control
    structure as a straightforward list of steps written one
    after the other, in a top-to-bottom fashion

                                                               28
Problem Solving – Program Design: Algorithm /Pseudocode


The Structure Theorem



 1. Selection
     Presentation of a condition and the choice
      between two actions, the choice depending
      on whether the condition is true or false
     Represents the decision-making abilities of
      the computer
     Illustrates the fifth basic computer operation –
      compare two variables and select one of two
      alternate actions
                                                              29
Problem Solving – Program Design: Algorithm /Pseudocode


The Structure Theorem

   In pseudocode, selection is represented by the
    keywords IF, THEN, ELSE and ENDIF
             IF condition p is true THEN
                     statement(s) in true case
             ELSE
                     statement(s) in false case
             ENDIF
   If condition p is true, then the statement in true case will
    be executed, and the statement in the false case will be
    skipped (vice versa)



                                                               30
Problem Solving – Program Design: Algorithm /Pseudocode


The Structure Theorem

1. Repetition
   Presentation of a set of instruction to be
    performed repeatedly, as long as the condition
    is true
   Block statement is executed again and again
    until a terminating condition occurs
   Illustrates the sixth basic computer operation
    – to repeat a group of actions.



                                                              31
Problem Solving – Program Design: Algorithm /Pseudocode


The Structure Theorem

 Written in pseudocode as:
            DOWHILE condition p is true
                statement block
            ENDDO
 DOWHILE is a leading decision loop – condition
  is tested before any statements are executed
 ENDDO triggers a return of control to the
  retesting of the condition
 Condition is true, statements are repeated until
  condition is found false
                                                              32
Problem Solving – Program Design: Algorithm /Pseudocode


Exercise Time

 In a complete program/ algorithm, show
  the 3 concepts of Structure Theorem




                                                              33
Problem Solving – Program Design: Algorithm /Pseudocode



Communication between modules
 Necessary to consider flow of information
  between modules
 This flow of information is called
  ‘intermodule communication’ and can be
  accomplished by the scope of the variable




                                                              34
Problem Solving – Program Design: Algorithm /Pseudocode



Communication between modules
 Scope of a variable
  The portion of a program in which that variable
   has been defined and to which it can be
   referenced
  Variables can be global where the scope of the
   variable is the whole program
  Scope of the variable is simple the module
   which it is defined


                                                              35
Problem Solving – Program Design: Algorithm /Pseudocode



Communication between modules
 Global data
  Date that can be used by all the modules in a
   program
  Every module in the program can access and
   change data
  Lifetime of a global variable spans the
   execution of the whole program



                                                              36
Problem Solving – Program Design: Algorithm /Pseudocode



Communication between modules
 Local data
  Variable are defined within the submodule are
   called local variables
  The scope of a local variable is simply the
   module in which it is defined
  The lifetime of a local variable is limited to the
   execution of the single submodule in which it is
   defined


                                                              37
Problem Solving – Program Design: Algorithm /Pseudocode


Exercise time

Show the difference between a global
 variable and a local variable via the use of
 a program, in any language of your
 choice.




                                                              38
Problem Solving – Program Design: Algorithm /Pseudocode



Communication between modules
 Side effects
  Side effect is a form of a cross-communication
   of a module with other parts of a program,
  Occurs when a subordinate module alters the
   value of a global variable inside a module




                                                              39
Problem Solving – Program Design: Algorithm /Pseudocode



Communication between modules
 Passing parameters
  Parameters are simply data items
   transferred from a calling module to its
   subordinate module at the time of calling
  To pass parameters between modules, two
   things can happen:
      The calling module must name the parameters
       that it wants to pass to the submodule
      The submodule must be able to receive those
       parameters and return them to the calling module
       if required

                                                            40
Problem Solving – Program Design: Algorithm /Pseudocode



Communication between modules
 Formal and actual parameters
  Parameters names that appear when a
   submodule is defined are known as formal
   parameters
  Variables and expressions that are passed to a
   submodule in a particular call are called actual
   parameters




                                                              41
Problem Solving – Program Design: Algorithm /Pseudocode



Communication between modules
 Value and reference parameters
   Parameters may have one of three function:
     1. To pass information from a calling module to a
        subordinate module
     2. To pass information from a subordinate module to
        its calling module
     3. To fulfil a two-way communication role




                                                              42
Problem Solving – Program Design: Algorithm /Pseudocode



Communication between modules
 Value and reference parameters
  Value parameters
      Value parameters pass a copy of the value of a
       parameter from one module to another
  Reference parameters
      Reference parameter pass the memory address of a
       parameter from one module to another




                                                              43
Problem Solving – Program Design: Algorithm /Pseudocode


Module cohesion

 Cohesion is a measure of the internal
  strength of a module
 It indicates how closely the elements or
  the statements of a module are associated
  with each other
 The more closely the elements of a
  module are associated with each other,
  the higher the cohesion of the module

                                                              44
Problem Solving – Program Design: Algorithm /Pseudocode


Module coupling


  Coupling is a measure of the extent of
   information interchange between
   modules
  Tight coupling implies large
   dependence on the structure of one
   module by another
  Loose coupling is the opposite of tight
   coupling. Modules with loose coupling
   are more independent and easier to
   maintain
                                                              45
Problem Solving – Program Design: Algorithm /Pseudocode


Sequential file update



  Master file
    Is a file that contains permanent and semi-
     permanent information about the data
     entities it contains
  Transaction file
    Contains all the data and activities that are
     included on the master file. These are
     transactions to:
         Add a new record
         Update or change an existing record
         Delete an existing record                            46
Problem Solving – Program Design: Algorithm /Pseudocode


Sequential file update



  Sequential update logic
     Sequential processing falls generally into
      three categories:
        1. If the key on the transaction record is less than the
           key on the old master record, the transaction is
           probably an add transaction
        2. If they key on the transaction record is equal to the
           key on the old master record, the transaction is
           probably an update or delete transaction
        3. If the key on the transaction record is greater that
           the key on the old master record, there is not
           matching transaction for that master record             47
Problem Solving – Program Design: Algorithm /Pseudocode


The End – Thank you for your kind attention

 References:
   Simple Program Design – A step by step
    approach by L. A. Robertson




                                                               48
Problem Solving – Program Design: Algorithm /Pseudocode




         http://ashesh.ramjeeawon.info
         Management Student/ Freelance Developer
         University of Mauritius
         BCS Student Member




                                                          49

More Related Content

What's hot

Introduction to data structures and Algorithm
Introduction to data structures and AlgorithmIntroduction to data structures and Algorithm
Introduction to data structures and AlgorithmDhaval Kaneria
 
Chapter 13 software testing strategies
Chapter 13 software testing strategiesChapter 13 software testing strategies
Chapter 13 software testing strategiesSHREEHARI WADAWADAGI
 
5. ch 4-principles that guide practice
5. ch 4-principles that guide practice5. ch 4-principles that guide practice
5. ch 4-principles that guide practiceDelowar hossain
 
Chapter 1 2 - some size factors
Chapter 1   2 - some size factorsChapter 1   2 - some size factors
Chapter 1 2 - some size factorsNancyBeaulah_R
 
Chapter 8 software testing
Chapter 8 software testingChapter 8 software testing
Chapter 8 software testingdespicable me
 
Design Concept software engineering
Design Concept software engineeringDesign Concept software engineering
Design Concept software engineeringDarshit Metaliya
 
Software Engineering - Ch1
Software Engineering - Ch1Software Engineering - Ch1
Software Engineering - Ch1Siddharth Ayer
 
Quality and productivity factors
Quality and productivity factorsQuality and productivity factors
Quality and productivity factorsNancyBeaulah_R
 
Organization and team structures
Organization and team structuresOrganization and team structures
Organization and team structuresNur Islam
 
Pseudocode & flowchart examples
Pseudocode & flowchart examplesPseudocode & flowchart examples
Pseudocode & flowchart exampleshayrikk
 
Incremental model
Incremental modelIncremental model
Incremental modelHpibmx
 
Software Measurement and Metrics.pptx
Software Measurement and Metrics.pptxSoftware Measurement and Metrics.pptx
Software Measurement and Metrics.pptxubaidullah75790
 
Software Engineering Fundamentals
Software Engineering FundamentalsSoftware Engineering Fundamentals
Software Engineering FundamentalsRahul Sudame
 
Rapid Application Development Model
Rapid Application Development ModelRapid Application Development Model
Rapid Application Development ModelDamian T. Gordon
 

What's hot (20)

Flowshop scheduling
Flowshop schedulingFlowshop scheduling
Flowshop scheduling
 
Introduction to data structures and Algorithm
Introduction to data structures and AlgorithmIntroduction to data structures and Algorithm
Introduction to data structures and Algorithm
 
Chapter 13 software testing strategies
Chapter 13 software testing strategiesChapter 13 software testing strategies
Chapter 13 software testing strategies
 
5. ch 4-principles that guide practice
5. ch 4-principles that guide practice5. ch 4-principles that guide practice
5. ch 4-principles that guide practice
 
Chapter 1 2 - some size factors
Chapter 1   2 - some size factorsChapter 1   2 - some size factors
Chapter 1 2 - some size factors
 
Incremental Model
Incremental ModelIncremental Model
Incremental Model
 
Chapter 8 software testing
Chapter 8 software testingChapter 8 software testing
Chapter 8 software testing
 
Design Concept software engineering
Design Concept software engineeringDesign Concept software engineering
Design Concept software engineering
 
Software design
Software designSoftware design
Software design
 
Software Engineering - Ch1
Software Engineering - Ch1Software Engineering - Ch1
Software Engineering - Ch1
 
Quality and productivity factors
Quality and productivity factorsQuality and productivity factors
Quality and productivity factors
 
Organization and team structures
Organization and team structuresOrganization and team structures
Organization and team structures
 
Design techniques
Design techniquesDesign techniques
Design techniques
 
Pseudocode & flowchart examples
Pseudocode & flowchart examplesPseudocode & flowchart examples
Pseudocode & flowchart examples
 
Incremental model
Incremental modelIncremental model
Incremental model
 
Software quality
Software qualitySoftware quality
Software quality
 
Software Measurement and Metrics.pptx
Software Measurement and Metrics.pptxSoftware Measurement and Metrics.pptx
Software Measurement and Metrics.pptx
 
Software Engineering Fundamentals
Software Engineering FundamentalsSoftware Engineering Fundamentals
Software Engineering Fundamentals
 
Rapid Application Development Model
Rapid Application Development ModelRapid Application Development Model
Rapid Application Development Model
 
Anomalies in database
Anomalies in databaseAnomalies in database
Anomalies in database
 

Similar to Program Design Problem Solving Techniques

Chapter 2(1)
Chapter 2(1)Chapter 2(1)
Chapter 2(1)TejaswiB4
 
Stnotes doc 5
Stnotes doc 5Stnotes doc 5
Stnotes doc 5Alok Jain
 
PCCF UNIT 1.pptx
PCCF UNIT 1.pptxPCCF UNIT 1.pptx
PCCF UNIT 1.pptxDivyaKS12
 
Fundamentals of programming with C++
Fundamentals of programming with C++Fundamentals of programming with C++
Fundamentals of programming with C++Seble Nigussie
 
Programming_Lecture_1.pptx
Programming_Lecture_1.pptxProgramming_Lecture_1.pptx
Programming_Lecture_1.pptxshoaibkhan716300
 
Introduction to Computer Programming
Introduction to Computer ProgrammingIntroduction to Computer Programming
Introduction to Computer ProgrammingProf. Erwin Globio
 
Lesson 14 computer system sofware
Lesson 14 computer system sofwareLesson 14 computer system sofware
Lesson 14 computer system sofwareguevarra_2000
 
Lesson 14 computer system sofware
Lesson 14 computer system sofwareLesson 14 computer system sofware
Lesson 14 computer system sofwareguevarra_2000
 
C programming for Computing Techniques
C programming for Computing TechniquesC programming for Computing Techniques
C programming for Computing TechniquesAppili Vamsi Krishna
 
Unit 1 python (2021 r)
Unit 1 python (2021 r)Unit 1 python (2021 r)
Unit 1 python (2021 r)praveena p
 
Algorithm,Pseudocode,Flowchart.pptx
Algorithm,Pseudocode,Flowchart.pptxAlgorithm,Pseudocode,Flowchart.pptx
Algorithm,Pseudocode,Flowchart.pptxDrThenmozhiKarunanit
 

Similar to Program Design Problem Solving Techniques (20)

Chapter 2(1)
Chapter 2(1)Chapter 2(1)
Chapter 2(1)
 
Algorithm to programs.pptx
Algorithm to programs.pptxAlgorithm to programs.pptx
Algorithm to programs.pptx
 
PROBLEM SOLVING
PROBLEM SOLVINGPROBLEM SOLVING
PROBLEM SOLVING
 
Stnotes doc 5
Stnotes doc 5Stnotes doc 5
Stnotes doc 5
 
PCCF UNIT 1.pptx
PCCF UNIT 1.pptxPCCF UNIT 1.pptx
PCCF UNIT 1.pptx
 
Fundamentals of programming with C++
Fundamentals of programming with C++Fundamentals of programming with C++
Fundamentals of programming with C++
 
Programming_Lecture_1.pptx
Programming_Lecture_1.pptxProgramming_Lecture_1.pptx
Programming_Lecture_1.pptx
 
Week10 final
Week10 finalWeek10 final
Week10 final
 
Chapter 01.PPT
Chapter 01.PPTChapter 01.PPT
Chapter 01.PPT
 
CHAPTER 1
CHAPTER 1CHAPTER 1
CHAPTER 1
 
Introduction to Computer Programming
Introduction to Computer ProgrammingIntroduction to Computer Programming
Introduction to Computer Programming
 
Introduction.pptx
Introduction.pptxIntroduction.pptx
Introduction.pptx
 
Lesson 14 computer system sofware
Lesson 14 computer system sofwareLesson 14 computer system sofware
Lesson 14 computer system sofware
 
Lesson 14 computer system sofware
Lesson 14 computer system sofwareLesson 14 computer system sofware
Lesson 14 computer system sofware
 
C programming for Computing Techniques
C programming for Computing TechniquesC programming for Computing Techniques
C programming for Computing Techniques
 
Unit 1 python (2021 r)
Unit 1 python (2021 r)Unit 1 python (2021 r)
Unit 1 python (2021 r)
 
Algorithm,Pseudocode,Flowchart.pptx
Algorithm,Pseudocode,Flowchart.pptxAlgorithm,Pseudocode,Flowchart.pptx
Algorithm,Pseudocode,Flowchart.pptx
 
Chapter 1
Chapter 1Chapter 1
Chapter 1
 
Programming part2
Programming part2Programming part2
Programming part2
 
Notacd081
Notacd081Notacd081
Notacd081
 

More from Dokka Srinivasu

Baby ganesha sitting on the lap of lord shiva and mother parvathi vintage baz...
Baby ganesha sitting on the lap of lord shiva and mother parvathi vintage baz...Baby ganesha sitting on the lap of lord shiva and mother parvathi vintage baz...
Baby ganesha sitting on the lap of lord shiva and mother parvathi vintage baz...Dokka Srinivasu
 
18 principles for successful life
18 principles for successful life18 principles for successful life
18 principles for successful lifeDokka Srinivasu
 
My first seminar on indian heritage and culture
My first seminar on indian heritage and cultureMy first seminar on indian heritage and culture
My first seminar on indian heritage and cultureDokka Srinivasu
 
Ayurveda science of healing
Ayurveda science of healingAyurveda science of healing
Ayurveda science of healingDokka Srinivasu
 
Maithreem Bhajatha song by smt. m.s. subbulakshmi at united nations
Maithreem Bhajatha song by smt. m.s. subbulakshmi at united nationsMaithreem Bhajatha song by smt. m.s. subbulakshmi at united nations
Maithreem Bhajatha song by smt. m.s. subbulakshmi at united nationsDokka Srinivasu
 
Lord shiva with young ganesh mythological post card
Lord shiva with young ganesh mythological post cardLord shiva with young ganesh mythological post card
Lord shiva with young ganesh mythological post cardDokka Srinivasu
 
India's Sanathana Dharma
India's Sanathana DharmaIndia's Sanathana Dharma
India's Sanathana DharmaDokka Srinivasu
 
Why to Follow Vedic Path?
Why to Follow Vedic Path?Why to Follow Vedic Path?
Why to Follow Vedic Path?Dokka Srinivasu
 
Vision and Approaches of Upanishads
Vision and Approaches of UpanishadsVision and Approaches of Upanishads
Vision and Approaches of UpanishadsDokka Srinivasu
 
The role of Hindu Dharma & Our role in Hindu Dharma
The role of Hindu Dharma & Our role in Hindu Dharma The role of Hindu Dharma & Our role in Hindu Dharma
The role of Hindu Dharma & Our role in Hindu Dharma Dokka Srinivasu
 
Vintage cigarette cards of maharajas of india
Vintage cigarette cards of maharajas of indiaVintage cigarette cards of maharajas of india
Vintage cigarette cards of maharajas of indiaDokka Srinivasu
 

More from Dokka Srinivasu (20)

Baby ganesha sitting on the lap of lord shiva and mother parvathi vintage baz...
Baby ganesha sitting on the lap of lord shiva and mother parvathi vintage baz...Baby ganesha sitting on the lap of lord shiva and mother parvathi vintage baz...
Baby ganesha sitting on the lap of lord shiva and mother parvathi vintage baz...
 
18 principles for successful life
18 principles for successful life18 principles for successful life
18 principles for successful life
 
My first seminar on indian heritage and culture
My first seminar on indian heritage and cultureMy first seminar on indian heritage and culture
My first seminar on indian heritage and culture
 
Recipe of joyous life
Recipe of joyous lifeRecipe of joyous life
Recipe of joyous life
 
Ayurveda science of healing
Ayurveda science of healingAyurveda science of healing
Ayurveda science of healing
 
Chakras
ChakrasChakras
Chakras
 
Maithreem Bhajatha song by smt. m.s. subbulakshmi at united nations
Maithreem Bhajatha song by smt. m.s. subbulakshmi at united nationsMaithreem Bhajatha song by smt. m.s. subbulakshmi at united nations
Maithreem Bhajatha song by smt. m.s. subbulakshmi at united nations
 
Louis Braille
Louis BrailleLouis Braille
Louis Braille
 
Lord shiva with young ganesh mythological post card
Lord shiva with young ganesh mythological post cardLord shiva with young ganesh mythological post card
Lord shiva with young ganesh mythological post card
 
Taj mahal post card
Taj mahal post cardTaj mahal post card
Taj mahal post card
 
Srirama navami festival
Srirama navami festivalSrirama navami festival
Srirama navami festival
 
Foundations of Hinduism
Foundations of HinduismFoundations of Hinduism
Foundations of Hinduism
 
India's Sanathana Dharma
India's Sanathana DharmaIndia's Sanathana Dharma
India's Sanathana Dharma
 
sanathana dharma
sanathana dharmasanathana dharma
sanathana dharma
 
Why to Follow Vedic Path?
Why to Follow Vedic Path?Why to Follow Vedic Path?
Why to Follow Vedic Path?
 
Vision and Approaches of Upanishads
Vision and Approaches of UpanishadsVision and Approaches of Upanishads
Vision and Approaches of Upanishads
 
Hindu Scriptures
Hindu Scriptures Hindu Scriptures
Hindu Scriptures
 
The role of Hindu Dharma & Our role in Hindu Dharma
The role of Hindu Dharma & Our role in Hindu Dharma The role of Hindu Dharma & Our role in Hindu Dharma
The role of Hindu Dharma & Our role in Hindu Dharma
 
Mahatma Gandhi
Mahatma GandhiMahatma Gandhi
Mahatma Gandhi
 
Vintage cigarette cards of maharajas of india
Vintage cigarette cards of maharajas of indiaVintage cigarette cards of maharajas of india
Vintage cigarette cards of maharajas of india
 

Recently uploaded

Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfchloefrazer622
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Disha Kariya
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...fonyou31
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpinRaunakKeshri1
 
The byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxThe byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxShobhayan Kirtania
 

Recently uploaded (20)

Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdf
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
The byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxThe byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptx
 

Program Design Problem Solving Techniques

  • 1. Program Design & Problem-Solving Techniques Module Pre-Requisites: None http://ashesh.ramjeeawon.info Management Student/ Freelance Developer University of Mauritius 1
  • 2. Problem Solving – Program Design: Algorithm /Pseudocode Today’s Session  Steps in program development  Algorithmic Problem Solving  How to write Pseudocode?  Meaningful names  Structure Theorem  Communication between modules  Module Cohesion and Coupling  Sequential File update 2
  • 3. Problem Solving – Program Design: Algorithm /Pseudocode Problem Solving - Big Problemo!!! 3
  • 4. Problem Solving – Program Design: Algorithm /Pseudocode How Do We Write a Program?  A computer is not intelligent. It cannot analyze a problem and come up with a solution. A human (the programmer) must analyze the problem, develop the instructions for solving the problem, and then have the computer carry out the instructions.  To write a program for a computer to follow, we must go through a two-phase process: problem solving and implementation 4
  • 5. Problem Solving – Program Design: Algorithm /Pseudocode Problem-Solving Phase  Analysis and Specification. Understand (define) the problem and what the solution must do.  General Solution (Algorithm). Specify the required data types and the logical sequences of steps that solve the problem.  Verify. Follow the steps exactly to see if the solution really does solve the problem. 5
  • 6. Problem Solving – Program Design: Algorithm /Pseudocode Implementation Phase  Concrete Solution (Program). Translate the algorithm (the general solution) into a programming language.  Test. Have the computer follow the instructions. Then manually check the results. If you find errors, analyze the program and the algorithm to determine the source of the errors, and then make corrections.  Once a program has been written, it enters a third phase: maintenance. 6
  • 7. Problem Solving – Program Design: Algorithm /Pseudocode Maintenance Phase  Use. Use the program.  Maintain. Modify the program to meet changing requirements or to correct any errors that show up while using it.  The programmer begins the programming process by analyzing the problem, breaking it into manageable pieces, and developing a general solution for each piece called an algorithm. The solutions to the pieces are collected together to form a program that solves the original problem. Understanding and analyzing a problem take up much more time than Figure 1.1 implies. They are the heart of the programming process. 7
  • 8. Problem Solving – Program Design: Algorithm /Pseudocode 8
  • 9. Problem Solving – Program Design: Algorithm /Pseudocode Compiler and Interpreters 9
  • 10. Steps in program development Ref: 10
  • 11. Problem Solving – Program Design: Algorithm /Pseudocode Steps in program development 1. Define the problem into three separate components:  inputs  outputs  processing steps to produce required outputs. 11
  • 12. Problem Solving – Program Design: Algorithm /Pseudocode Steps in program development 1. Outline the solution.  Decompose the problem to smaller steps.  Establish a solution outline.  Initial outline may include:  major processing steps involved  major subtasks  user interface  major control structures  major variable and record structures  mainline logic 12
  • 13. Problem Solving – Program Design: Algorithm /Pseudocode Steps in program development 1. Develop the outline into an algorithm.  The solution outline is now expanded into an algorithm.  What is an algorithm? – a set of precise steps that describe exactly the tasks to be performed and the order in which they are to be carried out.  Pseudocode will be used to represent the solution algorithm 13
  • 14. Problem Solving – Program Design: Algorithm /Pseudocode Steps in program development 1. Test the algorithm for correctness.  Very important in the development of a program, but often forgotten  Major logic errors can be detected and corrected at an early stage  Go through the algorithm step-by-step with test data to ensure the program will actually do what it is supposed to do. 14
  • 15. Problem Solving – Program Design: Algorithm /Pseudocode Steps in program development 1. Code the algorithm into a specific programming language.  Start to code the program into a chosen programming language after all design considerations from Steps 1–4 are met. 15
  • 16. Problem Solving – Program Design: Algorithm /Pseudocode Steps in program development 1. Run the program on the computer.  This step uses a program compiler and programmer-designed test data to machine- test the code for  syntax errors  logic errors 16
  • 17. Problem Solving – Program Design: Algorithm /Pseudocode Steps in program development 1. Document and maintain the program.  Is really an ongoing task from the initial definition of the problem to the final test  Documentation involves:  external documentation  internal documentation 17
  • 18. Problem Solving – Program Design: Algorithm /Pseudocode  Algorithmic Problem Solving 18
  • 19. Problem Solving – Program Design: Algorithm /Pseudocode An introduction to algorithms and pseudocode  What is an algorithm? Lists the steps involved in accomplishing a task (like a recipe) Defined in programming terms as ‘a set of detailed and ordered instructions developed to describe the processes necessary to produce the desired output from a given input’ 19
  • 20. Problem Solving – Program Design: Algorithm /Pseudocode An introduction to algorithms and pseudocode  What is an algorithm? An algorithm must:  Be lucid, precise and unambiguous  Give the correct solution in all cases  Eventually end 20
  • 21. Problem Solving – Program Design: Algorithm /Pseudocode An introduction to algorithms and pseudocode  What is pseudocode? Structured English (formalised and abbreviated to look like high-level computer language) 21
  • 22. Problem Solving – Program Design: Algorithm /Pseudocode How to write pseudocode  There are six basic computer operations: 1. A computer can receive information 2. A computer can put out information 3. A computer can perform arithmetic 4. A computer can assign a value to a variable or memory location 5. A computer can compare two variables and select one of two alternate actions 6. A computer can repeat a group of actions 22
  • 23. Problem Solving – Program Design: Algorithm /Pseudocode Exercise Time  Do some reading on the website below:  http://www.cs.dartmouth.edu/~fabio/teaching/c 23
  • 24. Problem Solving – Program Design: Algorithm /Pseudocode Meaningful names  When designing an algorithm, a programmer must introduce some unique names which represents variables or objects in the problem.  Names should be meaningful.  Names should be transparent to adequately describe variables (Number1, number2, etc.). 24
  • 25. Problem Solving – Program Design: Algorithm /Pseudocode Meaningful names  Underscore is used when using more than one word (sales_tax or word_count).  Most programming language does not tolerate a space in a variable as space would signal the end of a variable name.  Another method is to use capital letters as a word separator (salesTax or wordCount). 25
  • 26. Problem Solving – Program Design: Algorithm /Pseudocode The Structure Theorem 26
  • 27. Problem Solving – Program Design: Algorithm /Pseudocode The Structure Theorem 1. Sequence  Straightforward execution of one processing step after another  Represents the first four basic computer operations 1. Receive information 2. Put out information 3. Perform arithmetic 4. Assign values 27
  • 28. Problem Solving – Program Design: Algorithm /Pseudocode The Structure Theorem  A typical sequence statement in an algorithm might read: Add 1 to pageCount Print heading line1 Print heading line2 Set lineCount to zero Read customer record  These instructions illustrate the sequence control structure as a straightforward list of steps written one after the other, in a top-to-bottom fashion 28
  • 29. Problem Solving – Program Design: Algorithm /Pseudocode The Structure Theorem 1. Selection  Presentation of a condition and the choice between two actions, the choice depending on whether the condition is true or false  Represents the decision-making abilities of the computer  Illustrates the fifth basic computer operation – compare two variables and select one of two alternate actions 29
  • 30. Problem Solving – Program Design: Algorithm /Pseudocode The Structure Theorem  In pseudocode, selection is represented by the keywords IF, THEN, ELSE and ENDIF IF condition p is true THEN statement(s) in true case ELSE statement(s) in false case ENDIF  If condition p is true, then the statement in true case will be executed, and the statement in the false case will be skipped (vice versa) 30
  • 31. Problem Solving – Program Design: Algorithm /Pseudocode The Structure Theorem 1. Repetition  Presentation of a set of instruction to be performed repeatedly, as long as the condition is true  Block statement is executed again and again until a terminating condition occurs  Illustrates the sixth basic computer operation – to repeat a group of actions. 31
  • 32. Problem Solving – Program Design: Algorithm /Pseudocode The Structure Theorem  Written in pseudocode as: DOWHILE condition p is true statement block ENDDO  DOWHILE is a leading decision loop – condition is tested before any statements are executed  ENDDO triggers a return of control to the retesting of the condition  Condition is true, statements are repeated until condition is found false 32
  • 33. Problem Solving – Program Design: Algorithm /Pseudocode Exercise Time  In a complete program/ algorithm, show the 3 concepts of Structure Theorem 33
  • 34. Problem Solving – Program Design: Algorithm /Pseudocode Communication between modules  Necessary to consider flow of information between modules  This flow of information is called ‘intermodule communication’ and can be accomplished by the scope of the variable 34
  • 35. Problem Solving – Program Design: Algorithm /Pseudocode Communication between modules  Scope of a variable The portion of a program in which that variable has been defined and to which it can be referenced Variables can be global where the scope of the variable is the whole program Scope of the variable is simple the module which it is defined 35
  • 36. Problem Solving – Program Design: Algorithm /Pseudocode Communication between modules  Global data Date that can be used by all the modules in a program Every module in the program can access and change data Lifetime of a global variable spans the execution of the whole program 36
  • 37. Problem Solving – Program Design: Algorithm /Pseudocode Communication between modules  Local data Variable are defined within the submodule are called local variables The scope of a local variable is simply the module in which it is defined The lifetime of a local variable is limited to the execution of the single submodule in which it is defined 37
  • 38. Problem Solving – Program Design: Algorithm /Pseudocode Exercise time Show the difference between a global variable and a local variable via the use of a program, in any language of your choice. 38
  • 39. Problem Solving – Program Design: Algorithm /Pseudocode Communication between modules  Side effects Side effect is a form of a cross-communication of a module with other parts of a program, Occurs when a subordinate module alters the value of a global variable inside a module 39
  • 40. Problem Solving – Program Design: Algorithm /Pseudocode Communication between modules  Passing parameters Parameters are simply data items transferred from a calling module to its subordinate module at the time of calling To pass parameters between modules, two things can happen:  The calling module must name the parameters that it wants to pass to the submodule  The submodule must be able to receive those parameters and return them to the calling module if required 40
  • 41. Problem Solving – Program Design: Algorithm /Pseudocode Communication between modules  Formal and actual parameters Parameters names that appear when a submodule is defined are known as formal parameters Variables and expressions that are passed to a submodule in a particular call are called actual parameters 41
  • 42. Problem Solving – Program Design: Algorithm /Pseudocode Communication between modules  Value and reference parameters  Parameters may have one of three function: 1. To pass information from a calling module to a subordinate module 2. To pass information from a subordinate module to its calling module 3. To fulfil a two-way communication role 42
  • 43. Problem Solving – Program Design: Algorithm /Pseudocode Communication between modules  Value and reference parameters Value parameters  Value parameters pass a copy of the value of a parameter from one module to another Reference parameters  Reference parameter pass the memory address of a parameter from one module to another 43
  • 44. Problem Solving – Program Design: Algorithm /Pseudocode Module cohesion  Cohesion is a measure of the internal strength of a module  It indicates how closely the elements or the statements of a module are associated with each other  The more closely the elements of a module are associated with each other, the higher the cohesion of the module 44
  • 45. Problem Solving – Program Design: Algorithm /Pseudocode Module coupling  Coupling is a measure of the extent of information interchange between modules  Tight coupling implies large dependence on the structure of one module by another  Loose coupling is the opposite of tight coupling. Modules with loose coupling are more independent and easier to maintain 45
  • 46. Problem Solving – Program Design: Algorithm /Pseudocode Sequential file update  Master file Is a file that contains permanent and semi- permanent information about the data entities it contains  Transaction file Contains all the data and activities that are included on the master file. These are transactions to:  Add a new record  Update or change an existing record  Delete an existing record 46
  • 47. Problem Solving – Program Design: Algorithm /Pseudocode Sequential file update  Sequential update logic  Sequential processing falls generally into three categories: 1. If the key on the transaction record is less than the key on the old master record, the transaction is probably an add transaction 2. If they key on the transaction record is equal to the key on the old master record, the transaction is probably an update or delete transaction 3. If the key on the transaction record is greater that the key on the old master record, there is not matching transaction for that master record 47
  • 48. Problem Solving – Program Design: Algorithm /Pseudocode The End – Thank you for your kind attention  References: Simple Program Design – A step by step approach by L. A. Robertson 48
  • 49. Problem Solving – Program Design: Algorithm /Pseudocode http://ashesh.ramjeeawon.info Management Student/ Freelance Developer University of Mauritius BCS Student Member 49