Wed May 16

Guidelines for controlled programming

9 – 12h Teaching

Teacher:

  • Mark Gaber

Goals

  • I can define the meaning of code that is under control
  • I know some types of diagrams that will help me in building controlled code
  • I tried a complete example of prototyping / design / pseudocode

Main presentation 30+ slides for the 3-hour presentation

Two diagram techniques very useful in software design and implementation

Call structure

The call structure shows how the code is organized

State diagram

The state diagram shows how the code behaves

Miscellaneous diagrams are used to represent concepts graphically. Feel free to use your creativity to record and communicate the important ideas you have in your head.

This was a project with Hydro Quebec, the state electrical company, province of Quebec, Canada. The upper diagram simply represents a hydrological network, and the lower diagram is the database representation.

This diagram was for the same Hydro Quebec project. Calculations were run in different time slices varying from 15 minute to 6 hour intervals. The addition and removal of one hour at the twice yearly daylight savings time changes were special cases that complicated the code.

Mindmap - The mindmap is not specifically related to IT. It is a general technique to organize and structure one's thinking. The more you get onto the diagram, the freer your mind is to go to the next steps in reaching the project goals.

This mindmap was for the creation of this 3-hour presentation on good programming. It was one week before the presentation, before the slides were made, but after a couple of weeks of thinking in a kind of background task.

There is a central box representing the task at hand, surrounded by themes with their main subpoints.

Example shown in class - A website with three pages, three buttons, background color changes. Here are the links to the code:

ex03_statesToggle_State1.html

ex03_statesToggle_State2.html

ex03_statesToggle_State3.html

ex03_statesToggle_functions.js

Call structure

Notice circles that act as exit/entry points to keep diagram neat

State diagram (yes, the same diagram as earlier above)

Notice that from state 2 you cannot get to state 3 directly, you have to backtrack through state 1. Similarly, to go from state 3 to state 1, you cannot go directly, you have to transition through state 2.

12 – 13h Lunch

13 – 17h

Mentor workshop