Hello there!

This is my first tutorial.. I present it to my tutor as an assignment. I thought to post it here and sahre it with you. Please do correct me if i'm wrong. I would really appreciate any note.
Please find an image-supported copy, attached as an PDF file.

Cheers,,

Software Design

Introduction

As for architecture, the programmer must make a design for his program to identify the flow of the data, data type and input & output data type. This will also enable programmers to plan how their program will work before they begin the actual coding.

The new program age has evolved so many methods and techniques to meet this need. Writing a small price of paper about the program will keep the developers from confusion and chaos. It will even help the original code writer from getting lost and confused as the code is getting more and more as they try to evolve and improve the performance of the program. It will also help to know what each program in the system will carry out, this is called Program Specifications.


Program Design Techniques


Old design techniques, which includes:

1-Structured Diagrams
2-Flowcharts
3-Pseudo Code

The new age of programming: Event-driven programming



1-Structured Diagrams


This kind of diagrams allows us to draw a diagram for the program and allow us to know how the functions in a program are interrelated. And allow us to know how data parameters are passed between the functions.

Structured diagram has three main types of processing:
1-Sequence: this is where the processing steps follow on one another. With no decision making or loops.
Here is an example:

2-Selection: This is the point at which there is a choice between several processing sequences.
Here is an example

3-teration: this is where sequence of steps is repeated in a loop. This loop will keep looping until a condition is satisfied.
Here is an example:

Advantages of Structured diagrams:
1-Simplicity of design.
2-Ability of using real life language {Non-technical terms}
3-Simplicity of recognizing phases and steps.

Disadvantages:
1-Not suitable for really big programs as it takes time and space to complete it.
2-Unlike Flowcharts, it is somewhat not easy to use Decision and Loop statements.

2-Flowcharts

It is graphic representation of a program in which symbols represent logical steps and flow lines define the sequence of those steps. Used to design new programs, and to document existing programs.

Flowcharts are usually presented as a mass of the following components: {Stages of progression}
1-The Start/Stop: Every program must have a beginning and ending. This is shown using the terminal symbol in combination with the word Start or Stop:

2-Input/Output: When we want to read a record, write a record to a disk or print the record this symbol is usually used.

3-Processing: It is used for any task other than I/O operations and decision including calculating mathematical fields.

4-Decision: It is used to test data for a specific condition. A value returned to the program either Yes or No, True or False. The program Branches to the one sections of code or another based upon this value.

5-On-page connector: Often flowchart will be longer than one column on a page, when this occurs on-page symbol is used to show the continuation of thought.

6-Off-page connector: when a flowchart requires more than one page the connector is used to extend the flowchart from one page to another. The connector pairs are each assigned to the same letter and number to depict they are continuation of thought.


Advantages of using flowcharts:

1-Communication: Flowcharts are better way of communicating the logic of a system to all concerned
2-Effective analysis: With the help of flowchart, problem can be analysed in more effective way.
3-Proper documentation: Program flowcharts serve as a good program documentation, which is needed for various purposes.
4-Efficient Coding: The flowcharts act as a guide or blueprint during the systems analysis and program development phase.
5-Proper Debugging: The flowchart helps in debugging process.
6-Efficient Program Maintenance: The maintenance of operating program becomes easy with the help of flowchart. It helps the programmer to put efforts more efficiently on that part

Limitations of flowcharts:

1-Complex logic: Sometimes, the program logic is quite complicated. In that case, flowchart becomes complex and clumsy.
2-Alterations and Modifications: If alterations are required the flowchart may require re-drawing completely.
3-Reproduction: As the flowchart symbols cannot be typed, reproduction of flowchart becomes a problem.
4-he essentials of what is done can easily be lost in the technical details of how it is done.



3-Pseudo Code

Pseudo code is a short hand way of describing a computer program. Rather than use the specific syntax of a computer language, more general wording is used. Using pseudo code, it is easier for a non-programmer to understand the general workings of the program.

Although there is no standard for pseudo code it is generally easy to write and understand, some of its statements are:
DO, WHILE, If, then Else .. etc.

Operations in Pseudo code are:

1-Input/Output: DISPLAY Used to output values to a data sink, a screen or printer. INPUT, READ Used to get values from a data source, a keyboard for instance
INPUT counter DISPLAY new_value

2-Iteration: REPEAT statement UNTIL <condition> The Repeat ... Until loop which was introduced in the introductory lesson on algorithms. The REPEAT loop executes the statement until the condition becomes true.
DOWHILE <condition> statement END DOWHILE This is the While loop also introduced in the introductory lesson on algorithms. The WHILE loop executes the statement while the <condition> is true.
FOR <var> = <start value> to <stop value> ENDFOR You haven't seen this loop before but it is a special case of the While loop. The FOR loop iterates for a fixed number of steps. The While and Repeat loops can be for a variable number of steps.

3-Decision:IF<condition>
THEN statement
ENDIF IF <condition>
THEN statement
ELSE statement
ENDIF

4-Processing: ADD, SUBTRACT, COMPUTE, SET
ADD 3 TO count
SUBTRACT 5 FROM count
SET count TO 12
COMPUTE 10 + count GIVING new_count

Operators in Pseudo Code:
+ Add
- Subtract
* Multiply
/ Divide
= Assign

Advantages:
1-Easy to learn.
2-Supply you with a full grasp of the problem



The following example shows wage calculation in a pseudo code format.

Start program
Open file
Read a record
Move zero to counter

DOWHILE there are more records
Move employee number and name to report line
IF first-shift THEN
bonus = regular pay x .05
move bonus to report line
ELSE
IF second-shift or third-shift THEN
bonus = regular pay x 0.10 move bonus to report line
add 1 to counter
ELSE
move error message to report line
ENDIF
ENDIF
Write report line
Read a record
ENDDO

Write counter
Close file
End program


Event-driven Programming

Is a method of programming in which blocks of code are run as users do things or as events occur while a program is running. Unlike procedural programming, in which code blocks are contained within a module and called from other procedures.
Event-driven programs are written as programs called Event Handlers. These events occur as a result of a mouse click or moving the mouse across an icon bar or pulling down a menu. In the conventional programming, the sequence of operation is predetermined by the programmer, while in the event-driven programming, the sequence of operation for an application is fully depend on user’s interaction with the program in question.
Necessarily, we have to answer two questions before start creating event-driven procedures,:

1-What has to happen?
2-When should it happen?

The primary advantages of event-driven programming are the following:

1-Flexibility: since the flow of the application is controlled by events rather than a sequential program, the user does not have to conform to the programmer’s understanding of how tasks should be executed.
2-Robustness: Event-driven applications tend to be more robust since they are less sensitive to the order in which users perform activities. In conventional programming, the programmer has to anticipate virtually every sequence of activities the user might perform and define responses to these sequences.
3-Simplicity of Interaction: Offering GUI to user makes it by far easier to interact with the program.

Disadvantages:
1-Tough to learn: it needs time to learn how to create a coherent program.
2-Error Detection: Sometimes it is really pain in the nick to find the source of the errors when they do occur. This problem arises from the object-oriented nature of event-driven applications— since events are associated with a particular object you may have to examine a large number of objects before you discover the misbehaving procedure.

What design techniques has to do with even-driven programming?
Programmer has to write or draw, firstly, the flow of information. In order to make it easier to identify problems. After finishing with the design the programmer start writing the actual code. Hence, the programmer embarks coding with a full grasp of what to do and most importantly when.
A good example is Pseudo code and how it can be translated into another language Here Pascal:
Please check the attached file

The conventional techniques have no flexibility compared with event-driven programming. The objects are more controllable and the user is following his own method without being forced to follow a predefined path of events.


Even-driven programming is by far more efficient and powerful. In the conventional programming design every event is built upon assumption, programmer are just human and might just unintentionally forget one phase or step. The event-driven programming is an open-end technique. We may think of hundreds of possibilities that a user may follow.
The most appealing thing is the GUI, which let the user nicely interact with the program. Visual Basic proves to be a really nice method of interacting; a user might enter a valid entry and watch how the program responds to his/her actions.
Even-driven programming is more likely used with high-level programming languages. The conventional programming techniques can be just as preliminary programming step toward more coherent and error-free program.


[EOF]

I am terribly forry fo the bad format. You can find the attached file for better reading and presenting.