Programming Methodology - approach to analyzing complex problems by planning software
development and controlling the development process.
Why do we need to study Programming Methodologies
to learn how to use them to design solutions to a given problem
PROGRAMMING METHODOLOGIES
1. Procedural Programming - problem is broken down into procedures, or block of code
that performs one task each
note: suitable only for low level complexity.
Example: Calculator
more of following instruction like step-by-step
2. Object-oriented Programming - the solution revolves around the entities or objects that
are part of the problem. Solution deals with:
● How to store data related to the entities
● How the entities behave
● How they interact with each other to give a cohesive solution
Example: payroll management system
entities - employees, salary structure, leave rule, etc.
you create a hero then you instruct it on what the hero should do.
3. Functional Programming - the problem or the desired solution is broken down into
functional units. Each unit performs its own task and is self-sufficient.
Example: Payroll processing
more on passing info and making out outputs per units
4. Logical Programming - the problem is broken down into logical units rather than
functional units.
Example: School management system
A programmer is someone who gives info and lets it decide on its own like for example
you give it the facts like Mia is a girl then you can ask if mia is a girl.
TWO-APPROACHES DEVELOPERS USED
1. Top-down or Modular Approach - the problem is broken down into smaller units and
the smaller units are also broken down into smaller units. Each unit is called a module.
2. Bottom-up Approach - system design starts with the lowest level of components.
note: it is very difficult to know all lowest level components at the outset. So
button up approach is used only for very simple problems
System Analyst - person responsible for gathering requirements, defining the problem and
designing the system
Detailed Investigation - requirement gathering is also known
SOFTWARE DEVELOPMENT
Requirement Gathering
Sometimes the client cannot clearly define what they want so the developer need to gather
client informations to understand the problem
Questions
- What is being done?
- How is it being done?
- What is the frequency of a task?
- What is the volume of decisions or transactions?
- What are the problems being encountered?
Ano gagawin? Paano gagawin? Anong problem is being encountered
Ilang beses gagamitin yung system per days or week? How many people will use the system
like rough estimation? Of course maplan yung capacity ng isang system
1. Interview
2. Questionnaires
3. Studying existing system documents
4. Analysing business data
SMART
S - Specific
M - Measurable
A - Agreed Upon
R - Realistic
T - Time-based
Failure to do so results in
- Incomplete program definitions
- Incorrect program goals
- Re-work to deliver required outcome to client
- Increased costs
- Delayed delivery
PROBLEM DEFINITION
After gathering and analyzing the problem, the problem statement must be stated clearly. It
should unambiguously state what problems need to be solved. Necessary to:
- Define project scope
- Keep the team focused
- Keep the project on track
- Validate that desired outcome was achieved at the end of project
IDENTIFYING SOLUTION
coding is just one of the parts of the software development process. Coding may take a
minimum amount of time if the system is designed correctly. Before the system is designed, a
solution must be identified for the problem at hand.
FLOWCHARTING
a visual representation of a system's workflows and data flows
Advantages of flowcharting
● Clarity
● Foundation
● Documentation
● Maintenance
Disadvantages of flowcharting
● Simplicity constraints
● Rigidity
DATA FLOW DIAGRAM (DFD)
shows how data moves through a system or subsystem, graphically
Drawn in Levels
● Level 0 - whole system, input data, output data
● Level 1 - each module/process broken down
● Level 2,3…- further breakdown as needed
PSEUDOCODE
is a plain-English-like description of a program's logic, written before actual coding begins
● uses control structure (ex. If-then-else) to show logic clearly
● Not real programming language, readable by both analysts and programmers
Example of Pseudocode
Take num1 as input from user
Take num2 as input from user
If num2 is equal to 0 then
Flash a message
Otherwise
Do something else
Why it matters
● Bridges the gap between design and code
● At machine level, every problem becomes mathematical operations or logical
comparisons
IDENTIFYING MATHEMATICAL OPERATIONS
core part of software design is listing all mathematical operations and logical comparisons a
program needs
APPLYING MODULAR TECHNIQUES IN PROBLEM SOLVING
Modular technique = breaking one big solution into smaller parts (module) for easier
development
Why use it?
Real-life problems are complex; a single monolithic program is hard to
- Write
- Test
- Implement notifications
- Maintain (one error can halt the whole system)
Advantages of Modules
● Faster development : teams work on different modules in parallel
● Reusable : a module is self-contained, usable by other teams
● Easier testing : each module tested independently, more errors caught
● Lower complexity : each module does 1-2 functions, easy to understand
● Easier debugging & maintenance
Guidelines for identifying modules
- if data is most important > build modules around the data
- If many diverse services > break into functional modules by service
- If above all > break into logical modules (needs good requirement gathering)
- For coding: break modules further per language rules (C, Java, PHP differ)
Step-by-step Solution
A step-by-step solution describes each module's process flow into sequence, using
flowcharts, algorithms, or pseudocode.
Why is it used?
● Makes the problem and solution clear to programmer and non-programmer
● During coding, each statement is just converted to a program statement
● Becomes part of documentation and helps in later program maintenance
● Micro details (identifier names, operations) get worked out via pseudocode per level
Example
Problem: Accept fees payment in a school. Step-by-step flow (non-sequent, uses branching)
1. Does payer have fee slip?
2. If yes > go to step 3; if no > go to step 9
3. Open fee payment entry form, input slip ID, amount, mode
4. Click update, stamp slip, hand over, exit window
5. Open slip printing, ask student ID, print, give to payer > go to step 3
Branching like “if yes… else…” becomes a control structure in code
CONTROL STRUCTURES
Control structures dictate the order in which a program's instructions are executed. They allow
programs to deviate from a linear, step-by-step sequence based on a specific criteria.
Why They Matter
● Programs rarely run in a straight line; they often need to skip steps or repeat actions
● Control Structures must be identified during the design phase (using algorithms or
pseudocode) before any actual coding begins
● They determine how the program responds to input parameters
Three types of control structures
1. Decision Control
● Used when the next step depends on a criterion or condition (often using
Boolean expressions).
● Example: if or if-else statements
2. Selection Control
● Used when the path is chosen based on a specific user choice or category
● Example: switch or case statement
3. Repetition (Loop) Control
● Used when a set of instructions needs to be executed multiple times
● Prevents redundant code; the loop continues until a specific condition is met
● Example: for loops, while loops, do while loops
ALGORITHMS
An algorithm is a finite set of steps to solve a given problem, developed before coding
Key Points
- written in pseudocode or plain English > readable by programmers and non-
programmers (ex. System analysts)
- Helps show data/process flow before actual coding starts
Advantages
- Promotes team communication (mixed programmer/non-programmer teams)
- Enables problem analysis
- Acts as a blueprint for coding (just translate to language)
- Assists debugging
- Part of documentation for maintenance phase
Characteristics of a good algorithm
● Correct solution
● Has defined set of inputs
● Steps are uniquely defined (no repeats)
● Finite number of steps
● Produces desired output
Example:
Buying a pen
1. Get dresses
2. Check wallet
3. Go to shop
4. Ask for pen
5. If available buy, else try other brand (step “go to shop” could be it's own algorithm
Algorithms vs. Pseudocode
Algorithms is the logic set, Pseudocode is one way to write it. Both feed into flowcharts and
code.
FLOWCHART
A diagrammatic representation of the sequence of logical steps of a program. Flowcharts use
simple geometric shapes to depict processes and arrows to show relationships and
process/data flow.
A flowchart is typically created after step-by-step algorithm development to visually
communicate program logic
Symbol
1. Start/Stop (rounded rectangle)
2. Process (rectangle)
3. Input/Output (parallelogram)
4. Decision (rhombus)
5. Arrow (arrow)
6. On-page connector (circle)
7. Off-page connector (circle (labeled)
USING CLEAR INSTRUCTIONS
Instructions are the building blocks of any program or software. They must be:
Clear and Unambiguous - computers follow instructions literally and have no judgements of
their own
Simple - written so the computer understands each step exactly
Expression - sequence of operators and operands used to perform an arithmetic or logical
operations in a program.
Guidelines for writing expressions
● Unambiguously result - evaluation must give a clear cut outcome; avoid operators that
cause confusion
● Avoid complex expressions - don't combine multiple operations (assign and increment
in one line); split into simple steps
Guidelines for simple instructions
● Avoid clever instructions - they are hard to understand later by self of others
● One instruction per task - accomplish only one job per instruction
● Use standards - follow language specific and project specific naming and structural
conventions.
CHARACTERISTICS OF A GOOD PROGRAM
● Portable - the program or software should run on all computers of same type
● Efficient - a software that does the assigned tasks quickly is said to be efficient
● Effective - the software should assist in solving the problem at hand. A software that
does that is said to be effective
● Reliable - the program should give the same output every time the same set of inputs is
given
● User-documenting - any program or software whose identifier names, module names,
etc. Can describe itself due to use of explicit names
Proper Identifier Names
A name that identifies any variable, object, functions, class or method is called identifier
Tips to create proper identifier names
- Use language guidelines
- Don't shy from giving long names to maintain clarity
- Use uppercase and lowercase letters
- Don't give same names to two identifiers even if the language allows it
- Don't give same names to more than one identifier even if they have mutually exclusive
scope
Comment is an expression that is not compiled but written as a note or explanation for the
programmer
Indent is the distance of text from left or right margin. In program indentation is used to
separate logically separated blocks of code
DEBUGGING
Identifying and removing errors from a program or software is called debugging.
Types of errors that can crop up in a program
Syntax errors the grammatical errors in a program. Every language has its own set of
rules, like creating identifiers, writing expressions, etc. For writing programs. When these
are violated, the errors are called syntax errors.
Semantic errors are also called logical errors. The statement has no syntax errors, so
it will compile and run correctly. However, it will not give the desired output as the logic is
not correct
Runtime errors are errors that occur while executing the program. Some of the most
common run time errors your program may encounter
Infinite loop
Division by '0’
Wrong value entered by user (say, string instead of integer)
Code Optimization
any method by which code is modified to improve its quality and efficiency
Code Quality
determines the life span of code. If the code can be used and maintained for a long period of
time, quality is deemed to be high
Code Efficiency
Readability and speed of a code determines code efficiency. Code efficiency is an important
factor in ensuring high performance of a software
Two approaches to code optimization
Intuition based optimization (IBO) - optimize the program based on
her own skill and experience.
Evidence based optimization (EBO) - automated tools are used to
find out performance bottlenecks and then relevant portions optimize accordingly
PROGRAM DOCUMENTATION
any written text, illustration or video that describe program or software document
Example of Documents
User manual - it describes instructions and procedures for end users to use the different
features of the software
Operational manual - it lists and describes all the operations being carried out and their inter-
dependencies.
Design document - it gives an overview of the software and describes design elements in
detail. It documents details like data flow diagrams, entity relationship diagrams, etc.
Requirement documentation - it has a list of all the requirements of the system as well as an
analysis of viability of the requirement
Technical documentation - it is documentation of actual programming components like
algorithms, flowcharts, program codes, functional modules, etc.
Testing document - it records test plan, test cases, validation plan, verification plan, test result
List of known bugs - every software has bugs or errors that cannot be removed because either
they were discovered very late or are harmless or will take more effort and time than necessarily
to rectify.
PROGRAM MAINTENANCE
the process of modifying a software or program after delivery to achieve any of these outcomes
Types of maintenance
1. Corrective maintenance - errors that come up after on-site implementation are fixed.
The errors may be pointed out by the user themselves
2. Preventive maintenance - modifications done to avoid errors in future are called
preventive maintenance
3. Adaptive maintenance - changes in the working environment sometimes require
modifications in the software.
4. Perfective maintenance - changes done in the existing software to incorporate new
requirements from the client is called perfective maintenance. Aim here is to be always
be up-to-date with the latest technology
Maintenance Tools
1. Program slicer - selects a part of the program that would be affected by the change
2. Data flow analyzer - tracks all possible flows of data in the software
3. Dynamic analyzer - traces program execution path
4. Static Analyzer - allows general viewing and summarizing of the program
5. Dependency analyzer - assists in understanding and analyzing interdependence of
different parts of the program