Sunday, 29 March 2020

Structured programming

What is structured programming ?

Techniques that impose a logical structure to the coding of a program in order to make it easy to follow.
Large routines are broken down into small modules that have to be methodically and carefully nested within each other, because the use of the GOTO statement is either discouraged or not available in the language (spaghetti code).

Structured walkthroughs, which invite criticism from peer programmers, are also used.

Structured languages, such as Pascal, Ada and dBASE, force the programmer to write a structured program; however, all programming languages can be written in a structured manner.

Pascal structure :

A Pascal program basically consists of the following parts −

  • Program name
  • Uses command
  • Type declarations
  • Constant declarations
  • Variables declarations
  • Functions declarations
  • Procedures declarations
  • Main program block
  • Statements and Expressions within each block
  • Comments
Sql structured :

used in programming and designed for managing data held in a relational database management system (RDBMS).

For stream processing in a relational data stream management system

It is particularly useful in handling structured data, i.e. data incorporating relations among entities and variables.

Originally based upon relational algebra and  tuple relational calculus , SQL consists of many types of statements which may be informally classed as sublanguages, commonly:

data query language (DQL)
A data definition language
data control language (DCL)
data manipulation language (DML)

The scope of SQL includes :
Data query.
Data manipulation (insert, update and delete).
Data definition (
schema creation and modification).
Data access control.

Although SQL is essentially a 
declarative , it also includes procedural elements.

Vb6 type structure:
The user defined type in Visual Basic 6 is a compound data structure.
It holds several variables of different data 
You can assign values to the member variables of the UDT.

Linked list c++ example :

There are two types of linked lists: a singly-linked list and a doubly-linked list.

The singly-linked list contains nodes that only point to the next node.
The C++ doubly linked list has nodes that can point towards both the next and the previous node.

A node has two parts: the data part and the next part.
The data part contains the stored data, and the next part provides the address of the next node.

The first node of a linked list is called the head, and the last node is called the tail. The list starts traversing from the head, while the tail ends the list by pointing at NULL.

Heap c++ :
Heap data structure can be implemented in a range using STL which allows faster input into heap and retrieval of a number always results in the largest number.

i.e. largest number of the remaining numbers is popped out each time. 

Other numbers of the heap are arranged depending upon the implementation.

No comments:

Post a comment


Contact Us


Email *

Message *