P-Coder Student Guide

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Geoffrey G Roy

School of Engineering Science

Murdoch University

 

 

 

 

 

Jan 2005


Contents

 

1      Introduction. 1

2      Overview.. 2

2.1       Starting P-Coder 2

2.2       Command Options. 3

2.3       Node Types. 4

3      Computational Concepts. 6

3.1       Sequence. 6

3.2       Iteration. 6

3.3       Selection. 7

3.4       Recursion. 8

4      Data and Variable Definitions. 10

5      Program Annotations. 12

6      Using the P-Coder Designer 13

7      Building a Simple Program.. 17

8      Adding Details to Nodes. 32

8.1       Direct Editing of Node Notes. 32

8.2       Using the Node Details Dialog. 33

8.3       Searching the Model 34

9      Using the Class View.. 36

10        Using the Module View.. 41

11        Using the Code View.. 42

12        Using the Object View.. 44

13        Guidelines for Constructing Models. 46

13.1     Getting Started. 46

13.2     Adding Method Nodes. 47

13.3     Adding Operational Nodes to Methods. 47

13.4     Adding Iteration Nodes. 48

13.5     Adding Selection Nodes. 49

13.6     Adding Switch/Case Nodes. 50

13.7     Adding Recursion Nodes. 51

13.8     Adding Try/Catch Nodes. 52

14        Summary. 53

 


1         Introduction

P-Coder is a support tool to assist in learning some of the basic principles in programming.  While it has a bias towards Java, it could equally be applied to most (good) programming languages.

The “P” in P-Coder stands for “Pseudo”.  Pseudocode is a commonly used word to describe how a program actually works before you write down all the instructions in the actual programming language.  It is thus an intermediate stage between the written/spoken descriptions of what the program is required to do, and the final code that you can compile then execute on the computer.

P-Coder is a tool to help you make the transition from a description of the computational task to achieving an operational program.  This intermediate step is quite important, and if it is done well many problems (that can crop up in programming) might be avoided and much time saved.  The main goals of using a pseudocode step is to make certain you better understand what the computational task is all about, and to design a solution to it that has a good chance of working.

P-Coder is a graphical design tool that help you visualize how your program should/can work and thus help you achieve a better understanding of how to do programming (well).  P-Coder provides support for a full range of the essential programming concepts that will enable you to do your first programming exercises.  P-Coder is not intended to be a professional programming tool – there are many others that are better designed for that purpose – but they can be difficult to learn to use.

This User Guide does not contain the full operational description of P-Coder, this is described elsewhere (in the Instructor Guide).


2         Overview

2.1      Starting P-Coder

P-Coder is started from the shortcut icon that you will find on the desktop, or in the Start menu, of your computer. It looks like this:

Figure 1: The P-Coder Icon

The Designer View is the primary user interface for the program design process; it looks like that shown in the following diagram. 

Figure 2: The main window of P-Coder

The P-Coder Designer consists of a graphical display area and a set of node icon buttons in on the left side.  Each of these corresponds to a node type that can be inserted into the program.  Note that a number of these buttons are disabled (for the moment) as these correspond to nodes that are automatically inserted into the model (e.g: Class Data, Then and Default nodes; as they are required for their respective parent nodes).

The text field at the bottom of the window will show messages as you use the program.

 

 

 

 

2.2      Command Options

Most commonly used operations are available from the toolbar across the top part of the window, these are:

 

Toolbar Icon

Operation

Opens a P-Coder model (xml) file

Saves the current model

Prints the current model

Open the Find tool

Opens the Module view with a selected P-Coder model

Opens the Code View

Opens the Class View

Opens the Object View

Terminates the program (bottom left of window)

 

These and other command options are available from the menu bar options, as follows:

 

Menu

Option

Action

File

Load

Loads a P-Coder model from disk

New ► Program

Creates a new P-Coder model from a Program node.

New ► Package

Creates a new P-Coder model from a Package node.

New ► Class

Creates a new P-Coder model from a Class node.

New ► Method

Creates a new P-Coder model from a Method node.

Import

Imports an existing Source file to create a skeleton model

Save

Saves the current model

Save As…

Saves the current model to a new file name

Page Setup

Show the page setup dialog to set page and printer properties.

Print

Prints the current model

Quit

Terminates the program

Node

Enable-Disable Class Bar

Enables-Disables the Class highlight bar

Open All

Opens all nodes in model

Open Selected

Opens those nodes that are currently selected

Close All

Closes all nodes in model

Close Selected

Closes those nodes that are currently selected

View Selector

Shows View Selector dialog

Reset All Nodes

De-selects all nodes

Delete Selected Nodes

Deletes all currently selected nodes.

View

Java Code View

Shows the Code View

Module View

Requests a module to load, then displays it in the Module View

Class View

Shows the Class View

Object View

Shows the Object View

Find

Search for text in model

Help

About

Shows the about dialog

Credits

Contributors to P-Coder

Enter userID

Show the userID dialog if you are required to enter or change your userID.

Enable/Disable Tool Tips

Enables/disables tool tips on tool bar icons.

 

Look & Feel ► Option

List of look and feel options for current installation (e.g. Windows, Motif, Metal)

 

2.3      Node Types

In P-Coder, the program design is composed of nodes, of different type, connected in a tree-like diagram.  Each node represents a particular computational step or process.

 

Node Icon

Formal Name

Description