2.1. Flowcharts: 2.1.1 Flowcharting Standards
2.1. Flowcharts: 2.1.1 Flowcharting Standards
2.1. Flowcharts: 2.1.1 Flowcharting Standards
FLOWCHARTS
A flowchart is a graphic illustration of the steps to follow in order to arrive at the solution to a problem. It is a program design tool that you use prior to writing the actual program. A flowchart consists of a set of various standard shaped boxes that are interconnected by flow lines. Flow lines have arrows to indicate the direction of flow of control between the boxes. The description of the activity within the boxes is written in English. In addition, there are connector symbols that are used to indicate that flow of control continues elsewhere, for example, another page.
2.2.1. DESIGN
KISS it. (Keep It Simple Stupid.) Understand the problem. The best design is often the simplest. - Jon Bentley, Bell Labs A design that does not fit on one 8.5-by-11 inch paper cannot be understood. - Mark Ardis, Wang When in doubt use brute force. - Ken Thompson, Bell labs Let the data structure the program. -David Parnas Design data structures first; rest of the program will write itself.
- David Jones Avoid arbitrary restrictions. The only reasonable restrictions are 0, 1, and [[infinity]]. It is often easier to derive a general solution than for a special case. Experience is what you get when you don't get what you want. Good judgement comes from experience, and experience comes from bad judgement. - Fred Brooks
- Jon Bentley, Bell Labs Details count. - Peter Weinberger, Bell labs Make a user interface as consistent and as predictable as possible. Avoid too many special cases. Provide tools. Make them general. Use the right tool for the job. - P.J. Plauger, Yourdon Inc., Brian Kernighan, Bell Labs When the only tool you have is a hammer, everything looks like a nail. - Henning Mortensen
2.2.4. CODING
If you can't write it down in English, you can't code it. - Peter Halpern Avoid asymmetry. - Andy Huber, Data General Modularize. Remember 7 +/- 2. Brevity is the soul of wit. - The Bard The code for a module should fit on a screen. Why reinvent the wheel? Use library functions whenever possible. Handle normal cases and worst cases separately. Store dates internally as YYYYMMDD. A new millennium is coming. Know your limits. Remember September 28, 1989. Everything should be made as simple as possible, but no simpler. - Albert Einstein
2.2.5. DEBUGGING
Avoid bugs in the first place. An ounce of prevention is worth a pound of cure. Testing shows the presence of bugs, not their absence. - Edsger Dijkstra Make up exhaustive test data during design and coding. The first step in fixing a problem is getting it to fail repeatedly. - Tom Duff, Bell Labs 80% of bugs are syntax errors. Of remainder 80% are trivial logic errors. Of remainder 80% are pointer errors. Remaining .8% are hard. - Marc Donner, IBM If the code and comments disagree, both are probably wrong. - Norm Schryer Debug the code. Don't be led astray by the comments. Don't debug standing up. It reduces your patience. - Dave Storer
2.2.6. DOCUMENTING
No job is over until the paperwork is done. When explaining anything, first describe the problem it is designed to solve. - David Martin Be consistent in your style. Choose one format and stick to it. Strive for "self documenting" code and data. Don't over decorate. Avoid over-documentation. Black and White Rule: Use white space effectively. In a sea of white your eyes will spot the black. In a sea of black your eyes will catch the white. A picture is worth a thousand words. Graphics is only screen deep. - Rob Andrews, BNR
2.2.7. EFFICIENCY
Don't use a computer to do things that can be done efficiently by hand. Don't use hands to do things that can be done efficiently by a computer. Get it to work first. Then make it work faster. - Jon Bentley, Bell labs Before optimizing, use a profiler to locate "hotspots". - Jon Bentley, Bell Labs In allocating resources, strive to avoid disaster than to attain an optimum. - Butler Lampson In non-I/O-bound programs, less than 4% of a program generally accounts for more than half of its running time. - Don Knuth 80-20 rule: 80% of the world's resources are consumed by 20% of the population. Premature optimization is the source of much programming evil. - Don Knuth
eg
int func1(int i, float fvar, char **names);
3. The first line of a function definition should match the prototype exactly (except for the semi- colon).
eg.
int func1(int i, float fvar, char **names) { ... }
4. The function main should always return 0 upon normal termination. 5. All braces should be on lines by themselves. 6. All control structure bodies should be indented one tab stop. 7. Debugging statements may be left in code if surrounded by #ifdef. For example use #ifdef DEBUG to include print statements within the body of the program for debugging. Debugging statements should appear in the functions being debugged, ie print the return value in the called function not the calling function, if possible. 8. All files should be documented. The form should be:
/*---------------------------------------------------------Filename: func.c Author: Your Name Student #: 184 101 111 routines: func1,func2,func3 -----------------------------------------------------------*/
f() function to be integrated a lower limit of integration must be positive b upper limit of integration must be greater than a returns: Result of the integration -----------------------------------------------------------*/
NOTE: function and file documentation can be combined if a file contains only one function. 10. Do not use macros to create obscure code but use them to define any constants or frequently used constructs. ie: Do not use macros such as:
#define float int That obscure the function of program.
11. Global variables should be avoided where possible. Always start the name of a global variable with a capital letter. For example:
int Counter
12. No goto statements are allowed. 13. Use library functions wherever possible. Always include header files for libraries; eg:
#include <stdio.h> #include <signal.h>
Section 1
Your initial courses will help you develop an understanding of the sorts of knowledge you are expected to master and apply, knowledge to which you yourself may perhaps even ultimately contribute.
four basic learning styles are: the give me a reason style The learner relates the new information to personal experiences in order to give it personal meaning. This learner asks why should I learn this? the teach it to me style The learner absorbs new information provided to them, mainly in the form of concepts and models. This learner asks what should I learn? the let me try it out style The learner experiments with new information by solving problems and relating theory to practice. This learner asks how should I learn? the what if style The learner learns through their own experiences with new information; that is, looking at concepts in a different way. This learner asks what if?
The use of all of these styles in the learning process will enhance a student's ability to learn. Although generally students will favour the learning style most suited to them in the circumstances, they will benefit from improving their ability to use the other styles. It is suggested that as students learn, they should address the key questions: why should I learn this? what should I learn? how should I learn? what if?
Learning strategies You can more successfully improve your learning if you are aware of a range of learning strategies and use those which are most appropriate for the particular circumstances. You receive, process and retrieve information in four main ways-by seeing, by listening, by feeling and doing, or by reading and writing. Generally individuals are dominant in one or two of these sensory channels and so need to adopt learning strategies appropriate to this channel, although by strengthening the other channels it is possible to increase the ability to receive, process and retrieve information. Below are appropriate learning strategies based on each learning method. Seeing Strategies can include: underlining or using colours to highlight readings/notes, graphs, flowcharts, symbols watching videos of lectures or videos of related concepts in lectures, visualising concepts in your mind using images when attending lectures which use overheads and picturesque language, recall information using pictures and drawing diagrams.
Listening Strategies can include: listening to lectures or tape recordings of lectures (this will require you to make your own tapes) discussing topics with other students
reading notes or books out loud to yourself talking and listening to your fellow students recalling information by summarising notes on tapes and listening to them and explaining your understanding to other students.
Feeling and doing Strategies can include: listening to lecturers who relate to real-life examples seeing or thinking of real-life examples by relating to your own experiences to your lecturer or other students doing many application questions in study guides or on computer-aided packages selecting assignments which require some field work recalling information by writing practice answers from previous exams and doing more study guide questions.
Reading/writing Strategies can include: going to lectures where you can take good lecture notes or get good lecture hand-outs re-writing and summarising lecture notes reading many different sources using lists, headings, glossaries writing short essays recalling information by writing and reading many times and arranging your points into hierarchies.
Flexibility is the key to learning: adopt learning strategies which work for you in the circumstances. Different learning methods may be appropriate for different courses or within courses, and at varying times within courses. Working through a training manual and a computer to become familiar with a computer software program uses both the feeling and doing strategies and the reading strategies. Becoming familiar with a theoretical concept involves using the listening strategy and the reading/writing strategy.
Learning-your responsibility
As mentioned above the type of learning required at university requires you, the learner, to be largely self-directed. You will complete some of the reading on your own with guidance from the study guide between lecturer visits. You are given the opportunity to engage in a number of learning experiences such as lectures, reading, writing or group work, and you are encouraged to fully use these opportunities to learn as much as possible about each of the courses. A central tool in organising your learning is the Course information guide provided when you commence the course. The Course information guide outlines: the weekly topics that will be covered the due dates of assignments assessment requirements; that is, assignment questions, exam and test details details of recommended readings.
The Course information guide clearly sets out the expectations of the lecturer of students who are studying in that particular course. In one way the Course information guide may be thought
of as a contract between the lecturer and the student about how learning will be organised. The Course </f