9 Logic Modeling And Documentation

Systems Analysis and Design · Unit 9

Logic Modeling and Documentation

Exam-focused notes for Logic Modeling and Documentation (Systems Analysis and Design, BIT253): what the TU syllabus asks and how it has actually been tested, with 6 solved past questions from this unit.

Logic Modeling and Documentation in short

Once requirements are known, the analyst must describe the rules inside processes, test the system, and write the documents and training that keep it useful. This chapter covers those supporting tasks.

Logic Modeling and Documentation: notes

Decision table with examples

A decision table shows complex rules as a table of conditions, actions, and the rules that link them. It is clear and checks that no case is missed.

Parts:

  • Condition stubs: the questions asked.
  • Condition entries: the answers (Y or N).
  • Action stubs: the possible actions.
  • Action entries: the actions chosen (X) for each rule.

Example: an online shop gives a discount. A customer gets 10 percent off if the order is over Rs 5,000, and extra free delivery if the customer is a member.

Condition or actionR1R2R3R4
Order over Rs 5,000?YYNN
Member?YNYN
Give 10 percent discountXX
Give free deliveryXX

With $n$ conditions there are $2^n$ rules. Here $2^2=4$ rules, so all cases are covered.

Decision tree modeling

A decision tree shows the same logic as a branching diagram. It starts at the left with the first condition, branches for each answer, and ends in an action.

For the discount example:

Order over Rs 5,000?
 |-- Yes --> Member?
 |            |-- Yes --> 10% discount + free delivery
 |            |-- No  --> 10% discount
 |-- No  --> Member?
              |-- Yes --> Free delivery
              |-- No  --> No benefit

Trees are easy to read and show the order of decisions. Tables are better when there are many conditions.

What this unit covers

  • Decision table with examples
  • Decision tree modeling
  • Pseudocode definition and examples
  • Software testing importance
  • Software testing techniques
  • Documentation importance
  • Training importance
  • System maintenance factors and maintainability

Decision tree modeling

2081 · 5 marks

How do you model logic using decision tree? Explain with an example. [5]

Show solved answer

Modeling Logic Using Decision Trees

What is a Decision Tree?

A decision tree is a tree-structured model used to represent decisions and their possible consequences. It models logical conditions (if-then-else logic) in a hierarchical, visual form that is easy to understand and implement.


Structure of a Decision Tree

ComponentDescription
Root NodeThe topmost node representing the first/main decision or condition
Internal NodeRepresents a test on an attribute or condition
BranchRepresents the outcome (Yes/No, True/False) of a test
Leaf NodeRepresents the final decision, class label, or result

How Logic is Modeled

Each internal node corresponds to a logical condition (predicate), and each branch corresponds to the truth value of that condition. The path from root to a leaf encodes a conjunction of conditions (AND logic), while multiple paths to the same result encode disjunction (OR logic).

A decision tree is essentially a graphical representation of nested if-then-else statements.


Example: Deciding Whether to Play Cricket

Conditions (Attributes):

  • Weather: Sunny / Rainy
  • Wind: Strong / Weak

Decision Table:

WeatherWindPlay Cricket?
SunnyWeakYes
SunnyStrongNo
RainyWeakYes
RainyStrongNo

Decision Tree:

            [Weather?]
           /          \
       Sunny          Rainy
         |              |
       [Wind?]        [Wind?]
       /    \         /    \
   Weak   Strong   Weak   Strong
    |        |      |        |
   YES       NO    YES       NO

Equivalent Logical Expression

Reading the YES paths from the tree:

Play Cricket = (Weather = Sunny AND Wind = Weak)
               OR
               (Weather = Rainy AND Wind = Weak)

This can be simplified as:

Play Cricket = Wind = Weak

This shows how a decision tree discovers and models logical rules from data.


Equivalent If-Then-Else Code

if Weather == "Sunny":
    if Wind == "Weak":
        return "Yes"
    else:
        return "No"
else:  # Rainy
    if Wind == "Weak":
        return "Yes"
    else:
        return "No"

Key Points

  • Each path in the tree represents a logical rule
  • Decision trees can model AND, OR, and NOT logic
  • They are used in machine learning, expert systems, and database query optimization
  • They convert complex logical conditions into a simple, readable tree structure
Open this answer on its own page →

Decision table with examples

2080 · 5 marks

Explain decision table with example. [5]

A decision table is a structured tabular representation used in software testing and requirements analysis to model complex business logic involving multiple conditions and their corresponding actions. It systematically lists all possible combinations of conditions (inputs) and the actions (outpu...

Open this answer on its own page →

Documentation importance

2079 · 5 marks

Why documentation and training are important? [5]

--- Documentation refers to the written records that describe a system, its components, how it works, and how it should be used. It is important for the following reasons: - Documentation serves as a permanent reference for developers, users, and administrators. - It helps in understanding the sy...

Open this answer on its own page →

Pseudocode definition and examples

2080.2 · 5 marks

Explain pseudocode with example. [5]

Show solved answer

Pseudocode

Definition

Pseudocode is an informal, high-level description of an algorithm that uses a mixture of natural language and programming-like constructs to describe the steps of a solution. It is not written in any specific programming language syntax, so it cannot be directly executed by a computer. It serves as a planning tool to outline the logic of a program before actual coding begins.


Key Characteristics of Pseudocode

  • Uses plain English mixed with programming constructs
  • Has no strict syntax rules
  • Is language-independent (not tied to C, Python, Java, etc.)
  • Easy to read and understand by both programmers and non-programmers
  • Focuses on logic rather than implementation details

Common Pseudocode Constructs

ConstructExample
InputREAD number
OutputPRINT result
Assignmentsum = a + b
DecisionIF...THEN...ELSE...ENDIF
RepetitionWHILE...DO...ENDWHILE
LoopFOR i = 1 TO n

Example: Find the Largest of Two Numbers

Problem: Read two numbers and print the larger one.

BEGIN
    READ num1, num2

    IF num1 > num2 THEN
        PRINT "num1 is larger"
    ELSE
        PRINT "num2 is larger"
    ENDIF
END

Example: Sum of First N Natural Numbers

Problem: Calculate the sum of first N natural numbers.

BEGIN
    READ N
    SET sum = 0
    SET i = 1

    WHILE i <= N DO
        sum = sum + i
        i = i + 1
    ENDWHILE

    PRINT sum
END

Trace for N = 4:

isum
11
23
36
410

Output: 10


Advantages of Pseudocode

  1. Easy to convert into actual code in any language
  2. Helps in detecting logical errors before coding
  3. Acts as documentation for the program
  4. Saves time during the actual programming phase

Conclusion

Pseudocode is a valuable tool in program design. It bridges the gap between problem understanding and actual implementation by expressing the algorithm in a simple, structured, and readable format.

Open this answer on its own page →

System maintenance factors and maintainability

2080.2 · 5 marks

Explain different factors that influence maintainability of the information system. [5]

Note: The reference notes did not contain specific content on this topic. The following answer is based on standard Software Engineering and Information Systems curriculum as taught in BSc CSIT programs. --- Maintainability refers to the ease with which an information system can be modified, corr...

Open this answer on its own page →

Software testing importance

0 · 5 marks

Why software testing in important? Explain any three software testing techniques. [5]

Software testing is a critical phase in the software development life cycle (SDLC). It is important for the following reasons: - Defect Detection: Testing identifies bugs and errors in the software before it is delivered to the end user, reducing the cost of fixing defects later. - Quality Assura...

Open this answer on its own page →