Progressive Disclosure Diagramming Techniques Haytham Siala Email: h.siala@roehampton.ac.uk Tel:...

Preview:

Citation preview

Progressive Disclosure Diagramming Techniques

Haytham Siala

Email: h.siala@roehampton.ac.uk

Tel: 0208 392 3481

Agenda

• Visual Aid to Computer Programming

• CASE and Basic Diagramming Tools

• Challenges Ahead for Teaching Computer Programming

Overview

• Visual Aid to Computer Programming• Flowcharts• Activity Diagrams• Code Tracers and Debuggers (post-mortem)

Audience

• Cohort of First Year students

• Difficult to assimilate programming techniques

• Lack of self-motivation

• Steep learning curve in stark contrast to other modules:• Fundamentals of DBMS, Graphic Design,

Hardware Theory and Practice, etc.

Designing Programming Solutions

There are 'visual' alternatives to algorithms and pseudo code, the most common of which are:

• Flowcharts (dated)• No diagramming tools

• Currently synonymous with business process modelling

• Activity Diagrams (UML)• A plethora of diagramming tools

Start

num1=0, num2= 0, result = 0

Read num1, num2

result = num1 + num2

Output result

Stop

Flowcharts

UML Activity Diagrams

• UML (Unified Modelling Language) • Blueprint: visually illustrates the flow (logical

sequence) of a programming solution (algorithm).

• Activity diagrams aid in breaking down a problem into simple steps

Activity Diagram Symbols

Initial Activity: This shows the starting point of the flow. Denoted by a solid circle.

Final Activity: The end of the Activity diagram is shown by a bull's eye symbol.

Activity: Represented by a rectangle with rounded edges. Indicates that an action is performed by the computer program, such as a mathematical computation or printing something to the screen.

Decision. The diamond indicates a decision structure. A diamond always has two flowlines out. Each flowline is labeled with a suitable 'guard' expression that represents a test condition. Each guard expression is written within square brackets.

Activity

[age >= 18] [age < 18]

Activity 1 Activity 2

Next Action

In addition, a diamond with incoming arrows and no brackets (guard conditions) can be used to merge different activities (converge) once they have completed performing the required actions.

Activity Diagram Symbols

Note: Used for showing additional information or more specific detail about an activity.

Flowline. Flowlines connect the symbols of the activity diagram and show the sequence of operations during the program execution.

Activity Diagram Example 1

Get User Input

[age > 18] [age <18] Print "You are a minor"; Print "You are an adult";

Activity Diagram Example 2

Get Dressed

[In time to catch train] [Too late to catch train]

Take train to University Take cab to University

Anatomy of a C++ program

#include "stdafx.h"

#include <iostream>

using namespace std;

int main()

{

cout << "Hello Word!";

return 0; // indicates that program has ended successfully

} // end function main

Libraries: toolbox of

the tools you need

Comment

General Manager: Starting point of program execution

Output statement

Begin

End

namespace

Declare and initialise the required variables

int num1=0, num2=0, num3=0, sum=0, avg=0;

Read 3 numbers from user

cin >> num1;cin >> num2;cin >> num3;

Add the 3 numbers and store the result

sum = num1 + num2 + num3;

Calculate the average of the 3 numbers

avg = sum / 3;

Display the sum of the 3 numbers

cout <<"Sum = " << sum;

Display the average of the 3 numbers

cout << "Average = " << avg;

Pause program execution

cin.ignore();

#include "stdafx.h"#include <iostream> using namespace std;

int main() {

return 0; }

#include "stdafx.h"#include <iostream> using namespace std;

int main() { int num1=0, num2=0, num3=0, sum=0, avg=0;

return 0; }

Declare and initialise the required variables

int num1=0, num2=0, num3=0, sum=0, avg=0;

#include "stdafx.h"#include <iostream> using namespace std; int main() { int num1=0, num2=0, num3=0, sum=0, avg=0; cout << "Please enter 3 numbers"; cin >> num1; cin >> num2; cin >> num3;

return 0; }

Declare and initialise the required variables

int num1=0, num2=0, num3=0, sum=0, avg=0;

Read 3 numbers from user

cin >> num1;cin >> num2;cin >> num3;

#include "stdafx.h"#include <iostream> using namespace std; int main() { int num1=0, num2=0, num3=0, sum=0, avg=0; cout << "Please enter 3 numbers"; cin >> num1; cin >> num2; cin >> num3; sum = num1 + num2 + num3;

return 0; }

Declare and initialise the required variables

int num1=0, num2=0, num3=0, sum=0, avg=0;

Read 3 numbers from user

cin >> num1;cin >> num2;cin >> num3;

Add the 3 numbers and store the result

sum = num1 + num2 + num3;

#include "stdafx.h"#include <iostream> using namespace std; int main() { int num1=0, num2=0, num3=0, sum=0, avg=0; cout << "Please enter 3 numbers"; cin >> num1; cin >> num2; cin >> num3; sum = num1 + num2 + num3; avg = sum / 3;

return 0; }

Declare and initialise the required variables

int num1=0, num2=0, num3=0, sum=0, avg=0;

Read 3 numbers from user

cin >> num1;cin >> num2;cin >> num3;

Add the 3 numbers and store the result

sum = num1 + num2 + num3;

Calculate the average of the 3 numbers

avg = sum / 3;

#include "stdafx.h"#include <iostream> using namespace std; int main() { int num1=0, num2=0, num3=0, sum=0, avg=0; cout << "Please enter 3 numbers"; cin >> num1; cin >> num2; cin >> num3; sum = num1 + num2 + num3; avg = sum / 3; cout << "Sum = " << sum; return 0; }

Declare and initialise the required variables

int num1=0, num2=0, num3=0, sum=0, avg=0;

Read 3 numbers from user

cin >> num1;cin >> num2;cin >> num3;

Add the 3 numbers and store the result

sum = num1 + num2 + num3;

Calculate the average of the 3 numbers

avg = sum / 3;

Display the sum of the 3 numbers

cout <<"Sum = " << sum;

#include "stdafx.h"#include <iostream> using namespace std; int main() { int num1=0, num2=0, num3=0, sum=0, avg=0; cout << "Please enter 3 numbers"; cin >> num1; cin >> num2; cin >> num3; sum = num1 + num2 + num3; avg = sum / 3; cout << "Sum = " << sum; cout << "Average = " << avg; return 0; }

Declare and initialise the required variables

int num1=0, num2=0, num3=0, sum=0, avg=0;

Read 3 numbers from user

cin >> num1;cin >> num2;cin >> num3;

Add the 3 numbers and store the result

sum = num1 + num2 + num3;

Calculate the average of the 3 numbers

avg = sum / 3;

Display the sum of the 3 numbers

cout <<"Sum = " << sum;

Display the average of the 3 numbers

cout << "Average = " << avg;

#include "stdafx.h"#include <iostream> using namespace std; int main() { int num1=0, num2=0, num3=0, sum=0, avg=0; cout << "Please enter 3 numbers"; cin >> num1; cin >> num2; cin >> num3; sum = num1 + num2 + num3; avg = sum / 3; cout << "Sum = " << sum; cout << "Average = " << avg; cin.ignore(); return 0; }

Declare and initialise the required variables

int num1=0, num2=0, num3=0, sum=0, avg=0;

Read 3 numbers from user

cin >> num1;cin >> num2;cin >> num3;

Add the 3 numbers and store the result

sum = num1 + num2 + num3;

Calculate the average of the 3 numbers

avg = sum / 3;

Display the sum of the 3 numbers

cout <<"Sum = " << sum;

Display the average of the 3 numbers

cout << "Average = " << avg;

Pause program execution

cin.ignore();

#include "stdafx.h"#include <iostream> using namespace std; int main() { int num1=0, num2=0, num3=0, sum=0, avg=0; cout << "Please enter 3 numbers"; cin >> num1; cin >> num2; cin >> num3; sum = num1 + num2 + num3; avg = sum / 3; cout << "Sum = " << sum; cout << "Average = " << avg; cin.ignore(); return 0; }

Declare and initialise the required variables

int num1=0, num2=0, num3=0, sum=0, avg=0;

Read 3 numbers from user

cin >> num1;cin >> num2;cin >> num3;

Add the 3 numbers and store the result

sum = num1 + num2 + num3;

Calculate the average of the 3 numbers

avg = sum / 3;

Display the sum of the 3 numbers

cout <<"Sum = " << sum;

Display the average of the 3 numbers

cout << "Average = " << avg;

Pause program execution

cin.ignore();

CASE and Basic Diagramming Tools

• General• Visio, SmartDraw

• OOP• BlueJ, Enterprise Architect, Eclipse, Rational Rose, Select

Architect, Visual Paradigm

• CASE tools (including a code generation feature)• OOP

– Visual Paradigm (commercial)– Rational Rose (commercial)– BlueJ (open-source)

• Procedural – Scarce or non-existent?

Compromise: Visio + Visual IDE

Compromise: Visio + Visual IDE

• Disjointed effort between the design and the implementation of a programming solution

• Students don't mind investing time in designing a programming blueprint as long as it saves them time in writing the code for the solution.

The Challenges Ahead…

• The 2-pane Powerpoint slide presentation cannot be used effectively for demonstrating a complex programming solution (e.g. with multiple conditional statements and loops)

• Request for • an alternative to standard presentation software that is

more fit for presenting and teaching programming topics

• an affordable CASE tool that includes a 'code-generation' feature for basic procedural programming

• Bigger LCD projector screens/ computer monitors for preparing and demonstrating programming lectures

Recommended