PLT Final Book
PLT Final Book
of
Programming Logics
and
Techniques
[First Edition 2018]
Published by:
A G EMENT
COLLE G E O
EN
F
2000 AD
GINE &
ERING
I would like to thank all the personalities and organizations who have supported
me directly and indirectly but most gratefulness goes to Mr. Binod Babu Paudel
who has edited this book thoroughly. Thanks also go to Mr. Nava Raj Gautam
for English corrections and suggestions. All the students who are studying at
Oxford College of Engineering and Management in BCA program deserve
thanks for their help to make this book student friendly.
I would also like to thank Mr. Nabin Shrestha for his beautiful design of inner
and cover pages.
I am highly grateful to all my department heads and seniors for their valuable
suggestions.
Programming Languages
Unit-1
Objectives
Computer Language
Language is the normal way humans communicate. Only humans use language, though many
other animals communicate in various ways.
Human language has syntax, a set of rules for connecting words together to make statements
and questions. Language can also be changed, by adding new words, for example, to describe
new things. Other animals may inherit a set of calls which have pre-set functions.
Communication may be made by speech or by writing or by moving the hands to make signs. It
follows that language is not just any way of communicating. Even some human communication
is not language: see non-verbal communication. Humans also use language for thinking.
Many definitions of language have been proposed. Henry Sweet, an English phonetician and
language stated: “Language is the expression of ideas by means of speech-sounds combined
into words. Words are combined into sentences, this combination answering that of ideas
into thoughts.” The American linguists Bernard Bloch and George L. Trager formulated
the following definition: “A language is a system of arbitrary vocal symbols by means of
which a social group cooperates.” Any succinct definition of language makes a number of
presuppositions and begs a number of questions. The first, for example, puts excessive weight
on “thought,” and the second uses “arbitrary” in a specialized, though legitimate, way.
The world is controlled through the flow of information. The information can be communicated
through various mediums like signals, sounds, music, certain key stocks (coding) etc.
Therefore, a language is the means of communication so that people can easily understand
the meaning. Hence, language can be called as system of communication.
A Language is system or means of communications. Language can be classified into 2 groups
in general sense: -
1. Natural Language 2. Computer Language
Natural Language
It is a means of communication used to communicate in between human beings. Some
examples of the natural languages are Nepali, English, French, German etc. Certain symbols
and letters form natural languages. These symbols and letters can be understood by human
beings, so means of communication is established at some points. The features of natural
languages are
1. It has large vocabulary.
2. Human beings use knowledge for the communication.
3. Energy consumption is different in different stage.
010
1 Programming Logics & Techniques
1 | Programming Language
Computer Language
It is a means of communication between a computer and an operator. This is also called
programming language. In computer language, certain commands or syntax or keystroke are
used to communicate in between the computer and the user. Some points: -
1. It has limited vocabulary as compared to natural language.
2. Computer can't think, so there is use of logic and ideas only.
3. Energy consumption during any stage is the same.
A programming language consists of all the symbols, characters and usage rules that permit
the user to communicate with computer. To learn a program, we have to learn all these
symbol and rules. There are many programming languages available and each one has its own
symbolic characters set and syntax but each language has an instruction set that permits those
operations to be performed.
Computer Program
The set of instructions, which is given to the computer in systematic manner to obtain specified
task in efficient manner, is called computer program.
A program is like a recipe. It contains a list of ingredients (called variables) and a list of
directions (called statements) that tell the computer what to do with the variables. The
variables can represent numeric data, text, or graphical images.
In another way a computer program is a list of instructions that tell a computer what to do.
Everything a computer does is done by using a computer program. A computer program is written
in a programming language.
There are many programming languages: BASIC, FORTRAN, COBOL, Pascal, C, C++,
Oracle, Java, and LISP are just a few. These are all high-level languages. One can also write
programs in low-level languages called assembly languages, although this is more difficult.
Low-level languages are closer to the language used by a computer, while high-level languages
are closer to human languages.
2. High-level Language
This is some developed form of low-level language because low level language is in coded
format but high-level language is in our understandable format. Therefore, the written
program is systematic basic building of language syntax. A high-level language consists of a
set of words and symbols plus rules for using them to describe a problem or to describe the
procedures for solving a problem or doing the processing for an application. The language is
oriented toward the problem to be solved or procedures for solutions rather than the computer
212
1 Programming Logics & Techniques
1 | Programming Language
instructions. This language can't perform final result without help of middle language called
interpreter or compiler. Some examples of the high-level languages are C, Basic, Turbo C,
FoxPro, Fortran, VB.Net, Oracle, Java, PHP etc.
Machine Language
Machine language is the fundamental language of computer. It is similar to low level
language. Although computers can be programmed to understand many different computer
languages, this is the only one language understood by the computer directly without using
a translation program. It has only two levels upper and lower level indicated by 1's and
0's. These are called machine codes therefore binary number is called computer number
or machine number. The flow of information is called signal which computer can directly
understand and relay the information directly to the computer memory. So without interpreter
or compiler it gives the final result. In 1937 Claude E. Shannon had described the use of
Boole's symbolic logic and binary number in design of electrical calculators (Claude Elwood
Shannon (April 30, 1916 – February 24, 2001) was an American mathematician, electrical
engineer, and cryptographer known as "the father of information theory"). The use of binary
system was promoted for use in computer because any switching device like a switch, relay,
diode, transistors, and flip flop could have only two states of operations, ON (1) and OFF (0),
i.e. a binary state device.
A machine language would have two parts. The first is command or operation. Every Computer
has an operating code or opcode for each of its functions. It tells the computer what functions
are to be performed. The 2nd part of the instruction is the operand that tells the computer
where to find or store the data or other instructions that are to be manipulated. All the above
functions are directly controlled by the CPU.
Opcode Operand
(Operation Code) (Address/ Location)
414
1 Programming Logics & Techniques
1 | Programming Language
It is necessary to keep high memory to store machine codes and machine instruction set
which is practically more difficult to memories and has to refer the reference cards. A
programmer is also forced to keep the track of the storage location of data and instructions.
Therefore, a machine language programmer must be an expert who knows about the
hardware internal structure and its mechanism of the computer.
3. Error Prone (Occurs)
Writing a program is very difficult because it is necessary for the programmer to remember
the opcodes, track of storage data and instructions. It creates high possibility to generate
errors in the program.
4. Difficult to Modify:
To modify the errors in the program is very difficult for the programmer. Locating the
errors and correcting them is really tedious task, therefore programmers want to develop a
new program rather than correcting the errors in the old program. The programmer should
start the correction worth from the hardware part itself.
5. Time Consuming and Expensive
Although each instruction is simple, a very large number of them are required for
even the smallest program. As we know that it is difficult to write and modify the
program which takes more time for all.
6. Increase the Training Cost
Machine language requires a high-level of programming skill. This increases programmer’s
training cost.
7. Cumbersome (Weighty) process
Machine languages require programmers to control the use of each register in the
computer's Arithmetic Logic Unit. This is very cumbersome process perhaps comparable
to requiring automobile drivers to keep track of the firing order of their engines' cylinders.
Assembly Language
To reduce the programmer's burden, mnemonic operation codes and symbolic addresses were
developed in the early 1950s. One of the first steps in improving the program preparation
process was to substitute by letter or symbols-called mnemonics for the numeric operation
codes of machine language. A Mnemonic (memory aid) is any kind of mental trick. That is
used to provide metal help. In assembly language, mnemonics is used to represent operation
codes and strings of characters to represent addresses. As an assembly language is designed
mainly to replace each machine code with an understandable mnemonic and each address
with a simple alphanumeric string, it is matched to a particular computer's processor structure.
It is thus machine dependent. It is necessary for an assembly language programmer to know
all details of a computer's logical structures in order to write a program. It thus suffers from
many of disadvantages of machine language.
The mnemonics and operation code of certain number are given in table
Mnemonics Address Memory location Opcode Meaning
HLT 1000 0000 00 End the program or stop the program
CLA 1001 0001 10 Take the value
ADD 1002 0002 14 add the value
SUB 1003 0003 15 Subtract the value
STA 1004 0004 30 Store the value
An assembly language is a low-level language as its translation to machine language is one-
to-one.
616
1 Programming Logics & Techniques
1 | Programming Language
3. Time Consuming
A machine (computer) can't execute an assembly language directly. This language has
to be translated first into machine (binary) language code after developing a program in
assembly codes, so the assembly language program is not as fast as the machine language.
4. High skilled Programmer
An assembly language programmer must be an expert who knows all about the logical
structure of the computer. So, program development is costlier.
High-level Language
This is a special kind of language where the limitations of low level languages are overcome
by introducing new system, called interpreter or compiler known as translator.
The development of mnemonic technique and macro-instruction led to the development of
high-level languages that are often oriented towards a particular class of problems.
In common sense, high-level language is written in English word (Natural Language) and
important mathematical symbols. Therefore, to write a program is very simple as compared
to other languages.
High-level language is not oriented to the machine based to solve the problem. Therefore,
programmer can easily identify as well as correct the errors.
Unlike assembly programs, high-level language programs may be used in different tasks
with little modifications. Thus, re-programming expenses may be greatly reduced when new
equipment is acquired.
High-level languages are also known as problem oriented languages because the micro
instructions are especially picked to be useful for routing particular class of problems and
may be completely useless for routing other types of problems. e.g. if a high-level language
is capable of handling business type application that consists of input volume relatively little
processing and a high output volume. Therefore, it is called business-oriented language. On
the other hand, this language is excellent at performing sophisticated or complex computation
but not adapted to handling large data files and is mathematical oriented language.
Some examples of high-level language are Basic, Fortran, COBOL, Pascal, PL/1 (Programming
language one), C, C++, VB.Net, Oracle, Java etc.
818
1 Programming Logics & Techniques
1 | Programming Language
• Lack of Flexibility
It has less flexibility as compared to low level language because the high-level language is
not directly related to the components of the computer. Therefore, flexibility of language
is reduced. Assembly and machine languages provide programmer access to all the special
features of the machine whereas this is not possible in the case of high-level languages.
E.g. a Fortran compiler is only capable of translating source program, which have been written
in Fortran. Moreover, since an object program for one machine will not be the same as the
object program for another machine, it is necessary that each machine must have its own
specific compiler for particular language.
A Compiler creates a unique object program when a source program is compiled. There is no
need of the source program code. Output can be obtained by executing that object program.
During the process of translation, the compiler reads the source program statement-wise or
block-wise and checks the syntax (grammatical) errors. It can't check logical error. If there
is any error, the computer generates a printout of the error it has detected and this action is
known as diagnostic.
For whole error debugging compiler is faster than interpreter. Compilers are large programs,
which reside permanently on secondary storage. When the translation of a program is to be
done, they are copied into the main memory of the computer. The compiler being a program
is executed in the CPU.
3. Interpreter
An interpreter is also a translator, which translates high-level language into machine code. It
translates each source program statement into a sequence of machine instructions and then
executes the machine instructions before translating the next source language statement.
Interpreter translates line by line and reports the error once it encounters during the translation
process.
It directly executes the operations specified in the source program when the input is given by
the user.
It gives better error diagnostics than a compiler.
Source Program
Interpreter Output
Input
Interpreters are also unique for each high-level language. Basically, the function of an
interpreter and a compiler are the same. The only difference is that a compiler provides a
separate object program whereas in an interpreter no object code is saved for future use. It
must once again be interpreted and translated into machine language every time the source
program is needed. Here line-by-line execution takes place and if it finds error in any line then
stops or it wouldn't execute the next line unless the first one has no error.
Interpreters are often employed with microcomputer (small computers). The advantage of an
interpreter over a compiler is fast response to change in the source program.
Interpreters are easy to write and they do not require large memory space in the computer. The
interpreter, however, is a time-consuming method because each statement must be translated
every time it is executed from the source program. Thus, a compiled machine language
program runs much faster than an interpreted program.
222
2 Programming Logics & Techniques
1 | Programming Language
Loader
Source Object Executable Data Results
Translator Linker Execution
Program Program
Code Relocator
It is clear from the above figure that loading and linking processes occur simultaneously.
The function of the loader is to read object codes and load them into memory specified by the
assembler.
Loader
It is responsible for loading, linking and relocation. The basic functions of the loader are as
follows:
• To assign a load time storage area to a program - storage allocation.
• Making a program to execute properly from its load time storage area - program
relocation.
• Keeping the program into assigned memory area - loading.
• Linking of programs with one another-linking.
In another way, the basic function of the loader can be explained as:
• Allocation: The space for program is allocated in the main memory, by calculating
the size of the program.
• Loading: Bring the object program into memory for execution.
• Relocation: Modifies the object program so that it can be loaded at an address different
from the location originally specified.
• Linking: Which combines two or more separate object programs and supplies the
necessary information.
Types of Loaders
Absolute Loader
The absolute loader is the simplest and quickest type of loader. This loader is a primitive type
of loader that executes only the loading function. It loads the object program from translation
time address and simply transfers control to it. The loader loads the file into memory at the
location specified by the beginning portion (header) of the file, then passes control to the
program. If the memory space specified by the header is currently in use, execution cannot
proceed, and the user must wait until the requested memory becomes free. It doesn't perform
linking and program relocation.
Bootstrap Loader
A bootstrap loader is a computer program that loads the main operating system into the RAM
of the computer through ROM. When the computer is turned on, absolute loader is executed.
This loader is responsible for loading the operating system and transferring control to it. The
bootstrap loader is present in the ROM area of main memory.
Re-locatable Loader
This loader is responsible for relocation and loading. The relocating loader will load the
program anywhere in memory, altering the various addresses as required to ensure correct
referencing. It is some time also known as direct linking loader.
424
2 Programming Logics & Techniques
1 | Programming Language
Compiler Assembler
Source Pre-processed Assembly Object
Program source code code code
Pre-processor Linker
Executable
code
Main Memory
Fig.: Compile of process of C program
Type of linker
Linking Loader
The linking loader performs all linking and relocation operations and loads and linked program
directly into the main memory for execution. The functions can be pointed as:
• Shifting the instruction to the brain of the computer.
• Relocating – Managing the instructions.
• Storing into main memory.
Linking Editor
After storing the information into main memory, it is checked for correction. A linkage editor
produces a linked version of the program called the Load Module or an Executable Image.
This load module is written onto file or library for execution at a later stage.
Dynamic Linker
The total duration of the program execution is the dynamic period. This scheme postpones
the linking function until execution time. Any subroutine is loaded and linked to the rest of
the program when it is first called. This type of linking is called dynamic linking, dynamic
loading or loads on call.
626
2 Programming Logics & Techniques
1 | Programming Language
through the program, starting at the top and continuing through till the end. When you need to
carry out a discrete task, especially one that might be carried out multiple times, you pass the
control to a function, which does a specific set of actions, and then returns a value. Examples
of procedural languages include BASIC, Pascal, and C, although there are many others.
A procedural language is also known as imperative language.
Most of 4GL languages are used to get information from file and database. Therefore, most
of the database software belongs to this group such as ORACLE, ORACLE developer 2000,
FoxPro for windows etc. They are SQL languages. Simply it is sequential query language or
sometimes it is also known as structured query language.
Many 4GLs are associated with databases and data processing, allowing the efficient
development of business-oriented systems with languages that closely match the way domain
experts formulate business rules and processing sequences. Many of such data-oriented 4GLs
are based on the Structured Query Language (SQL), invented by IBM and subsequently
adopted by ANSI and ISO as the standard language for managing structured data.
Most 4GLs contain the ability to add 3GL-level code to introduce specific system logic into the
4GL program. The most ambitious 4GLs, also denoted as Fourth Generation Environments,
attempt to produce entire systems from a design made in CASE tools and the additional
specification of data structures, screens, reports and some specific logic..
DDL and DMLs may be either free standing or embedded in another language. The combination
of DDL and DML is often called a Data sub language (DSL) or even a just query language.
DDL - Data Description Language – used to specify database
DML - Data Manipulation Language – used to access data
The 4GL languages are used to develop various kind of application development softwares.
They are
a. Personal computer application software
b. Query languages and report generation
c. Decision support systems and financial planning languages
d. Application generators
Personal Computer Application Software
The personal computer application softwares like word-processing, spreadsheets, database
managers, business application etc. can be easily developed using 4GL. Using these tools, we
can solve our own problems.
Query Languages and Report Generation:
The query languages and report generating software can be prepared using 4GL. They are
mostly used to search the record from the database server. This group of software is mostly
used in business houses, railway, airlines, bus etc. ticket reservation. Some common query
and report generation languages are QBE, SQL, HAL, Answer/Database, PDQ, INQUIRE,
QMF, PRG III etc.
Decision Support Systems and Financial Planning Languages
This group of software is used to analyse the decision made by the decision support group
of the financial and planning sectors managers. The strong mathematical, statistical and
logical analysis decision is necessary during this period. Some examples of this software are
Application System, Command Center, Express, FCS, and System W etc.
828
2 Programming Logics & Techniques
1 | Programming Language
Application Generators
This software section meets the requirement of the application users. According to the
user requirement, the module of the program can be generated. The various module of the
program is developed and based on the application. The required module of the program can
be selected. Some examples of the application generators are FOCUS, INGRESS, MARK V,
TELON, UFO etc.
Features of 4GL
A 4GL may be regarded as being very high-level language whose features and characteristics
are same as OOPS languages, which provide simple and powerful ways for the user to do
such things as:
• Define Data
• Define what processing must be performed on the data.
• Define report or screen-form layouts including the formats of printed or displayed data.
• Define the processing operations to be carried out in the preparation of report or in the
user’s interaction with screen base forms.
• Define input data and validation checks.
• Select combinations of standard processing operations.
• Handle user varies.
• Depending upon the way in which the 4GL have been designed, it may either be used by
the end user directly or used by a computer specialist to “build” an end-user system.
• Thus, the 4GL either works by tailoring a generalized piece of software to handle a
particular application or by using a general set of software tools to construct a particular
application system.
• 4GL can be used to build prototypes of new systems as well as for building in the right
way.
4. Language developed for batch operation. 4. Language developed primarily for on-
line operation.
5. Can be difficult to learn 5. Easy to learn
6. Difficult to debug. 6. Easy to debug.
7. Typically file-oriented. 7. Typically database-oriented.
8. All alternatives must be specified in the 8. Default alternatives are built in; an end
program user need not specify these alternatives.
9. Requires specification of how to 9. Requires specification of what task is to
perform tasks. be performed (system determines how
to perform the task)
10. Professional programmers are needed to 10. May be used by a non-programming
operate the program end user as well as a professional
programmer.
• Flow-Matic
FLOW-MATIC, originally known as B-0 (Business Language version 0), was the first
English-like data processing language. It was developed for the UNIVAC I at Remington
Rand under Grace Hopper during the period from 1955 until 1959. It had a strong influence
on the development of COBOL. This was a commercial and business language, which could
easily be put together from contents of flowchart.
First, FLOW-MATIC was the first programming language to express operations using English-
like statements.
Second, FLOW-MATIC was the first system to distinctly separate the description of data from
the operations on it. Its data definition language, unlike its executable statements, was not
English-like; rather, data structures were defined by filling in pre-printed forms.
• Mathematics
This was a mathematical language used for mathematics purpose.
After this, many other high-level languages have been produced. Today there are over 200
high-level languages. Some of them are:
030
3 Programming Logics & Techniques
1 | Programming Language
The work on the language began in 1959 with strong support from the United States
department of defense under the guidance and command of Grace Murray Hopper. The
maintenance and further orderly growth of the language was handed over to a group called
CODASYL (conference on Data Systems Language). The first formal COBOL report was
published in 1960 and revised in 1965.
The version was gradually improved, ANSI standardized COBOL in 1968, 74 and 84. Object
oriented version of COBOL has recently (1997) appeared in the market. COBOL is a widely
used Programming language for business data processing. It is not used for general purpose
and scientific purpose. It is lengthy type of program.
A COBOL program is divided into 4 parts or divisions. These divisions describe 4 main
aspects of a program and are called Identification Division, Environment division, Data
division and procedure Division.
4) BASIC
Basic stands for Beginners All-purpose Symbolic Instruction Code. It was developed at
Dartmouth College, U.S.A in 1963 by Dr. John G. Kemeny and Thomas E. Kurtz. It is the
most popular computer language, which is used for general purpose. The language is designed
for a beginner and can be learnt quickly. As the Program is entered, it is checked by syntax
errors, which can be immediately corrected. The translator for BASIC is thus interpreter.
BASIC is available on all personal computer and even in some pocket computers. The main
characteristic of BASIC is to handle both mathematical and business problems. It can be used
for creating sound graphics. This language is easy to understand but the main problem is that
most versions of this language do not support indexed file. Some versions are Apple BASIC,
Ting BASIC, GWBASIC, and QBASIC. It is procedure language that we give information
step by step. QBASIC has its self-compiler and has hanging menu driven system. QBASIC is
more advanced than GWBASIC.
5) PROLOG
PROLOG stands for programming in LOGIC. It was developed in France in 1972. It is
very popular in Japan where it is adopted as the official programming language for the fifth-
generation computers.
Prolog is a general-purpose logic programming language associated with artificial intelligence
and computational linguistics.
Prolog has its roots in first-order logic, a formal logic, and unlike many other programming
languages, Prolog is declarative: the program logic is expressed in terms of relations,
represented as facts and rules. A computation is initiated by running a query over these
relations.
The language was first conceived by a group around Alain Colmerauer in Marseille, France,
in the early 1970s and the first Prolog system was developed in 1972 by Colmerauer with
Philippe Roussel.
232
3 Programming Logics & Techniques
1 | Programming Language
As the name suggests, PROLOG lays stress on the usage of logic to solve problems. We
can simply say that it is a logical language and the system is controlled through logically.
It is basically known as a theorem-proving system, using a formal logic technique known
as predicate calculus to prove the truth of propositions. Programmers avoid the usage of
PROLOG because we feel that it does not offer flexibility. It is a conventional language.
6) PASCAL
PASCAL is a programming language named after Blaise Pascal, the famous French
mathematician who built one of the early calculating devices in 1642. This language was
designed by Prof. Niklaus Wirth in 1970 at Eidgenossisehe Technisehe Houcheshule (ETH)
in Zurich, Switzerland. With the primary aim of providing a language which helps beginners
to learn good problem solving and programming methods, the 1st report on the language
appeared in 1971 and report describing the language with its improvements appeared in
1972-73.
PASCAL is a general-purpose language that can be used for a wide range of numeric and
non-numeric applications. Pascal is an imperative and procedural programming language.
It is like C language. There is 90% similarity. So, we can say that C is developed form of
PASCAL. 90% of command of C can be used in PASCAL.
PASCAL has been standardized by International standards organization (ISO) and ANSI. It
has facilities to manipulate not only numbers, but also vectors, matrices, strings of characters,
sets, records, files and lists.
7) C Language
C was developed by Dennis Ritchie in 1972 in Bell Telephone laboratories in U.S.A.
C has been defined so that it has the advantage of high-level language, namely, machine
independence. C is a general-propose structured programming language. It is characterized by
the ability to write very concise source programs. The compiler of C is commonly available
for the computer of all sizes. The compilers are usually compact and they generate object
programs that are small and highly efficient as compared to the programs written in any other
language. C was the modified versions of two earlier languages BCPL and B, which were also
developed at Bell Laboratories.
The 1st major use of C was to write an operating system known as UNIX. The current popularity
of C is due to its efficiency and its connection with UNIX. An aspect of C, which makes it a
powerful programming language, is the access it provides to the addresses in memory where
variables are stored. These addresses are known as pointers. The access to pointers and the
operations which can be performed with pointers is what distinguishes C from other high-
level languages, such as FORTRAN and COBOL. Pascal does provide pointers but restricts
their use. The main disadvantage of C, particularly for a beginner, is its conciseness and
extensive use of pointers.
9) JAVA (1998)
Java is a language primarily used for internet-based applications. Its development started at
Sun Microsystems. It was lead by Programmer James Gosling.
1995/96 - 1st version (Concept)
1997 - Modified version.
1998 - 1.2 Java (full version)
It was developed to overcome the complex terms and hypothesis of C++. It has following
features:
The compiled code should be machine-independent (recall that the compiled code of other
high-level languages is machine dependent).
The developed programs should be simple to implement and use even in consumer electronics
products like TV set-top boxes, hand-held devices, telephones and VCRs.
All the high-level languages are machine independent languages because they are not directly
related to the internal architecture of a computer. The low-level language is called machine
dependent language because they depend on computer architecture to architecture.
All high-level languages are problem oriented languages i.e. they reflect the type of problem
solved rather than the features of the machine. Source programs are written in statements
similar (akin) to English, a great advance over mnemonics of assembly language. Each and
every high-level language are not physically dependent. It means no one high-level language
is based on internal hardware part and the manufacturing principle. Whatever the hardware
development occurs on basic memory (RAM and ROM), CPU, cache memory, VGA/AGP,
434
3 Programming Logics & Techniques
1 | Programming Language
Data-bus memory, Dynamic (DRAM) as well as RPMS (Revolution Per Minutes), there is
no great impact to the language. Specially, high-level language may depend on capacity of
computer to load the software into the memory. Even though the claims for transferability
or portability of programs and programmer training are sometimes exaggerated, since the
languages implemented by different manufacturers are not really identical. A few differences
can be explained by machine differences, but beyond that there is a great temptation for every
implementation to add extra features that are considered desirable. These features, regardless
of how valuable they may be detracted from the ability to move a program or a programmer
to another installation that uses a different system.
High-level language is machine independent which is one of the very important features of
high-level languages
Portability
Due to the above various features of the high-level language, program can be very easily
transferred from one type of computer configuration to another type of computer configuration.
Portability in high-level computer programming is the usability of the same software in different
environments, so that the market availability and flexibility of the program will highly increase
and hence price of program will decrease. Therefore, high-level language has more portability.
The program transferable feature is called portability of a program. (High efficiency)
Software portability may involve:
• Transferring installed program files to another computer of basically the same architecture.
• Reinstalling a program from distribution files on another computer of basically the same
architecture.
• Building executable programs for different platforms from source code; this is what is
usually understood by "porting".
Questions
Solve the following questions. (each question carries 7/8 Marks)
1. What is natural language? “high level language is better than low level language”. Justify
this statement.
2. Define programming language. List out the advantages and disadvantages of high-level
language.
3. What is interpreter? Differentiate between compiler and interpreter
4. Define 4GL. Explain the use of 4GL with its merits and demerits.
5. Explain the computer programming language generations with classification diagram.
6. What are the functions of language processor? Compare and contrast compiler and
interpreter with functional diagram.
7. What is a linker? Explain the need of machine independence and portability of programs.
8. Discuss the need of loader and linker. Is it essential for a programming language to
attain machine independence? Justify you answer with reference to some well-known
programming language.
636
3 Programming Logics & Techniques
2 | Program/Software Development (Specification)
Program/Software Development
(Specification) Unit-2
Objectives
This unit has following objectives:
1) To give conceptual knowledge to the students for program
development
2) To analyze the program developing steps through program/
system development life code
3) To create general idea to students for tentative budget
requirement to develop a program.
4) To generate good programming skills and logics through
programming tools (Algorithm, flowchart, decision table,
pseudo code etc).
5) To develop overall creative, logical and analytical thoughts
for basic requirement and steps to make effective and
efficient program development.
Start
Preliminary
investigation
Re-development Feasibility
Study
System Conversion
or Implementation System Design
System Testing
and Debugging System
Development
Fig.: SDLC
Preliminary Investigation
Preliminary investigation is the first phase. In this phase, the system is investigated. The
objective of this phase is to conduct an initial analysis and findings of the system. The
following stages are studied in this phase. The main aim of preliminary analysis is to identify
the problem. First, need for the new or the enhanced system is established. Only after
the recognition of need, for the proposed system is done then further analysis is possible.
Preliminary investigation can be called understanding of problem/problem definition/system
concept/system study/preliminary analysis/initial investigation etc.
The programmer or system analyst can only develop the program, if he/she is familiar about
the candidate system or program. Therefore, the following two initial points about the program
development are very important.
Programming Logics & Techniques 39
39
2 | Program/Software Development (Specification)
- The system analyst or programmer must exactly know what we are trying to do.
- The system analyst or programmer must have working experience about the project
so that he/she confirms about how the task should be done.
For example, if you want to develop a program of the library, then you must understand about
the library management system. That is order-keeping system, book keeping system, book
issuing system, book analyzing system etc. In this case, the user and programmer must know
about the pattern of the problems and their probable solutions. Hence, it is also known as
problem definition. Problem identification is also the similar concept, but users and system
analysts or programmers are more familiar with the problems and their correct solutions.
The problem identification is the concept of getting good decision about the solutions of the
problems. The problem must be stated clearly, understood, and agreed upon by the user and
the analyst (programmer). It must state the objectives, the user is trying to achieve the results
and user wants to see. Emphasis should be on the logical requirements.
The first responsibility of a system analyst is to prepare a written statement of the objectives
of the problem. Based on interviews with the user, the analyst writes a brief description of
his/her understanding of the problem and reviews it with both the groups. People respond
to written statements. They ask for clarifications and they correct obvious errors or
misunderstandings. That is why a clear statement of objectives is important. In other words,
proper understanding of the problem is essential to discover the cause of the problem and to
plan a directed investigation by asking questions like what is being done. Why? Is there an
underlying reason different from the one the user identifies? Following are some possible
definitions of problems:
• The existing system has a poor response time
• It is unable to handle the workload.
• The problem of cost, that is the economic system is not feasible.
• The problem of accuracy and reliability
• The required information is not produced by the existing system
• The problem of security.
Preliminary investigation is study of the system. This is a brief investigation of the system un-
der consideration and gives a clear picture of what actually the physical system is? In practice,
the initial system study involves the preparation of a System proposal which lists the Prob-
lem Definition, Objectives of the Study, Terms of reference for Study, Constraints, Expected
benefits of the new system, etc. in the light of the user requirements. The system proposal is
prepared by the System Analyst (who studies the system) and places it before the user man-
agement. The management may accept the proposal and the cycle proceeds to the next stage.
The management may also reject the proposal or request some modifications in the proposal.
In summary, we would say that system study phase passes through the following steps:
• Problem identification and project initiation
• Background analysis
• Inference or findings
040
4 Programming Logics & Techniques
2 | Program/Software Development (Specification)
Feasibility Study
It is the primary study about the system or program for evaluation. For example, a programmer
is going to write a program about linear equation of poultry industry, for this programmer
should study about number of poultry farms in that locality, social position about that industry,
market consumption environment, investment planning etc. The total study report about that
industry at the primary stage is called feasibility study. Therefore, sometimes feasibility study
is also called second phase of preliminary study.
After a problem has been defined in the problem phase, the selection committee requests the
information system department to conduct a feasibility study. The feasibility study determines
the best method to achieve the objectives of new information system that would solve the
problem. Feasibility study is the one of the important study about the program (system) which
expresses the real image of the project or system. There are following types of feasibility
studies.
1. Economic Feasibility
It is the feasibility study to find out the monetary and non-monetary benefits of the project.
It measures the cost-effectiveness of a project or solution. This is often called a cost-benefit
analysis. It puts the question. Is it possible to build a new information system with the available
resources? Similarly, the programmer (analyst) raises various financial questions during the
preliminary investigation of economic feasibility phase.
By conducting this study, the analyst can ascertain the following:
• Whether the project is economically feasible.
• If enough funds are not available, then what are the alternative sources of fund
generation?
• Whether there are sufficient benefits when compared to the costs incurred?
2. Operational Feasibility
The operational feasibility measures the operating requirements of the organization, like
support from the management, users, builders etc. It is also a measure of how people feel
about the program or project.
There are the two aspects of operational feasibility to be considered
1. Is the problem worth solving, or will the solution to the problem work?
2. How do the end-users and management feel about the problem (Solution)?
The above two points cover the performance, information, economy, control, efficiency and
service of the system. The following questions also arise in this feasibility report.
• Does management support the system?
• How do the end-users feel about their role in the new system?
• What end-users or managers may resist or not use the system?
• What is the working environment?
So, it is advisable that the system analyst must consider all the operational aspect carefully.
Programming Logics & Techniques 41
41
2 | Program/Software Development (Specification)
3. Technical Feasibility
It is a measure of the practicality of a specific technical solution and the availability of technical
resources and expertise. For example, existing computer system (hardware/software). There
are a number of technical issues that are generally raised during the feasibility stage of the
investigation.
• Is the proposed technology or solution practical?
• Do we currently possess the necessary technology?
• Do we possess the necessary technical expertise, and is the schedule reasonable?
• Does the data security, accuracy, reliability occur?
5. Social Feasibility
The social feasibility is a determination of whether a proposed project would be acceptable to
the people of the society or not.
6. Management Feasibility
It is a determination of whether a proposed project would be acceptable to management or
not. If management does not accept a project or gives a negligible support to it, then system
analyst would tend to view the project as non-feasible.
7. Legal Feasibility
It is a determination of whether a proposed project would be acceptable to the act, status as
well as any other pending legislation.
8. Political
Political influence is one of the important factors to any types of the system development
and more over any fields. The system should be analysed in term of political situation and
condition which is favorable or not.
242
4 Programming Logics & Techniques
2 | Program/Software Development (Specification)
Summary
Feasibility Study
In case the system proposal is acceptable to the management, the next phase is to examine
the feasibility of the system. The feasibility study is basically the test of the proposed system
in the light of its workability, meeting user’s requirements, effective use of resources and
of course, the cost effectiveness. These are categorized as technical, operational, economic,
schedule and social feasibility. The main goal of feasibility study is not to solve the problem
but to achieve the scope. In the process of feasibility study, the cost and benefits are
estimated with greater accuracy to find the Return on Investment (ROI). This also defines
the resources needed to complete the detailed investigation. The result is a feasibility report
submitted to the management. This may be fully accepted or accepted with modifications
or rejected. In short, the following decisions are taken in different feasibility study:
Economic feasibility - The likely benefits outweigh the cost of solving the problem which
is generally demonstrated by a cost/benefit analysis.
Operational feasibility - Whether the problem can be solved in the user’s environment
with existing and proposed system workings?
Organizational feasibility - Whether the proposed system is consistent with the
organization’s strategic objectives?
Technical feasibility - Whether the problem be solved using existing technology and
resources available?
Social feasibility - Whether the problem be solved without causing any social issues?
Whether the system will be acceptable to the society?
- By Questionnaires
In this method of data collection, the system analyst or programmer distributes the
questionnaires and gets the response from the respondents. In this case the collection
of the data is very difficult because the collecting of the small data from the large
group of people is associated. The main advantage of this method is that a large
number of people can participate, so it is less time consuming and almost pure data
are collected. The field data collection is also one way to capture the data.
- On-site Observation
In this method, the programmer collects the data by absorbing the actual jobs, which
take place in the organization. Out of all fact-finding methods, this method is more
reliable. It is also time consuming but real data can be collected.
- Record Inspection
In this method, the system analyst goes through the documents of the organization
to collect requirements. The organizational documents usually include policies, rules
and guidelines. The document also gives details of the executives and directors to
whom the decision-making power lies.
- Data Analysis
The data analysis is a section of the system analysis. The technique used to improve a data
model in preparation for database design is called data analysis. In another sense, it is a
process that prepares a data model for implementation as a simple, no redundant, flexible,
and adaptable database. The specific technique is called normalization. After capturing the
necessary data to the project, the data validation should be done. The process of checking
the data at the time of data inputting and outputting is called data validation.
• Requirement Analysis (Programming Requirement and Analysis)
The term requirement analysis expresses two concepts. One is, what are the necessary
requirements to build the system (Program)? The hardware and software requirement also come
under the requirement analysis. The input, output and process requirement of the program.
For example, to develop a mark-sheet program, a programmer needs to input items (data and
format), process system and result format etc. They are the program requirement analysis.
Another concept is, what is the objective of the system builder, to user and the system owner?
It means, why do they build the system? All these points have to be understood by the system
analyst (programmer). The more emphasis should be given to the user's requirement within
the framework of the organization's objectives and the environment in which the system is
being installed. The consideration is given to the user's resources as well as to finances. To get
better performance and popularity of the program, the programmer should think of various
points. These points are helpful to design effective program. Some of the important points of
requirement analysis to develop efficient program are:
1. Program designing style and presentation.
2. Program reliability
444
4 Programming Logics & Techniques
2 | Program/Software Development (Specification)
3. Program efficiency
4. Program maintainability
5. Readability
6. Program development time period
7. Program development cost
8. Program documentation.
System Design
In the system design process, the primary objective is to identify user requirements and to build
a system that satisfies these requirements in the form of blueprint or softcopy format. The design
of system is mostly the logical design. These specifications, called the logical system design,
include the details of output, input files, database interaction, controls, procedures and reports.
The system design is the design of the system (program) and how this system would work.
Therefore, the most challenging and creative part of the system development life cycle is the
design of the system. Simply, it can be defined as giving proper shape and size to the program.
To get efficient output of the program the following things should well be designed.
- Output design
- Input design
- File design
- Procedure design
- Output Design
Giving the outer framework of the program or the system is known as output design.
The computer output is the most important and direct source of information for the user.
Efficient and user-defined output design should improve the system's relationships with
646
4 Programming Logics & Techniques
2 | Program/Software Development (Specification)
the user and help in decision-making. A major form of output is a hard copy output which
is printed from the printer. The output design is available either on the paper or on the
surface of the computer screen. The following media are used for output design.
Monitor (CRT 'Cathode Ray Tube' screen displays, LCD, LED)
MICR (Magnetic Ink Character Reader)
OMR (Optical Mark Reader)
OCR (Optical Character Reader)
Line, Matrix Laser printers
Computer Output Microfilms
Graph Plotters
Audio media
7. Volume
What is the required volume of the output is another important point in the system
design. This also has an effect on the designing system. On the basis of this, the cost,
time etc. estimation is affected.
8. Quality
Quality control is one of the important phases in the system development. For this, each
and every topic are related. Therefore, in system design quality control and maintenance
affect the overall design of the system.
- Input Design
Once the output requirements have been finalized, the next step is to find out what data
needs to be made available to the system to produce the desired output. In this design
the source of the input data collection, document preparation and verification play the
important role. Specially, the system analyst or programmer decides the following points
for the input design of the system.
1) What are the data types and availability?
2) What media to use?
3) What arrangement of the data has been provided?
4) The dialogue to guide users for providing inputs.
5) Data items and transactions needing validation to detect errors.
6) Input Validation style and steps for error validation.
The input design covers all the phases of input from data collection (gathering), validation
to actual entry of the data to the system for processing. Whatever the input design media
is used to design the input design but the CRT and LCD -input screen design is mostly
used in modern designing system which has following advantages.
Easy to use
Improved processing speed
Menu driven screen
Emphasizing upon information on display screens
Colour selection and designing is very simple and easier.
Editing through display screen is very friendly.
- File Design
After gathering the data, the input design has to be done to the system. The verified data
are to be stored into the logical storing devices for their further processing. The data are
measured in certain unit known as bit and byte. The preparation of database system is
known as file design. File is the name of collection of information about the particular
things in systematic manner. Hence, a database is a collection of related information that
is available to many users. A database can handle business application such as inventory,
accounting and preparing notes. The well-known example of database is MEDILINE
848
4 Programming Logics & Techniques
2 | Program/Software Development (Specification)
which is database service providing medical information for doctors. To design the file
the following decisions play an important role.
- Procedure Design
The procedure design is specially concentrated to the steps of the designing of the input,
the output and the file design. Hence, it is also known as input/output design. In this
design, the system analysts or programmers are interested to find the processing system
to achieve the efficient output. What kind of procedures are carried out by the computer
during the processing activities is the main objective of the procedure design of the
program.
Control Design
It is the design of the control of the system which includes procedures that would ensure
correctness of processing, accuracy of data, timely output etc.
Good program will only come from good program design.
The program design covers the following terminology: Algorithm, Flow chart, Decision table,
pseudocode etc. This will be discussed on later.
050
5 Programming Logics & Techniques
2 | Program/Software Development (Specification)
1. Applying Judgment
In this case, different teams are formulated and programs are tested. Such teams test the
program and find out the errors occurring in the program or make sure that the program
performs the intended task.
2. Applying Skill
We can also test the program by using our general ideas or logic to determine whether the
results of the program are as we want.
3. Applying Knowledge
The program can be tested by our knowledge or understanding of the program.
Performance Criteria for System Testing
The following performance criteria are used for system testing.
a) Turnaround Time
This is the elapsed time between the receipt of the I/P and the availability of O/P. The
objective is to decide on and evaluate all the factors that might have a bearing on the
turnaround time for handling all the applications.
b) Back Up
This term relates to the procedures to be used when the system is down. Backup plans
might call for the usage of another computer.
c) File Protection
This option refers to sorting of files in a repartee area for protection against fire, flood or
natural disaster. Plans should also be established for reconstructing files damaged through
a hardware malfunction.
System Testing
Usually, the system or program is tested partly called unit testing. The part of the individual
program is called modules. So, module testing (unit testing) is one of the important methods
of the program testing. System Testing is a level of the software testing where a complete and
integrated software is tested. The purpose of this test is to evaluate the system’s compliance
with the specified requirements.
Acceptance Testing
System Testing
Integration Testing
Unit Testing
In another way system testing can be defined as the process of testing an integrated system to
verify that it meets specified requirements.
• Software Tester's Education - There is a certain learning curve for each type of software
testing available. To use some of the software involved, a tester has to learn how to use it.
• Testing Budget - Money becomes a factor not just for smaller companies and individual
software developers but large companies as well.
2. String Test
In the string test, developer and functional analyst sit together and test the program by giving
different conditions. After Coding and Unit Testing, String Testing activities are conducted.
The intent of string testing is to begin the validation that the newly coded object meets the
needs defined in the functional and technical design.
This tests the one program, which is related to other programs. This may interact with the whole
system. Individual testing against the entire module is the errors debugging methodology.
System Evaluation
The system should be evaluated to find its usefulness. The system is evaluated based on the
following approaches:
a) Operation Evaluation: How is the system useful in terms of response time, ease of
use, reliability and suitability in information format?
b) Organization Impact: How is the system useful in terms of monetary section? It
directly impacts the system of organization.
454
5 Programming Logics & Techniques
2 | Program/Software Development (Specification)
System Security
The security is the system to give protection to the program or system. Providing the good
security to the system is one of the important stages of the program development life cycle.
Programming Errors
After the completion of system designing work, the programmer should have knowledge or
ideas to find out even minor problems or errors occur in the system or program. The logical
error identification and correction is really sophisticated work. The following factors cause
the errors into the system:
a) Design Error
b) Poor Quality Control
c) Other Utilization and Overloading
d) Wear out
a) Design Error
This error occurs at the time of system designing due to the lack of knowledge and sensitivity
of a programmer. The entire necessary environment may be accounted at the time of design
process and errors may occur. These kinds of error are known as design error. To correct these
errors, system designer or programmer should think about the system from the beginning
point of system designing work. To identify the problems, the analyst should prepare the
verification teams to verify the errors. The different teams validate the errors and finally a
conclusion is considered as final errors of the system design.
b) Poor Quality Control
This error may occur at the time of program coding. They are not detected at the time of
coding. Another reason to occur this error is incompatibility of various modules and conflict
of conversions between different versions of the operating system.
c) Over Utilization and Overloading
This error occurs due to over-handling the system as well as over supplying the data to it.
Any system is designed for certain time period and within certain circumference, therefore it
should be operated at that environment. Once it has crossed that limit, then various kinds of
errors may be detected in the system. They are called over utilization and overloading errors.
These errors can be controlled by two ways.
1. Supplying of data and handling of program within prescribed environment.
2. Running the buffer and stacks within their boundaries. The example of this error
is unbalanced defining of files and buffers in the autoexec.bat file (program
running files)
Autoexec.bat
Files = 30
Buffers = 30
Programming Logics & Techniques 55
55
2 | Program/Software Development (Specification)
d) Wear Out
This error is known as out-dating error. The wear out error of the software mostly does not
occur in the system because this error can only be detected after the use of all facilities of the
program. To verify and modify this type of error, invention of new technology is required;
for example, by releasing new versions of the software. e.g. the problems of windows 3.1 are
modified by new version of windows i.e. windows 95. Problem of windows 95 is overcome
by releasing windows 98 and so on.
Bugs
Computer programs are programmed by human beings, so these programs will be subject to
errors. These program errors or faults are known as bugs and the process of finding out errors
or fault by doing various kinds of activities to the program or system is known as debugging.
The debugging task is done by patching up job. This is the process of locating and eliminating
program errors. This is the process of finding alternative or forming alternative section of
testing of program to find out the bugs. The alternative process of testing to remove the bugs
are called patches or fixes.
In the program, there are mainly three types of errors
a. Syntax error
b. Logical error and
c. System error.
1. Syntax error
These are the grammatical errors, spelling mistakes in the program. These errors result when
the rules or syntax of the programming language are not followed. These kinds of errors occur
at the time of program development and are easily debugged at the time of compilation. By
absorbing the nature of errors a programmer should identify and debug these errors. Some of
the important kinds of syntax errors are listed below:
• Variable not found.
• Statement missing (missing of;) etc.
• L value requited.
• Data mismatch (over flow)
• Invalid data conversion.
• Divide by zero
• Run time error.
For example, the C statement for (j=1; j<10; j++ has a syntax error. In this example, the
problem is missing closing parenthesis, which should be placed in the appropriate place
depending on the logic of the program. Almost all language processors are designed to detect
syntax errors. This processor prints error messages on the source listing that indicate the
line number of statement with errors and give hints as to the nature of the error. Thus, it is a
relatively easy task to detect and correct syntax errors.
656
5 Programming Logics & Techniques
2 | Program/Software Development (Specification)
In high-level languages, a single error often causes multiple error messages to be generated.
There are two reasons for this: one is that these language instructions often require multiple
machine steps. The other reason is that symbolic instructions are often dependent upon other
instructions. For example, an instruction containing an error is one that defines a field name;
all instructions in the program using that field name will be listed as errors.
2. Logical Errors
This is the error in the logical sequence of the program. Logical errors are complex types
of errors in the program; therefore, to find out them is very complex task. Therefore, a
programmer should think about the program and its required output whether we are getting or
not. At the time of compilation computer doesn't show any error and we will get the output.
The computer actually doesn't know that an error has been made. It follows the program
instructions and displays the results, but the output is not correct. The problem is that the logic
being followed doesn't produce the results that were desired. When a logical error occurs, all
we know that the computer is not printing the correct O/P. The computer also doesn't tell the
error message, so it is very difficult to debug the errors.
For example for (j=1; <=10;j++)
This is the logic loop to display number 1 from to 10, but our requirement is up to 15 then
this is called logical error. In this condition computer does not display any error message.
Therefore, it is difficult to identify the errors.
3. System Errors
These errors occur due to the hardware failure and software failure. Therefore, system
modification or replacement is only the reason to debug errors of this nature.
Some examples are
1. Stack overflows (memory mismatching with respect to given data types).
2. Buffer mismatch (Mismatching of programming, file-opening system with respect to
computer hardware etc.) some examples are config.sys, autoexec.bat, sys.ini, win.ini
etc.
3. Insufficient memory- This is the error due to the memory mismatching (hardware
defect, Ram, Mismatching of buffer and file)
Conclusion
After correcting all the syntax errors, we must check for logical errors. For this we must have
some sample data and calculated result. Using these data, we must first execute the program
by giving the run command. The result given by the computer must be checked with the
calculated result. If the both results are the same, then the program is free from logical errors,
otherwise we must find out the errors and correct it from the beginning point.
Summary
Stages of System Development Life Cycle (SDLC)
The System Development is the interactive process which consists of the following stages
Preliminary Investigation: One of the most tedious task is to recognize the real problem
of the pre-installed system. The analysis has to spend hours and days for understanding
the fault in the system. This fault behavior could have overcome if the Preliminary
Investigation before installing the system was properly done. This is the first stage of the
development of the system. In this stage, the analyst makes a survey by gathering all the
available information needed for the system elements and allocation of the requirements
to the software.
Analysis of the requirement: The analyst understands the nature of the information and
the functions of the software which is required for the system. The analyst makes a brief
survey of the requirements and tries to analyze the performance of the system which is to be
developed. He also makes sure that he gets enough information and resources for building
the appropriate system.
System Design: The analyst actually makes number of designs of the system on paper or
in the computer and sees whether the rough image made of the system comprises all the
requirements or not. Once this is done, the analyst selects and finalizes a best suited design
for the development of the system.
System Coding: The analyst translates the code or the programs in such a way that they
become in machine readable form. The coding step is very time consuming and involves these:-
1. Preliminary
investigation
6. Systems 2. Systems
maintenance analysis
5. Systems
3. Systems
implementation
design
4. Systems
development
858
5 Programming Logics & Techniques
2 | Program/Software Development (Specification)
System Testing: Once the analyst is through with the coding stage he tests the systems
and sees whether it is working as per the expectations or not. He corrects the flaws in the
system if any.
System Implementation: This is one of the most vital phase. In this phase the analyst
actually gives the system to the customer and expects for a positive feedback.
System Maintenance: The last stage of the SDLC is that the analyst needs to maintain the
system and see that it is working within the standards set. He needs to maintain the system
by removing the defects of flaws occurred.
them. Hence, the prewritten English language in step wise order to perform specialized task
is called algorithm. We can say that the step wise instructions about the particular system to
get specific output. Therefore, algorithm is the initiating stage to develop an efficient system
or program.
To write an algorithm the given sequence of instructions must possess the following
characteristics:
1. Each and every instruction should be accurate and clear.
2. Each instruction should finish within definite time interval.
3. One or more instructions should not be repeated infinitely. It is obvious that the
process should once be terminated.
4. After termination of the algorithm, the definite output must appear.
Questions
1. Write an algorithm to find out total and average mark of 10 students consisting of seven
subjects and print the result.
Step 1. Start to write a program of mark sheet.
Step 2. Assume subject = 1, total =0, No of student = 1
Step 3. Input the mark of the seven subjects
Step 4. Are all 7 subjects done?
If no then increase the subject number and go to the step no: 3 otherwise go to step
no. 5
Step 5. Add and print sum or total.
Step 6. Calculate average of seven-subject mark.
Step 7. Are all 10 students mark entered?
If no, increase the student number and go to step no. 3 if yes then go to step no 8.
Step 8. End.
2. Write an algorithm to prepare sheet or sequence of an instruction to develop following
program. (Assignment: Assume suitable inputs).
a. General bill report.
b. Start to write a program of bill report.
c. Electric bill report
d. Telephone bill report
e. General salary sheet report
Flowchart
The pictorial representation of sequence of events that describes the activities required in the
program to solve the particular problem is called flowchart. Therefore, a flowchart is a pictorial
representation of an algorithm. The chart provides better concept about the programming so
that programmer can write correct program. The sequence of events is represented by the
different symbols and connected by the flow lines.
060
6 Programming Logics & Techniques
2 | Program/Software Development (Specification)
Boxes of different shapes are used to denote different types of instructions. The actual
instructions are written within these boxes using clear and concise statements. Solid lines
having arrow marks to indicate flow of operation connect these boxes. The flow chart creates
the logical ideas to the programmer. Once the flowchart is ready, the programmer can forget
about the logic and can concentrate only on coding of the programming language. Hence, we
can say that the flowchart is the picture of the logic to develop the program.
Features of Flowchart
To draw the flowchart the following features are to be taken into consideration:
• Originating or Origination
The collection of source data is an important job in any system either to draw flowchart or to
develop a program. Thinking about the system logically as well as collecting of resources to
develop the program, this feature is known as originating feature.
• Inputting
The processing of supplying data or instructions to a computer is called inputting of records
to the computer. This process of supplying data to the computer by different media is known
as input or inputting.
• Processing
To obtain specific output with respect to given data or instruction, certain process should be
happened into the computer. This is known as processing.
• Storage/ Storing
After manipulating of system or program the data or instruction and output results either store
temporarily (RAM/ROM) or permanently (Floppy disk, hard disk, CD-ROM, Zip drive pen
drive, DVD etc.) into the computer. This is called storing of information.
• Outputting
The output result appears after the completion or processing work is called outputting.
Better Communication
A saying is that "a picture is worth a thousand words" which is true in the case of flowchart.
The communication means understanding of information in between two things. Similarly,
in the case of flow chart, meaning of communication is happened to all kinds of computer
languages. But all kinds of languages are not inter-related to communication technique and
logical ideas to solve specific problems. The flowchart is same for all languages. Therefore it
is easier for programmer to explain the logic of a program.
Effective Analysis
Drawing a macro flowchart is a very complex task, therefore a micro flowchart that has
number of lines of logic in software is used. It is very difficult to analyse at a time, which can
be broken out in separate section for study and further analyzing of a program.
Effective Synthesis
A group of experts or programmers are normally associated with the design of a complex
system or program. A micro flowchart is the part of the macro flowchart hence drawing the
individual micro flowchart makes the system simple and efficient. Thus, flowcharts are one of
the important models to design a complete system. To make a complete flowchart, individual
flowcharts combine together and form a complete flowchart of the system.
Proper Program Documentation
Documentation of the program starts from initialization and close at the end of the program.
Program documentation is the overall written procedure of the program development and
maintenance. In another way, controlling of program by doing different types of actions is
called program documentation. In program documentation, there are following stages.
a. Collecting of data
b. Initializing and organizing of data
c. Storing
d. Outputting
e. Trouble Shooting
Efficient Coding
After plotting a flowchart, a programmer is going to code a program. It gives total infrastructure
about the system. Hence, a flowchart is electronic road map to the programmer.
Systematic Debugging
A designer always takes care about the program, and thinks about how to develop an error free
efficient program; even though some errors or bugs may have been detected in the system. These
types of errors can very easily be analyzed and removed even at the flowchart-designing period.
Systematic Testing
Testing of a program or system after completion of work is one of the important steps to get
better result of that program. Therefore, systematic testing of program occurs even from the
drawing of flowchart. In that period, we may get different types of problems, which can be
eliminated by testing the flowchart in systematic manner.
262
6 Programming Logics & Techniques
2 | Program/Software Development (Specification)
Disadvantages of Flowchart
Some of the important disadvantages of flowchart are as follows:
Time Consuming and Laborious Work
Flowcharts are time consuming and laborious to draw with proper symbols and spacing,
especially for a large and complex program. Once programmer has better knowledge about
the system, it may not be necessary to plot a flowchart. Therefore, it is a complex as well as
time-consuming work.
Expensive and Difficult for Modification
Drawing a flowchart as well as modification is difficult task rather than program modification.
Creating of a new flowchart means applying of skilled manpower and investment which
creates more economic burden.
Standard Limit of Investment
Drawing a flowchart is not concentrated within certain circumference. Different programmer
can use different logical ideas to draw the same flowchart. Therefore, it doesn't contain any
limitations of investment.
Summary
A flowchart is a common type of chart, that represents an algorithm or process,
showing the steps as boxes of various kinds, and their order by connecting these with
arrows. Flowcharts are used in analyzing, designing, documenting or managing a
process or program in various fields.
History
The first structured method for documenting process flow, the "flow process chart", was
introduced by Frank Gilbreth to members of ASME in 1921 as the presentation “Process
Charts—First Steps in Finding the One Best Way”. Gilbreth's tools quickly found their
way into industrial engineering curricula. In the early 1930s, an industrial engineer, Allan
H. Mogensen began training business people in the use of some of the tools of industrial
engineering at his Work Simplification Conferences in Lake Placid, New York.
A 1944 graduate of Mogensen's class, Art Spinanger, took the tools back to Procter and Gamble
where he developed their Deliberate Methods Change Program. Another 1944 graduate, Ben
S. Graham, Director of Formcraft Engineering at Standard Register Corporation, adapted the
flow process chart to information processing with his development of the multi-flow process
chart to display multiple documents and their relationships. In 1947, ASME adopted a symbol
set derived from Gilbreth's original work as the ASME Standard for Process Charts.
According to Herman Goldstine, he developed flowcharts with John von Neumann at Princeton
University in late 1946 and early 1947.
Flowcharts used to be a popular means for describing computer algorithms. They are still
used for this purpose; modern techniques such as UML activity diagrams can be considered
Programming Logics & Techniques 63
63
2 | Program/Software Development (Specification)
to be extensions of the flowchart. However, their popularity decreased when, in the 1970s,
interactive computer terminals and third-generation programming languages became the
common tools of the trade, since algorithms can be expressed much more concisely and
readably as source code in such a language. Often, pseudo-code is used, which uses the
common idioms of such languages without strictly adhering to the details of a particular one.
464
6 Programming Logics & Techniques
2 | Program/Software Development (Specification)
Examples: Draw a flow chart to find out factorial of any given number N.
Start
Read N
M=1
F=1
F = F*M
NO IS
M=M+1 M=N?
YES
PRINT F
END
666
6 Programming Logics & Techniques
2 | Program/Software Development (Specification)
logic flowcharts, systems flowcharts, product flowcharts, and process flowcharts are "just a
few of the different types of flowcharts that are used in business and government."
Program Flowchart
It is a flowchart, which is oriented to solve the problem through a program. This flowchart
is known as program flowchart. The size of flowchart depends on the nature of the problem.
General program flowchart sample is given below.
Questions
1. Draw a flowchart of a class and find out percentage of mark by assuming following 3
points:
a) Simple flowchart for single student.
b) Unlimited flowchart for no of student.
c) No of students with specific output
2. Draw a flowchart and dial a telephone no. to make command by using double decision
box in the program.
3. Draw a flowchart and develop a system or program to get specific output.
Decision Table
Decision Tree
A graphical representation of conditions and outcomes to the program that resembles (forms)
the branches of a tree are known as a decision tree. It represents the conditions and actions in
the form of a tree structure when dealing with program problems where there are a number
of possible alternative actions. It is helpful to work out all the possible alternatives before or
after writing flowcharts, algorithms or pseudocodes.
To prepare a decision tree there are different methods but branching method is very common.
The conditions are represented as nodes of the decision tree. The actions are represented as
leaf nodes of the tree. The root of the tree is starting point. Progressing from left to right along
a particular branch is the result of making a series of decisions. The general structure of the
tree has been shown in figure.
action
Condition condition condition condition
Root
Condition condition condition condition action
Sugar
Black
Tea No Sugar
White
Drink Sugar
Black
Coffee No Sugar
White
Sugar
Fig.: Decision tree
Decision Table
It is the table of possible alternative ideas to develop a system or program. Decision tables
are used to define clearly and concisely the conditions and actions in a tabular form. It creates
logical views that tell us what action to take when a given condition is true or otherwise. This
table shows decision making alternative.
The following steps are necessary to construct the decision table:
• Properly define the problems that have to be solved by computer.
• List out all the conditions to be tested in the problems.
• List out the corresponding actions that should be taken with each combination of
conditions.
• Form a decision table using actions and conditions.
Generally, the decision table has four quadrants. The upper left is a condition stub that contains
a list of possible conditions. The bottom left quadrant is an action stub that contains the list of
actions. The upper right quadrant is a condition entry where condition values are entered. The
condition entries may be in yes or no form. The lower right quadrant is an action entry stub
which contains the action entries. These are entered as X or √ (cross/Tick Mark). The general
structure of decision table is as shown below.
Condition Stub Condition entry Stub
Action Stub Action entry stub
Table: Structure of a decision table
Advantages
The advantages of the decision table are given below:
• They are easier to draw and replace the flowchart.
• They provide more compact documentation. A small table can replace several pages of
charts and paragraphs
• It is also easier to follow a particular path down one column than through several flow-
chart pages.
868
6 Programming Logics & Techniques
2 | Program/Software Development (Specification)
Disadvantage
These are not very popular and not so widely used because
• Flowcharts are better to express the total sequence of events needed to solve a problem.
• Flowcharts are more popular in common, many programmers and beginners hence prefer
practice.
Example-1
Let us explain the decision table with the help of an example to prepare a cup of tea or coffee
with or without sugar sees the following table.
Solution
The alternative conditions are 8, Y =Yes, N =No
Conditions
Y=Tea, Black, sugar N=Coffee, white, without sugar
Tea Y Y Y Y N N N N
Black Y Y N N Y Y N N
Sugar Y N Y N Y N Y N
Actions
Pour milk into bottom of cup √ √
Fill up rest of cup with tea √ √
Fill up with tea √ √
Pour normal amount of √ √
coffee into cup
Top up cup with milk √ √
Fill up with coffee √ √
Add sugar √ √ √ √
Stir cup √ √ √ √ √ √
Example-2
Let us consider the following situation. It is required to compute the income tax. The rules for
computing commission are as follows:
Condition Action
If the total income ranges from 0-60,000 No tax.
If the total income 60,001-80,000 10% of total income
If the total income is above 80,001 2000+ (20% of total income)
Irrespective of whether one has to pay tax or not, the individual has to submit the tax details
before the end of accounting year. If the accounts are not submitted before Jun, Rs. 500 more
fine is added to total tax.
Programming Logics & Techniques 69
69
2 | Program/Software Development (Specification)
Solution:
The decision table is constructed with given conditions and possible alternative solutions are
shown on the table. This is given as follows:
Conditions
Tax details submission before Jun Y Y Y N N N
Income Range 0-60,000 Y N N Y N N
Income Range 60,000-80,000 N Y N N Y N
Income Range>80,000 N N Y N N Y
Actions
A1 X
A2 X
A3 X
A4 X
A5 X
A6 X
Actions.
A1-Compute tax = 0
A2-Compute Tax = 10% of total income
A3-Compute Tax = 2000+(20% of total income)
A4-Compute Tax = 0 + 500
A5-Compute Tax = (10% of total income) + 500
A6-Compute Tax = 2000+(20% of the total income) +500
Example-3
Study following conditions and draw decision table:
• If product code=A and customer type=1 and the order amount<=700 then 5% discount is
allowed.
• If product code=A and customer type=2 and the order amount<=700 then 7.5% discount
is allowed.
• If product code=A and customer type=1 and the order amount>700 then 7.5% discount
is allowed.
• If product code=A and customer type=2 and the order amount>700 then 10% discount is
allowed.
• A flat discount of 5% on product code=B regardless of customer type and the order
amount.
070
7 Programming Logics & Techniques
2 | Program/Software Development (Specification)
Solution:
The decision table is constructed with given conditions and possible alternative solutions are
shown on the table. This is given as follows:
Conditions (Customer code=A, Type=1, Amount<=700) =Y else N
Customer Code = A Y Y Y Y N
Customer Type = 1 Y N Y N -
Order amount<=700 Y Y N N -
Actions
Discount = 5% x x
Discount = 7.5% x x
Discount = 10% x
Example-4
A company has three shareholders Ramu, Sita and Rabi. Ramu owns 30% share, Sita 20%
and Rabi 50%. They decide to lay down rules to pass laws for the company. For a law pass it
must be supported by shareholders the sum of whose holding exceed 2/3rd of total share. Write
a decision table for this rule.
Solution:
The decision table is constructed with given conditions and possible alternative solutions are
shown on the table. This is given as follows:
Conditions
Ramu owns 30% share Y Y N Y N
Sita owns 20% share Y N Y Y N
Rabi owns 50% share Y Y Y N N
Actions
Passed Law x x x
Reject Law x x
Example-5
Assume the tax system of any company as:
• If the employee is male and annual salary<=200000 then no income tax.
• If the employee is female and annual salary<=200000 then 5% income tax on total salary.
• If the employee is male and annual salary>200000 but <=300000 then 10% income tax
on total salary.
• If the employee is female and annual salary>200000 but <=300000 then 12% income tax
on total salary.
• If annual salary is more than 300000 then 20% income tax on total salary for all employee.
Solution:
The decision table is constructed with given conditions and possible alternative solutions are
shown on the table. This is given as follows:
Conditions Male=Y female= N
Employee male Y N Y N All
Annual Salary<=200000 Y Y N N N
Annual Salary>200000 and N N Y Y N
<=300000
Annual Salary>300000 N N N N Y
Actions
Income Tax = 0% (No Income tax) x
Income Tax = 5% x
Income Tax = 10% x
Income Tax = 12% x
Income Tax = 20% x
Pseudocode
There are four kinds of program analysis tools. They are algorithm, flowchart, Decision table
and pseudocode.
The pseudocode is one of the important and furnished tools among all the programming
analysis tools hence. "Pseudo" means imitation or false and "Code" means instruction to the
computers. Therefore, pseudocode is useful to analyse whether instruction is systematically
given to the computer or not. In conclusion, pseudocode is an imitation of actual computer
instruction. It is written in different general language like English, Nepali, German, French etc.
Pseudocode is the combination of following three logical structures.
• Sequential logical structure
• Selection logical structure
• Iteration logical structure
272
7 Programming Logics & Techniques
2 | Program/Software Development (Specification)
Start
.
. Input
.
.
Process 1 Process 1
Process 2 Process 2
.
.
.
Process N
.
Output
End
ENDIF
. Output
.
.
a) Pseudocode b) Flow Chart
Programming Logics & Techniques 73
73
2 | Program/Software Development (Specification)
END DO Process 2
.
.
.
a) Pseudocode b) Flow Chart
2. Flowchart and pseudocode for REPEAT ……. UNTIL iteration structure
.
.
.
.
. Process 1
.
REPEAT
Process 1
.
.
.
. Process n
.
Process n
UNTIL Condition
.
.
. Condition?
.
.
a) Pseudocode b) Flow Chart
474
7 Programming Logics & Techniques
2 | Program/Software Development (Specification)
Process-3 Let, NA = BA - DA
End
Programming Logics & Techniques 75
75
2 | Program/Software Development (Specification)
3) Write an algorithm & convert it into flow-chart to calculate the following operations from
the given two numbers.
i) A * B ii) A–B
i) Step 1 : Start a program to multiply two numbers.
Step 2 : Read two numbers, let A & B.
Step 3 : Calculate the variables & store the result in C i.e. C = A*B
Step 4 : Display A, B & C
Step 5 : End.
Start
Process Let, C = A * B
End
ii) Step 1 : Start to write a program to subtract two numbers.
Step 2 : Input/Read two numbers, let A & B
Step 3 : Subtract two numbers & store result in C i.e. C = A-B
Step 4 : Display A, B & C
Step 5 : End.
Start
Process let, C = A - B
End
4) Write an algorithm & flow-chart from the given inputs like Emno, EmName, Address, Post
& BS. Calculate the following calculations assuming suitable inputs.
Notification
HRA = House Rent Allowance
DA = Daily Allowance
676
7 Programming Logics & Techniques
2 | Program/Software Development (Specification)
Process-9 Let, TD = IT + PF
Process-10 Let, NS = GS - TD
End
5) Write an algorithm from the given C.No., CName, PMMR & Rate. Calculate UC (Unit
Consumed) & BA in Nepal Electrical Board.
Notification
C.Name = Customer Name
CMMR = Current Month Meter Reading
PMMR = Previous Month Meter Reading
Start
N=1
Input Let, A, B, C
Process D=A+B+C
N = N+1
Display A, B, C & D
Yes if
(N<50)
No
End
878
7 Programming Logics & Techniques
2 | Program/Software Development (Specification)
Start Start
N=1 N=2
Display N Display N
N = N+1 N = N+2
Yes if Yes if
(N<21) (N<100)
No No
End End
3) 1 , 1 , 1 , 1 , 1 ..... 1
2 3 4 5 6 27
Start
N = 12
Display N
N=N
N +1
if
Yes
1
(N> 51 )
No
End
S=0 S=0
N=1 N=1
S = S+N S = S+N
Display S Display S
N = N+1 N = N+2
Yes if Yes if
(N<100) (N<71)
No No
End End
9) Draw a flow-chart to make telephone call to your friend.
Start
Redial
Yes if
(Busy)
No
Talk
End
080
8 Programming Logics & Techniques
2 | Program/Software Development (Specification)
10) Draw a flow-chart to find out odd or even number from the any given number.
Start
Input Read N
Process Let R = N 2
No
Display odd
End
11) Draw a flow-chart to find out Fibonacci series of any given number n.
Start
Let i =1, a = 0, b= 1
Input n
c=a+b
Display a
i = i+1
a=b
b=c
>
Yes if
(i < = n)
No
Stop
12) Draw a flow-chart to find out greatest & smallest number from the given numbers.
i) Any given two numbers.
Start
Input Let, A, B
if
B is greatest No Yes A is greatest
(A > B)
End
Suppose
No if Yes Great = A
(A > B)
if Yes
if No if (B>Great) Great = B
(B > C) (A > C)
No
Yes Yes if Yes
B is great C is great A is great (C>Great) Great = C
No
End
No
Display Great
End
282
8 Programming Logics & Techniques
2 | Program/Software Development (Specification)
Questions
Solve the following questions. (each question carries 7-8 Marks)
Write Short notes on the following: (each question carries 5 marks)
1. Define flowchart? Construct a flowchart to find Fibonacci series up to nth term.
2. What do you mean by feasibility analysis? Explain its different types.
3. What do you understand by program development? Does requirement analysis play
important role on system development? Justify your answer with suitable reasons.
4. Define iterative and recursive logic of program development with suitable examples.
5. What are the errors on computer program? Justify logical errors are more difficult to find
out than syntax errors in program testing.
6. Why is it essential to follow software development life cycle? How design and analysis
are related to each other? Illustrate your understanding with relevant examples.
7. Write down the flowchart to find the factorial of any given number. Explain.
8. Draw a flow chart to ask three numbers and find out the largest number.
9. Write an algorithm of telephone call system and convert it into equivalent flow chart
diagram.
10. What types of program designing tools are widely used for software development? Draw
a flow chart to ask marks obtained in any five subjects in Semester End Examination and
calculate total marks, percentage of marks and division where if:
percentage>=90 : ‘A Grade’
percentage>=80 & percentage <90 : ‘B Grade’
percentage>=70 & percentage<80 : ‘C Grade’
percentage>=60 & percentage<70 : ‘D Grade’
percentage>=45 & percentage<60 : ‘E Grade’ otherwise ‘Fail’.
11. A bank defined the rate of interest on fixed deposit account as follows.
a. If the amount is at least Rs.20,000 and time 1 year = 5%.
b. If the amount is at least Rs.20,000 and time 2 years = 7%.
c. If the amount is at least Rs.20,000 and time 3 years = 9%.
d. If the amount is at least Rs.20,000 and time 4 years = 10%.
e. There is no matter of amount if the time is more than 4 years 11%
Express these statements in the form of decision table.
12. An organization decided to increase the salary scale of its workers as follows:
a. For those workers whose annual salary is more than Rs. 40,000: no increment
b. For those workers whose annual salary is in between Rs. 20,000 and 30,000: an
increment of 5%.
c. For those workers whose annual salary is less than Rs. 10,000: an increment of 10%.
Express these statements in the form of decision table
484
8 Programming Logics & Techniques
3 | Program Techniques (Approaches)
Programming Techniques
(Approaches) Unit-3
Objectives
This unit has following objectives:
1) To create the various techniques to develop a program
which can increase the program performance.
2) To make the students aware of programming techniques
(like modular, top-down, bottom-up, structure and object-
oriented programming techniques) and programming
models (like waterfall, prototype, spiral, iterative, V-model,
RAD, Big-bang, evolutionary models)
3) To generate the comparative studies of programming
techniques, and model so that they can easily identify
the advantages and disadvantages of them.
4) To boost knowledge about cohesion and coupling with
their types.
5) To identify internal relationship of modules for communi-
cation in programming.
Introduction
Any system is directly or indirectly associated with the method of development. Similarly, to
develop a complete efficient program, there are certain methods, logic skills and knowledge.
This special creation of a program development system is called as Programming Technique.
To build today's complex and efficient software, it is just not enough to put together a sequence
of programming statements and sets of procedures as well as modules; we need to incorporate
sound construction techniques and program structures, that are easy to comprehend, implement
and modify. The computer machine has itself remarkable versatility and ability to carry out
a specific sequence of calculations in short period of time without making any mistakes. Not
only this it has logical decision making and looping calculation power which automatically
guides the overall computing system.
Since, the invention of the computer, many programming approaches has been tried out.
Among them the following five types of programming approaches are being popular for
study. They are-
a. Modular Programming
b. Top-down programming
c. Bottom-up programming
d. Structured programming
e. Object Oriented Programming
Generally, modules of 20 to 50 lines are considered as good modules. When lines are increased,
the controlling of module becomes complex.
Modules are debugged and tested separately and combined to build system. The top module is
called root or boss modules which charges control over all sub-modules from top to bottom.
The control flows from top to bottom, but not from bottom to top.
The modules are evaluated in terms of coupling and cohesion. The module coupling denotes
number of interconnections between modules and module cohesion shows relationship among
data or elements within a module.
Module
Elements
Cohesion
Coupling
Fig.: Coupling and Cohesion
Modular Programming
The modular designing and programming technique has following characteristics: -
1. A programmer is going to form number of levels to the complex program where a level
may consist of one or more modules. The first level of program is main level of a program
and modules at successive levels consist of sub modules, in the prior level.
2. As we know a module is a set of program statements acting together to complete a specific
task. Therefore, module can be a function of the main program which can consist of
sequence of calls to the functions, those modules at the next level down.
3. The number of modules are executed together and controlled by the main program. This
is the procedural system to solve all the problems in the program.
4. Modules should be structured within themselves by incorporating the construction of
sequencing, selection and repetition. These constructions are common for almost all
program design.
Advantages
It has following advantages:
1. Decreases the complexity of the program by breaking it down into smaller units.
2. Allows several programmers to code simultaneously.
3. Allows common functions to be written once and then used in all programs as per
requirement. For example, if decoding of the transaction code were to be performed for
several programs, the same module could be used.
4. Decreases debugging time, because modules make it easier to isolate errors.
5. Improves maintainability of the program.
Programming Logics & Techniques 87
87
3 | Program Techniques (Approaches)
A B C
A1 A2 A3 B1 B2
C1 C2 C3
Fig.: Top down Approach
Example: The main program is divided into sub-programs A, B, and C. The A is divided
into subprogram A1, A2 and A3. The B is into B1, and B2. Just like these subprograms,
C is also divided into three subprogram C1, C2 and C3. The solution of Main program is
obtained from sub program A, B and C.
888
8 Programming Logics & Techniques
3 | Program Techniques (Approaches)
Bottom-up Approach
In bottom up programming technique the overall work is broken down into different segments.
Bottom up programming technique starts with the smallest of programming logic which creates
new bigger logic to solve the next problem and so on till the entire problem is programmed.
A bottom up approach would be to write the most basic subroutines in the hierarchy first and
then use them to make more sophisticated subroutines.
A complex system may be divided into simpler pieces called modules. A system that is
composed of modules is called modular approach. The modules are in hiding nature, once the
smallest logic has been reached out, it creates the idea of bigger logic one. So, in programming
system the smaller logic doesn't play vital role after formation of bigger logic. This process is
called hiding process. It suggests that we should first recognize, what we wish to encapsulate
within the module and then provide an abstract interface to define the module boundaries.
Since, this technique of writing the program is highly effective in supporting design for
change, this type of technique is known as bottom-up programming technique.
Designing of a program from bottom up technique is highly critical and creative human
activity. Good designers don't proceed in a strictly top-bottom or strictly bottom-up fashion.
Both the program designing techniques are merged together and a new technique is
implemented which is called yo-yo program designing technique. For example, a system
is decomposed first into different phases of design by top-down approach and later on these
sub systems can be synthesized by principle of bottom-up programming approach is known
as yo-yo program designing technique.
090
9 Programming Logics & Techniques
3 | Program Techniques (Approaches)
Program in C language
#include <stdio.h>
#include <conio.h>
void main ( )
{
char dr;
printf("Enter the drink");
scanf("%c",&dr);
switch(dr)
{
case 't':
printf("Pour tea from kettle");
break;
case 'c':
printf("Pour coffee from kettle");
break;
default:
printf("Take cold drink form freeze");
}
getch();
}
All the above processes and steps are necessary to produce the software/program in order
to perform definite cycle of software development. Hence Software Production Process is
the collection of the processes of software production from building, delivery, and setup and
evolves to final retirement of the system.
The software production process will be successful when produced software is with high
reliability, predictability and efficiency. Production processes use different types of model
called software process models. This is sometimes called program development methods
which are discussed below.
• Water fall or Traditional model
• Prototype or Transformation model
• Spiral model.
• Iterative Model
• V-model
• RAD model
• Big Bang Model
• Evolutionary Models
Feasibility Study
Design Specification
Delivery
From the above discussion it is concluded that the possible checklist of the contents is the
requirement specification document that might guide in its production.
The following three points are the important points to check up the possible checklist which
are used in requirement analysis.
I. Functional requirements:
This describes about functional behavior of the production system. It means the most
necessary requirement of the program or software or system. To achieve the knowledge
about it the programmer should know what the product does by using informal
semiformal, formal notations or suitable mixtures.
II. Nonfunctional/Unfunctional requirement:
It is additional requirement of the system. The nonfunctional requirement mostly covers
the following heading:
a. Reliability (availability, integrity, security, safety etc.)
b. Accuracy of a result
c. Performance
d. Human computer interface issues.
e. Operating constraints (Problems)
f. Physical constraints
g. Portability issues and others.
III. Requirement on the development and maintenance process
It includes quality control process such as system test process, system maintenance
process and other requirements.
Design Specification
It is the most creative process. This is the important phase to produce the software. In this phase
the overall design of the software is done. Here different types of programming technique
may be used such as top-bottom, bottom up, modular, structure, object oriented etc. but first
of all design specification is started by breaking down a big program into smaller section
known as module. This phase also deals with various concepts of the system design, such
as data structure, software architecture, algorithm etc. This phase translates the requirement
specification into a representation of a software. This stage answers the question of how, in
suitable format.
494
9 Programming Logics & Techniques
3 | Program Techniques (Approaches)
Advantages
The advantage of waterfall development is that it allows for departmentalization and
managerial control. A schedule can be set with deadlines for each stage of development and a
product can proceed through the development process like a car in a carwash, and theoretically,
be delivered in time. Development moves from concept, through design, implementation,
testing, installation, troubleshooting, and ends up in operation and maintenance. Each phase
of development proceeds in strict order, without any overlapping or iterative steps.
Some of the major advantages of the Waterfall Model are as follows
• Simple and easy to understand and use
• Easy to manage due to the rigidity of the model. Each phase has specific deliverables
and a review process.
• Phases are processed and completed one at a time.
• Works well for smaller projects where requirements are very well understood.
• Clearly defined stages.
• Well understood milestones.
• Easy to arrange tasks.
• Processes and results are well documented.
Disadvantages
The major disadvantages of the Waterfall Model are as follows:
• No working software is produced until late during the life cycle.
• High amounts of risk and uncertainty.
• Not a good model for complex and object-oriented projects.
• Poor model for long and ongoing projects.
• Not suitable for the projects where requirements are at a moderate to high risk of
changing. So, risk and uncertainty is high with this process model.
• It is difficult to measure progress within stages.
• Cannot accommodate changing requirements.
• Adjusting scope during the life cycle can end a project.
• Integration is done as a "big-bang. at the very end, which doesn't allow identifying
any technological or business bottleneck or challenges early.
The Waterfall Model was the first Process Model to be introduced. It is also referred to as
a linear-sequential life cycle model. It is very simple to understand and use. In a waterfall
model, each phase must be completed before the next phase can begin and there is no
overlapping in the phases.
The Waterfall model is the earliest SDLC approach that was used for software development.
The waterfall Model illustrates the software development process in a linear sequential flow.
This means that any phase in the development process begins only if the previous phase is
complete. In this waterfall model, the phases do not overlap.
696
9 Programming Logics & Techniques
3 | Program Techniques (Approaches)
Deployment of system − Once the functional and non-functional testing are done; the product
is deployed in the customer environment or released into the market.
Maintenance − There are some issues which come up in the client environment. To fix those
issues, patches are released. Also, to enhance the product some better versions are released.
Maintenance is done to deliver these changes in the customer environment.
All these phases are cascaded to each other in which progress is seen as flowing steadily
downwards (like a waterfall) through the phases. The next phase is started only after the
defined set of goals are achieved for previous phase and it is signed off, so the name “Waterfall
Model”. In this model, phases do not overlap.
The following illustration is a representation of the different phases of the Waterfall Model.
Requirement
Analysis
System
Design
Implementation
Testing
Deployment
Maintenance
Fig: Waterfall Model with Feedback
Waterfall Model - Application
Every software development is different and requires a suitable SDLC approach to be followed
based on the internal and external factors. Some situations where the use of Waterfall model
is most appropriate are:
• Requirements are very well documented, clear and fixed.
• Product definition is stable.
• Technology is understood and is not dynamic.
• There are no ambiguous requirements.
• Ample resources with required expertise are available to support the product.
• The project is short.
• Process and results are well documented.
Programming Logics & Techniques 97
97
3 | Program Techniques (Approaches)
Prototype Model
Generally; each and every design system is tested and implemented after completing the whole
task of system design. But in this special type of program development model, a functionally
independent module is designed, developed, tested and implemented. This module can work
independently. This model of program development system is popularly known as prototype
model of program development. The process of making individual working module is known
as prototyping.
System
Specification
Outline
Requirement
Design Prototype
Model
Build Prototype
Make a detailed
Design
898
9 Programming Logics & Techniques
3 | Program Techniques (Approaches)
Advantages
Software prototyping is used in typical cases and the decision should be taken very carefully
so that the efforts spent in building the prototype add considerable value to the final software
developed. The model has its own pros and cons discussed as follows.
Disadvantages of prototyping
The Disadvantages of the Prototyping Model are as follows :
• Risk of insufficient requirement analysis owing to too much dependency on the
prototype.
• Users may get confused in the prototypes and actual systems.
• Practically, this methodology may increase the complexity of the system as scope of
the system may expand beyond original plans.
• Developers may try to reuse the existing prototypes to build the actual system, even
when it is not technically feasible.
• The effort invested in building prototypes may be too much if it is not monitored
properly.
To avoid the above problems the developer and the client should both establish a protocol,
which indicates the deliverables to the client as well as contractual obligations.
In both versions the prototype is discarded early in the life cycle. However, one way of
ensuring that the product is properly designed and implemented is to implement the prototype
in a different programming language from that of the product.
• Throwaway/Rapid Prototyping
Throwaway prototyping is also called rapid or close ended prototyping. This type of
prototyping uses very little efforts with minimum requirement analysis to build a prototype.
Once the actual requirements are understood, the prototype is discarded and the actual system
is developed with a much clear understanding of user requirements.
• Evolutionary Prototyping
Evolutionary prototyping also called breadboard prototyping is based on building actual
functional prototypes with minimal functionality in the beginning. The prototype developed
forms the heart of the future prototypes on top of which the entire system is built. By using
evolutionary prototyping, the well-understood requirements are included in the prototype and
the requirements are added as and when they are understood.
• Incremental Prototyping
Incremental prototyping refers to building multiple functional prototypes of the various sub-
systems and then integrating all the available prototypes to form a complete system.
• Extreme Prototyping
Extreme prototyping is used in the web development domain. It consists of three sequential
phases. First, a basic prototype with all the existing pages is presented in the HTML format.
Then the data processing is simulated using a prototype services layer. Finally, the services are
implemented and integrated to the final prototype. This process is called Extreme Prototyping
used to draw attention to the second phase of the process, where a fully functional UI is
developed with very little regard to the actual services.
When to use Prototype Model:
Prototype model should be used when the desired system needs to have a lot of interaction
with the end users.
Typically, online systems, web interfaces have a very high amount of interaction with end
users, are best suited for Prototype model. It might take a while for a system to be built that
allows ease of use and needs minimal training for the end user.
Prototyping ensures that the end users constantly work with the system and provide a feedback
which is incorporated into the prototype to result in a usable system. They are excellent for
designing good human computer interface systems.
A prototype is a scaled down version of the system and may have number of systematic
performance criteria and resource requirements. Developer and customer agree upon certain
outline specification of the system and a prototype design is proposed with the outline
requirements and available resources. The prototype is built and evaluated with the reference
to above resources. The major interest is not in the prototype itself but in its performance,
which is used to refine the requirement specification. Prototype provides an opportunity
to experiment and analyse various aspects of the system such as system structure, internal
design, hardware requirements and the final system requirements.
Simply, a prototype is a working model that is functionally equivalent to a component of the
product.
00100
1 Programming Logics & Techniques
3 | Program Techniques (Approaches)
In many instances the client only has a general view of what is expected from the software
product. In such a scenario where there is an absence of detailed information regarding the
input to the system, the processing needs and the output requirements, the prototyping model
may be employed. This model reflects an attempt to increase the flexibility of the development
process by allowing the client to interact and experiment with a working representation of
the product. The developmental process only continues once the client is satisfied with the
functioning of the prototype. At that stage the developer determines the specifications of the
client’s real needs.
The following sections examine two (2) version of the prototyping model:
Version I: Prototyping is used as a requirements technique.
Version II: Prototype is used as the specifications or a major part thereof.
Version I
This approach, as illustrated in figure below, uses the prototype as a means of quickly
determining the needs of the client; it is discarded once the specifications have been agreed
on. The emphasis of the prototype is on representing those aspects of the software that will be
visible to the client/user (e.g. input approaches and output formats). Thus, it does not matter
if the prototype hardly works.
Note that if the first version of the prototype does not meet the client’s needs, then it must be
rapidly converted into a second version.
Changed
Requirements
Requirements Verify
Rapid Specifications
Prototyping (written)
Verify Verify
Design
Verify
Implementation
Test
Development Integration
Maintenance Test
Maintenance
Version II
In this approach, as illustrated in figure below, the prototype is actually used as the specifications
for the design phase. The advantage of this approach is speed and accuracy, as not time is
spent on drawing up written specifications. The inherent difficulties associated with that phase
(i.e. incompleteness, contradictions and ambiguities) are then avoided.
Changed
Requirements
Requirements Verify
Rapid
Prototyping Design
Verify Verify
Implementation
Test
Integration
Development Test
Maintenance Maintenance
Conclusion
Prototype is meant for experimenting. Most often it can't be formed into a product. Occasionally
it may be possible to tune a prototype into a final product.
Spiral Model
This is another type of important software production process, which is guided by the risk
analysis levels in the project. The basic principle of this model is to analyse the risk factor
to the series of development in the process. The spiral model, also known as the spiral life-
cycle model, is a systems development method (SDM) used in information technology (IT).
This model of development combines the features of the prototyping model and the waterfall
model. The spiral model is intended for large, expensive, and complicated projects.
The risk analysis process in the development of any system refines the process and produces
a quality product. Barry Boehm (1986-1989) defines risk management which describe about
objectives, addresses, problems of the project or software production method. Obviously
spiral model of program development is defined in such a way that it eliminates high risk or
problem by the careful process design rather than treating both trivial (smallest), severe and
complex problems uniformly.
20102
1 Programming Logics & Techniques
3 | Program Techniques (Approaches)
The main characteristic of the spiral model is that it is in cyclic order and does not create
linear system as in waterfall model. Each cycle of the spiral consist of 4 stages and each stage
is represented by 1 quadrant of the Cartesian diagram. The radius of the spiral represents the
cost accumulated so far in the process, the angular dimension represents the progress in the
process.
The spiral model is explained under following 4 stages. They are prototype 1, prototype 2,
prototype 3 and operation prototype.
From prototype 1, the stage of development of software production is started. These are
explained by following series of operations, concept of operation, requirement plan, and life
cycle plan and risk analysis.
In stage 2, it is started from software requirement and validation, development plan and risk
analysis. Similarly, all the stages are proceeding ahead. The spiral model clearly describes the
process of stages to produce particular output in the project. Once it has crossed one stage,
it also analyses the risk factor along with. As soon as the process reaches the 4th stage then
process density system highly increases. This is clearly given in the diagram. In that quadrant
itself it has following series of tasks such as detailed design, coding, unit test, integration test,
acceptance test and final implementation of the software (release version of software).
Finally, in spiral model the process of software production process will continue in cyclic
order to obtain specific result of the system. Each stage is purified by series of risk analysis
processes. Hence, this design system has negligible problems which appear in the end
compared to other program development models.
Determine
objectives, Identify and
alternatives and resolve risks
constrains
Risk
analyses
Risk
Commit to an analyses Evaluate
appraoch Risk alternatives
for the next analyses Operational
iteration Risk prototype
analyses Prototype 3
Prototype 2
Review START Prototype 1
Partition Simulations,
Requirements Concept of models,
plan, life-cycle operation benchmarks
plan
Detailed
Plan the next design
iteration Development
plan Code
Unit
Integration test
and test plan Integration
and test Develop the
Acceptance deliverables for the
test iteration and verify
Release that they are correct
Development is fast and features are added Documentation is more as it has intermediate
in a systematic way phases
There is always a space for customer It is not advisable for smaller project, it
feedback might cost them a lot.
• When long term project commitment is not feasible due to changes in economic priorities
• Users are unsure of their needs
• New product line
• Significant changes are expected (research and exploration)
Applications
For a typical shrink-wrap application, the spiral model might mean that you have a rough-
cut of user elements (without the polished / pretty graphics) as an operable application, add
features in phases, and, at some point, add the final graphics. The spiral model is used most
often in large projects. For smaller projects, the concept of agile software development is
becoming a viable alternative. The US military has adopted the spiral model for its Future
Combat Systems program.
Iterative Model
In the Iterative model, iterative process starts with a simple implementation of a small set of
the software requirements and iteratively enhances the evolving versions until the complete
system is implemented and ready to be deployed.
An iterative life cycle model does not attempt to start with a full specification of requirements.
Instead, development begins by specifying and implementing just part of the software, which
is then reviewed to identify further requirements. This process is then repeated, producing a
new version of the software at the end of each iteration of the model.
Iterative Model - Design
Iterative process starts with a simple implementation of a subset of the software requirements
and iteratively enhances the evolving versions until the full system is implemented. At each
iteration, design modifications are made and new functional capabilities are added. The basic
idea behind this method is to develop a system through repeated cycles (iterative) and in
smaller portions at a time (incremental).
The following illustration is a representation of the Iterative and Incremental model:
Build 1 Design &
Testing Implementation
Development
There are several Verification phases in the V-Model, each of these are explained in detail
below.
System Design
Once you have the clear and detailed product requirements, it is time to design the complete
system. The system design will have the understanding and detailing the complete hardware
and communication setup for the product under development. The system test plan is
developed based on the system design. Doing this at an earlier stage leaves more time for the
actual test execution later.
Architectural Design
Architectural specifications are understood and designed in this phase. Usually more than one
technical approach is proposed and based on the technical and financial feasibility, the final
decision is taken. The system design is broken down further into modules taking up different
functionality. This is also referred to as High Level Design (HLD).
The data transfer and communication between the internal modules and with the outside
world (other systems) is clearly understood and defined in this stage. With this information,
integration tests can be designed and documented during this stage.
Module Design
In this phase, the detailed internal design for all the system modules is specified, referred
to as Low Level Design (LLD). It is important that the design is compatible with the other
modules in the system architecture and the other external systems. The unit tests make an
essential part of any development process and help eliminate the maximum faults and errors
at a very early stage. These unit tests can be designed at this stage based on the internal
module designs.
Coding Phase
The actual coding of the system modules designed in the design phase is taken up in the
Coding phase. The best suitable programming language is decided based on the system and
architectural requirements.
The coding is performed based on the coding guidelines and standards. The code goes through
numerous code reviews and is optimized for best performance before the final build is checked
into the repository.
80108
1 Programming Logics & Techniques
3 | Program Techniques (Approaches)
Validation Phases
The different Validation Phases in a V-Model are explained in detail below.
Unit Testing
Unit tests designed in the module design phase are executed on the code during this validation
phase. Unit testing is the testing at code level and helps eliminate bugs at an early stage,
though all defects cannot be uncovered by unit testing.
Integration Testing
Integration testing is associated with the architectural design phase. Integration tests are
performed to test the coexistence and communication of the internal modules within the system.
System Testing
System testing is directly associated with the system design phase. System tests check the
entire system functionality and the communication of the system under development with
external systems. Most of the software and hardware compatibility issues can be uncovered
during this system test execution.
Acceptance Testing
Acceptance testing is associated with the business requirement analysis phase and involves
testing the product in user environment. Acceptance tests uncover the compatibility issues
with the other systems available in the user environment. It also discovers the non-functional
issues such as load and performance defects in the actual user environment.
RAD Model
The RAD (Rapid Application Development) model is based on prototyping and iterative
development with no specific planning involved. The process of writing the software itself
involves the planning required for developing the product.
Rapid Application Development focuses on gathering customer requirements through
workshops or focus groups, early testing of the prototypes by the customer using iterative
concept, reuse of the existing prototypes (components), continuous integration and rapid
delivery.
What is RAD?
Rapid application development is a software development methodology that uses minimal
planning in favor of rapid prototyping. A prototype is a working model that is functionally
equivalent to a component of the product.
In the RAD model, the functional modules are developed in parallel as prototypes and are
integrated to make the complete product for faster product delivery. Since there is no detailed
preplanning, it makes it easier to incorporate the changes within the development process.
RAD projects follow iterative and incremental model and have small teams comprising
of developers, domain experts, customer representatives and other IT resources working
progressively on their component or prototype.
The most important aspect for this model to be successful is to make sure that the prototypes
developed are reusable.
Data Modeling
The information gathered in the Business Modeling phase is reviewed and analyzed to form
sets of data objects vital for the business. The attributes of all data sets are identified and
defined. The relation between these data objects are established and defined in detail in
relevance to the business model.
Process Modeling
The data object sets defined in the Data Modeling phase are converted to establish the business
information flow needed to achieve specific business objectives as per the business model.
The process model for any changes or enhancements to the data object sets is defined in this
phase. Process descriptions for adding, deleting, retrieving or modifying a data object are
given.
Application Generation
The actual system is built and coding is done by using automation tools to convert process and
data models into actual prototypes.
01110
1 Programming Logics & Techniques
3 | Program Techniques (Approaches)
Application
Automation Tool
Code
the software developed which may or may not be as per customer requirement. This Big
Bang Model does not follow specific process, there is very little planning required. Even the
customer is not sure about what exactly he wants and the requirements are implemented on
the fly without much analysis.
Usually this model is followed for small projects where the development teams are very small.
Evaluation Model
The evolution tree model, is a two-dimensional software life-cycle model which considers
the software development process as continuous evolution of artifacts. It is viewed as a
maintenance-oriented process based on a tree of engineering decisions made at various times.
Software engineers in response to modifications in the requirements from the customer make
these decisions, as they receive revised requirements from the customer from time to time.
The software product evolves gradually as its versions keep on developing.
Development No
Customer Acceptable to
Application Values Customer
Yes
Base Line
The Application
Fig.: Evolutionary Model
21112
1 Programming Logics & Techniques
3 | Program Techniques (Approaches)
Coupling
In software engineering, the coupling can be defined as the measurement to which the
components of the software depend upon each other. Normally, the coupling is contrasted
with the cohesion. If the system has a low coupling, it is a sign of a well-structured computer
system and a great design. A low coupling combined with the high cohesion, supports the
mission of high readability and maintainability. The coupling term generally occurs together
with the cohesion very frequently.
The coupling is an indication of the strength of the interconnection between all the components
in a system. The highly coupled systems have interconnections, in which the program units
depend upon each other, whereas in the loosely coupled systems made up of components, that
are independent of each other and have no dependence on each other.
In software production or program development system there are different kinds of relation-
ship of one module to another module to obtain specified output. For example, a program is
developed with the combination of sequential logical structure, selection logical structure and
iteration logical structure. In a program, single logic, combination of any two or combination
of all three logical structures is related to a particular task. That is known as inter-relationship
of the logical structure.
Programming Logics & Techniques 113
113
3 | Program Techniques (Approaches)
Obviously, more the relationship among them increases the complexity of the program to
understand, modification, testing and maintenance. The better relationship of program
modules is known as high coupling nature. The logical structure with high coupling figure is
given below.
Similarly, in the general figures, fig (a) has high coupling but less cohesion and fig(b) has low
coupling with high cohesion nature.
Fig (a) Fig (b)
The cohesion is the standard feature of the module in the program. A module has high cohesion
if all of its elements have relatively stronger declaration and are grouped together in the same
module for a logical reason; not just by chance, they co-operate with each other to achieve a
common goal which is the function of the module.
However, cohesion is an internal property of a module, coupling characterizes a module's
relationship to other modules. Coupling measures, the inter dependence of two or more
modules with each other.
It is concluded that to achieve modular composability, decomposability and understanding,
modules must have high cohesion but less coupling.
[e.g.' House wiring- high cohesion and less coupling.]
This diagram creates more concept clear between coupling and cohesion.
Module 1 Module 2
A B C
Cohesion
Coupling
E F
D
G
Module 3 Module 4
Fig.: Coupling and Cohesion among the Modules
41114
1 Programming Logics & Techniques
3 | Program Techniques (Approaches)
In computer science, coupling or dependency is the degree to which each program module
relies on each one of the other modules.
Coupling is usually contrasted with cohesion. Low coupling often correlates with high
cohesion, and vice versa. The software quality metrics of coupling and cohesion were invented
by Larry Constantine, an original developer of Structured Design, who was also an early
proponent of these concepts.
Low coupling
Coupling can be "low" (also "loose" and "weak") or "high" (also "tight" and "strong").
Low coupling refers to a relationship in which one module interacts with another module
through a stable interface and does not need to be concerned with the other module's internal
implementation. With low coupling, a change in one module will not require a change in
the implementation of another module. Low coupling is often a sign of a well-structured
computer system, and when combined with high cohesion, supports the general goals of high
readability and maintainability.
Systems that do not exhibit low coupling might experience the following developmental
difficulties:
• Change in one module forces a ripple of changes in other modules.
• Modules are difficult to understand in isolation.
• Modules are difficult to reuse or test because dependent modules must be included.
The concept of coupling is usually related to the concept of cohesion: low coupling facilitates
high cohesion, and vice versa. For example, one approach to increasing cohesion is functional
design, which seeks to limit the responsibilities of modules along functionality, coupling
increases between two classes A and B if:
• A has an attribute that refers to (is of type) B.
• A calls on services of an object B.
• A has a method which references B (via return type or parameter).
• A is a subclass of (or implements) class B.
Low coupling may also reduce performance, and a highly-coupled system is sometimes
desirable to achieve maximum efficiency. Regardless, in many modern computing systems,
the cost of reduced performance is often seen as a worthy trade for the benefits to the software
development process that result from low coupling.
Types of Coupling
Some types of coupling, in the order of highest to lowest, are as follows:
Content Coupling (high)
Content coupling is when one module modifies or relies on the internal workings of another
module (e.g. accessing local data of another module). Therefore, changing the way, the second
module produces data (location, type, timing) will lead to changing the dependent module.
Common Coupling
Common coupling is when two modules share the same global data (e.g. a global variable).
Changing the shared resource implies changing all the modules using it.
External Coupling
External coupling occurs when two modules share an externally imposed data format,
communication protocol, or device interface.
Control Coupling
In this type of coupling, one module controls the flow of another and passes information
from one to another (e.g. passing a what-to-do flag).
Data Coupling
Data coupling is when modules share data through, for example, parameters. Each datum is
an elementary piece, and these are the only data which are shared (e.g. passing an integer to a
function which computes a square root).
61116
1 Programming Logics & Techniques
3 | Program Techniques (Approaches)
No Coupling
Modules do not communicate at all with one another.
Subclass Coupling
Describes the relationship between a class and its parent. The class is connected to its parent,
but the parent isn't connected to the child.
Temporal Coupling
When two actions are bundled together into one module just because they happen to occur at
the same time, high cohesion and low coupling are attributes of good design.
Module Coupling
Coupling in Software Engineering describes a version of metrics associated with this concept.
For data and control flow coupling:
di = number of input data parameters
ci = number of input control parameters
do = number of output data parameters
co = number of output control parameters
This is due to the low amounts of inter-module dependency. Systems such as CORBA or
COM allow objects to communicate with each other without having to know anything about
the other's implementation. Both these systems even allow for objects to communicate with
objects written in other languages. The fact that the objects may be built independently reduces
the amount of recompilation required when changes are applied.
High Cohesion
Cohesion is a measure of how strongly-related or focused the responsibilities of a single
class are. In object-oriented programming, if the methods that serve the given class tend to be
similar in many aspects the class is said to have high cohesion. In a highly-cohesive system,
code readability and the likelihood of reuse is increased, while complexity is kept manageable.
Cohesion is decreased if:
The responsibilities (methods) of a class have little in common.
Methods carry out many varied activities, often using coarsely-grained or unrelated sets of
data.
Types of Cohesion
Cohesion is a qualitative measure meaning that the source code text to be measured is
examined using a rubric to determine a cohesion classification. The types of cohesion, in
order of the worst to the best type, are as follows:
Coincidental Cohesion (worst)
Coincidental cohesion is when parts of a module are grouped arbitrarily (at random); the parts
have no significant relationship (e.g. a module of frequently used functions).
Logical Cohesion
Logical cohesion is when parts of a module are grouped because they logically are categorised
to do the same thing, even if they are different by nature (e.g. grouping all I/O handling
routines).
Temporal Cohesion
Temporal cohesion is when parts of a module are grouped by when they are processed.
The parts are processed at a particular time in program execution (e.g. a function
which is called after catching an exception which closes open files, creates an error
log, and notifies the user).
81118
1 Programming Logics & Techniques
3 | Program Techniques (Approaches)
Procedural Cohesion
Procedural cohesion is when parts of a module are grouped because they always follow a certain
sequence of execution (e.g. a function which checks file permissions and then opens the file).
Communicational Cohesion
Communicational cohesion is when parts of a module are grouped because they operate on
the same data (e.g. a module which operates on the same record of information).
Sequential Cohesion
Sequential cohesion is when parts of a module are grouped because the output from one part
is the input to another part like an assembly line (e.g. a function which reads data from a file
and processes the data).
Functional cohesion (best)
Functional cohesion is when parts of a module are grouped because they all contribute to a
single well-defined task of the module (e.g. parsing XML in the case of Expat (XML)).
Since cohesion is a ranking type of scale, the ranks do not indicate a steady progression
of improved cohesion. Studies by various people including Larry Constantine, Edward
Yourdon, and Steve McConnell indicate that the first two types of cohesion are inferior;
communicational and sequential cohesion are very good; and functional cohesion is superior.
While functional cohesion is considered the most desirable type of cohesion for a software
module, it may not be achievable. There are cases where communicational cohesion is the
highest level of cohesion that can be attained under the circumstances.
Customer Name
Account Number is OK
FIND
CUSTOMER
NAME Called Module
02120
1 Programming Logics & Techniques
3 | Program Techniques (Approaches)
Questions
Solve the following questions. (each question carries 7/8 Marks)
1. List the types of program development models. Explain V-model & Big Bang
2. Differentiate between structured and object-oriented programming.
3. Define cohesion and coupling with its three types of techniques.
4. Explain Spiral Model of Program Development. Give an example using this model in an
organization.
5. Explain the top down programming technique with an example.
6. What are the Program Development Models? Which type of model do you suggest for
developing a project whose requirements are not clearly provided by the client? Provide
reasons to support your answer.
7. How can the communication between modules be done? Differentiate between cohesion
and coupling.
8. What is waterfall model? Compare waterfall model with spiral model and which one is
preferable to use and why?
9. Define the programming techniques? Explain modular techniques with advantages.
10. What is waterfall model? Compare waterfall model with spiral model and which model
do you prefer to use and why?
Program Maintenance
Unit-4
Objectives
This unit has following objectives:
1) To make the students aware of program maintenance,
cost issues and time factors.
2) To gain the analytical knowledge to set up and ratio of
the budget for development and maintenance of the
programme.
3) To create importance of program documentation and its
standard.
4) To create the idea for program design with system flow
chart and DFD.
5) To lean the necessary requirement specification of the
program and development procedures.
22122
1 Programming Logics & Techniques
4 | Program Maintenance
Introduction
Program maintenance is the process of repairing program after its delivery to the customer
once the system passes the entire test. It can also be defined as the technique of updating,
alteration, or correction of an application.
Software maintenance in software engineering is the modification of a software product
after delivery to correct faults, to improve performance or other attributes, or to adapt the
product to a modified environment
In another sense, software maintenance is the totality of activities required to provide cost-
effective support to a software system. Activities are performed during the pre-delivery stage
as well as the post-delivery stage. Pre-delivery activities include planning for post-delivery
operation, supportability, and logistics determination. Post–delivery activities include
software modification, training, and operating a help desk.
This international standard describes the 6 software maintenance processes as:
i. The implementation processes, which contain software preparation and transition
activities, such as the conception and creation of the maintenance plan, the preparation
for handling problems identified during development, and the follow-up on product
configuration management.
ii. The problem and modification analysis process, which is executed once the application
has become the responsibility of the maintenance group. The maintenance programmer
must analyze each request, confirm it (by reproducing the situation) and check its validity,
investigate it and propose a solution, document the request and the solution proposal, and,
finally, obtain all the required authorizations to apply the modifications.
iii. The process considering the implementation of the modification itself.
iv. The process acceptance of the modification, by checking it with the individual who
submitted the request in order to make sure that the modification provided a solution.
v. The migration process (platform migration, for example) is exceptional, and is not part
of daily maintenance tasks. If the software must be ported to another platform without any
change in functionality, this process will be used and a maintenance project team is likely
to be assigned to this task.
vi. Finally, the last maintenance process, also an event which does not occur on a daily
basis, is the retirement of a piece of software.
Market Conditions
Policies, which change over the time, such as taxation and newly introduced constraints like,
how to maintain book keeping, may trigger need for modification.
Client Requirements
Over the time, customer may ask for new features or functions in the software.
Host Modifications
If any of the hardware and/or platform (such as operating system) of the target host changes,
software changes are needed to keep adaptability.
Organizational Changes
If there is any business level change at client end, such as reduction of organization strength,
acquiring another company, organization venturing into new business, need to modify in the
original software may arise.
These basically can be categorized into five types of maintenance, namely, corrective,
adaptive, perfective, preventive and emergency.
Corrective Maintenance
It is concerned with fixing errors that are observed when the software is in use. It deals with the
repair of faults or defects found in day-to-day system functions. A defect can result due to errors
in software design, logic and coding. Design errors occur when changes made to the software
are incorrect, incomplete, wrongly communicated, or the change request is misunderstood.
Logical errors result from invalid tests and conclusions, incorrect implementation of design
specifications, faulty logic flow, or incomplete test of data. All these errors, referred to as
residual errors, prevent the software from conforming to its agreed specifications. Note that
the need for corrective maintenance is usually initiated by bug reports drawn by the users.
In the event of a system failure due to an error, actions are taken to restore the operation
of the software system. The approach in corrective maintenance is to locate the original
specifications in order to determine what the system was originally designed to do. However,
due to pressure from management, the maintenance team sometimes resorts to emergency
fixes known as patching.
Corrective maintenance accounts for 20% of all the maintenance activities.
Adaptive Maintenance
It is concerned with the change in the software that takes place to make the adapted software
to new environment such as to run the software on a new operating system. It makes the
adapting software change in the environment such as the hardware or the operating system.
The term environment in this context refers to the conditions and the influences which act
(from outside) on the system. For example, business rules, work patterns, and government
policies have a significant impact on the software system.
42124
1 Programming Logics & Techniques
4 | Program Maintenance
For instance, A bank decides to offer a new mortgage product. This will have to be included
in the system so that mortgage interest and payments can be calculated or the Government
recently changed the VAT rate from x% to y%. This change meant that many organizations
had to make alterations to their systems.
Adaptive maintenance accounts for 20% of all the maintenance activities.
Perfective Maintenance
It is concerned with implementing new or changed user requirements. It involves making
functional enhancements to the system in addition to the activities to increase the system’s
performance even when the changes have not been suggested by faults. This includes
enhancing both the function and efficiency of the code and changing the functionalities of the
system as per the users’ changing needs.
Examples of perfective maintenance include Re-organizing data sets within a database so they
can be searched faster or use less storage or providing shortcuts commands that experts can
use instead of the slower standard menu system.
Perfective maintenance accounts for 50%, that is, the largest of all the maintenance activities.
Preventive Maintenance
It involves performing activities to prevent the occurrence of errors. It tends to reduce
the software complexity thereby improving program understandability and increasing
software maintainability. It comprises documentation updating, code optimization, and
code restructuring. Documentation updating involves modifying the documents affected by
the changes in order to correspond to the present state of the system. Code optimization
involves modifying the programs for faster execution or efficient use of storage space. Code
restructuring involves transforming the program structure for reducing the complexity in
source code and making it easier to understand.
Preventive maintenance is limited to the maintenance in organization only and no external
requests are acquired for this type of maintenance.
Preventive maintenance accounts for only 5% of all the maintenance activities.
Emergency Maintenance
It is the unscheduled corrective maintenance performed to keep a system operational. In some
of the cases this maintenance is included in corrective maintenance.
Preventive maintenance accounts for only 5% of all the maintenance activities.
The above classification can include the idea that software maintenance can be either scheduled
or unscheduled and reactive or proactive.
Maintenance Unscheduled Scheduled
Reactive Emergency corrective and Adaptive maintenance
Proactive Perfective, Preventive maintenance
Proactive Maintenance
Planned maintenance (PM), also often referred to as scheduled maintenance or planned
preventive maintenance (PPM) is a proactive strategy where maintenance and inspections on
assets (i.e. plant and equipment) are scheduled at regular intervals to ensure that an item of
equipment is operating correctly and to minimise breakdown and downtime levels.
Reactive Maintenance
On the other hand, reactive maintenance, also often referred to as breakdown maintenance
or corrective maintenance is very much a reactive strategy where repairs are performed at
the point when equipment fails. This is a far costlier approach for an organisation due to
unplanned production downtime, damaged machinery, overtime and callout fees and ideally
should only be performed on parts that are inexpensive and easy to replace.
Reactive maintenance focuses on repairing an asset once the failure occurs.
Proactive maintenance, however, focuses on avoiding repairs and asset failure through
preventive and predictive methods.
Proactive Maintenance vs. Reactive Maintenance
Advantages of Proactive Maintenance Advantages of Reactive Maintenance
Predict failure before they occur Minimal staff needed
Improves asset reliability Minimal preparation time
Saves time and money in the long run Less expensive in the short term
program development. The successful project is always led by two things; they are time factor
and cost effectiveness. The expenditures are hardware, software and skillful experienced
manpower sector where budget should have been properly allocated and distributed.
Similarly, the cost required for maintenance of software is another heading to the software
production field. From the several surveys, it is evidenced that maintenance cost exceeds 60%
of the total cost of software development. To analyse the factor that affects such cost it is
customary to divide software maintenance into three categories, which we have already done
in the previous heading.
Corrective, Adaptive and Perfective maintenance are the main components of software
maintenance. Benet P. Lientz and E. Burton Swanson (1980) by examining several surveys
over 487 companies, they found that the near about cost is distributed according to the
following percentage ratio.
0.012
0.01 Minimum
Cost of
0.008 Replacement
0.006 Preventive
Replacement
0.004 Costs
Corrective
0.002 Replacement
Costs
0
0 100 200 300 400 500 600 700 800 900 1000
Time, t
Fig. : Cost among software maintenance vs. time
Programming Logics & Techniques 127
127
4 | Program Maintenance
The breakdown of maintenance cost was described by Lientz and Swanson (1980) by
examining several surveys.
42% of costs were attributed to changes in user requirement.
17% of costs were attributed to changes in data format.
12% of costs were attributed to changes in emergency fixes.
9% of costs were attributed to changes in routine and debugging
6% of costs were attributed to changes in hardware changes.
5% of costs were attributed to improvement in documentation.
4% of costs were attributed to improvement in efficiency.
5% of costs were attributed to other.
2) System Manual
It is the manual provided by the system designer containing detailed information about
the program. A good documentation or system manual should contain the following
information:
• The syntax and statement of the problem clearly defining the objective of the program
and its importance to the user.
• The detailed information about the program like program function, system limitation,
problem areas; environment of program etc. should be included.
Types of documentation
Based on the application the documentation can be categorized into following types:
• Design Documentation
• Program Documentation
• Training Documentation
• Operations Documentation
• User Reference documentation
Design Documentation
It describes the overall system design and includes system flowcharts, all input/output formats,
file description, control requirements and report specifications.
Program Documentation
It consists of programming specification like program logic, graphic aids, input-output formats etc.
Training Documentation
It includes user training manuals and materials to be used in the conversion and the installa-
tion of system.
03130
1 Programming Logics & Techniques
4 | Program Maintenance
Operations Documentation
It contains instructions for normal operations as well as directions for handling problems and
break-down of the system.
User Reference Documentation
It is used after training is over and the system is installed. It should provide quick, clear
answers like a dictionary.
Program Specification
Program specification is defined as the detail of the documentation which contains a precise
statement of the requirements of the program. In general, we can view a specification as the
statement of an agreement between a producer and a consumer of the service or between an
implementer and a user.
The contents of the program specification are shown below:
• The inputs of the program
• The outputs of the program
• The major program functions
• The different types of the program interface before and after implementation
• The parameter of the programs
• The validation requirements for the layout of output data printout and screens.
• The action to be taken on errors and exceptions
• Any special requirements for table’s formulae or algorithm.
The specification may also contain a more detailed description of the logical rules and
decisions. The program must involve, and more details about how the input should be checked,
altered and used.
To define the program specification various kind of the system design tools are used. The
important tools are algorithm, flowchart, decision table, pseudocode, program flow chart,
system flow chart, dataflow diagram and entity relation diagram. Out of them two tools are
explaining here.
Many more are used on a system flowchart than on a normal flowchart. These are the symbols
that may be used:
Input
Tape Manual Input
Process Process
Storage e.g. Keyboard
Output
Example:
A car repair garage uses a computer system to produce invoices and keep track of the parts it
has in stock. The system uses two files:
• Stock File: Contains details of all parts that are in stock.
• Orders File: Contains details of all parts that are on order.
When a repair is completed the mechanic records the parts that were used in a form. These
parts are then entered into the computer by an operator. The list of parts that is entered is
checked against the stock list to reduce the likelihood of the operator making a mistake. If the
operator enters the name of a part that does not exist then an error report is displayed. When
the parts list has been entered the cost of the parts is looked up in the stock file and an invoice
(bill) is printed for the customer.
Every night the computer system checks the stock file. A report is printed to indicate which
parts need to be ordered from the garage's suppliers. Details of any orders are placed in the
orders file.
When a delivery of new parts is made to the garage the person making the delivery gives the
garage a delivery note. The delivery note contains a list of the parts that have been delivered.
The list of new parts is entered into the computer by an operator. If any parts have been
delivered that were not ordered then an error report is printed. When an order is delivered the
information about the order is removed from the orders file and the stock file is updated.
The structure of this system can be shown in figure using the following system flowchart:
Note that system flowcharts are distinctly different from program flowcharts, which are used
to represent the logic in an algorithm. They do not use a start or end symbol, and are not
intended to represent complex logic.
23132
1 Programming Logics & Techniques
4 | Program Maintenance
Validate parts
Parts list entered list against stock Error report
by operator database showing
invalid parts
Error report
showing Orders file
parts not wanted
Patient
details
Add a new
patient
Visit
details Consultation
Consultation file
Billing
Medicare
Patient system
account
Fig. System flow-chart
Programming Logics & Techniques 133
133
4 | Program Maintenance
Fig.: DFD
43134
1 Programming Logics & Techniques
4 | Program Maintenance
Data flow: It is the route that data takes between the external entities, processes and data
stores. It portrays the interface between the other components and is shown with arrows,
typically labeled with a short data name, like “Billing details.”
1.0
1.0
Process
Process
External External
Entity Entity
63136
1 Programming Logics & Techniques
4 | Program Maintenance
DFD Level 1 provides a more detailed breakout of pieces of the Context Level Diagram. You
will highlight the main functions carried out by the system, as you break down the high-level
process of the Context Diagram into its sub processes.
Reservation
storage file
Room
selection
Process
Reservation
Guest
Process
Report to
admin
Enquiry
Query Confirmation
Process Process
Searching
Guest
Waiting
Reservation Process
Inquiry Process
Waiting
Room selection
Cancellation Process
Hotel
Process
Reservation
rogression to Levels 3, 4 and beyond is possible, but going beyond Level 3 is uncommon.
P
Doing so can create complexity that makes it difficult to communicate, compare or model
effectively.
Using DFD layers, the cascading levels can be nested directly in the diagram, providing a
cleaner look with easy access to the deeper dive.
By becoming sufficiently detailed in the DFD, developers and designers can use it to write
pseudocode, which is a combination of English and the coding language. Pseudocode
facilitates the development of the actual code.
04140
1 Programming Logics & Techniques
4 | Program Maintenance
Top-Down Approach
The system designer makes "a context level DFD" or Level 0, which shows the "interaction"
(data flows) between "the system" (represented by one process) and "the system environment"
(represented by terminators).
The system is "decomposed in lower level DFD (Level 1)" into a set of "processes, data
stores, and the data flows between these processes and data stores".
Each process is then decomposed into an "even lower level diagram containing its sub-
processes".
This approach "then continues on the subsequent sub-processes", until a necessary and
sufficient level of detail is reached which is called the primitive process.
DFD is also a virtually designable diagram that technically or diagrammatically describes the
inflow and outflow of data or information that is provided by the external entity.
In order to understand the concept of data flow diagram, let us consider the following example
of a bank.
People depositing the amount in their respective account in the bank can withdraw amount
whenever they required according to the rules and regulations of bank. Any person or
organization can deposit or withdraw money based on their need. To deposit money in the
bank, one has to fill in the voucher and deposit in his account by the account officer of bank.
The above action can be analyzed by the following context analysis diagram.
Context analysis diagram.
As we know that by above diagram the whole system is represented by a single circle in the
context analysis diagram.
This task is represented by data flow diagram, which is given below.
Amount withdraw
acknowledgment
1 2
Cheque Verification Verified Verification
Account Verified
Issue of Cheque Issue of Amount Record
Holder
Feedback
Fig. Physical DFD of banking system
Enter data store to represent the various data repoints that are found in the system.
4. Label all data flows
Labeling is the process of naming the data flow elements as well as data flow itself. The
labeling to the data flow will have strong effect on following two points
• The readability of the data flow diagram.
• The accuracy of documentation.
The name of the data flow should accurately convey what the data flow is carrying.
Names are chosen to represent not only the data which is flowing, but also what is known
about the data.
Some more guidelines on labeling data flows are as follows:
• Entry of every data flow should be named.
• The name has to apply to the whole data flow and not just to its major elements or
components.
• No two data flows can have the same name.
• Names like "Data" and "Information" should be avoided.
5. Label the process in terms of their inputs and outputs.
The name of the process should accurately convey what is going on in the process, with
respect to data the process receives and sends out. Process name should normally be of
the form (strong verb) or single direct object. For example, in banking system to verify
the cheque the label process name like "verify balance".
Make sure the name of the process accurately conveys everything the process is doing.
Avoid words like "process" and "Handle". All the data, which is flowing into a process,
must be reflected in the output of the process. A process can't generate data on its own. It
only conveys some inputs to output.
1. Omit trivial error handling details: -
A data flow diagram would help the reader in getting the big picture work-out. Once the
broad overview of the system has been obtained, trivial error handling can be done later on.
Error can be considered trivial if they are:
• Not important financially.
• Probability of occurrence inflow is low.
• Irrelevant to the user.
When payment details are being verified invalid payment needn't be documented for the
time being. This doesn't mean that such error conditions are totally ignored. Methods to
take care of them will be discussed later on.
2. Don't show flow of control/Show data flow correctly.
Data flow diagram is a diagram of flow of data in the system. Therefore, it doesn't control
the system. If an information in a data flow is used only to start a process and isn't being
modified by the process, it is called control flow.
Programming Logics & Techniques 143
143
4 | Program Maintenance
Questions
Solve the following questions. (each question carries 7/8 Marks)
1. Write the importance of DFD. Draw the DFD to enroll in BCA first semester program
under Pokhara University.
2. Describe Data Flow Diagram with a suitable example.
3. What is program documentation? In what condition this documentation is more applicable.
4. Define program maintenance in program development. What is the role of budget
allocation while developing a good program?
5. Define program maintenance. What are the problematic areas in program maintenance?
6. What do you mean by DFD? Differentiate between DFD and Flowchart?
7. What is program maintenance? What are the impact of poor software maintenance budget
while system development planning?
8. What is program maintenance? Describe briefly the three types of program maintenance
methods with suitable examples
9. Explain the importance of documentation in program development. If proper documentation
is not done then what would happen?
10. Explain Data flow diagram with its elements. Draw a neat DFD for College Student
Registration System
44144
1 Programming Logics & Techniques
5 | Standalone and Client Server Programming Concept
Objectives
64146
1 Programming Logics & Techniques
5 | Standalone and Client Server Programming Concept
this is still a problem, basic general-purpose operating systems are available for that purpose.
E.g. in the diskette era, apparently standalone utility programs were delivered with a basic
version of DOS fitting onto the same diskette.
A stand-alone operating system is a complete operating system that works on a desktop
or notebook computer. A network operating system (also called network OS or NOS) is an
operating system that supports a network. A network is a collection of computers and devices
connected together via communications media and devices such as cables, telephone lines,
and modems. In some networks, the server is the computer that controls access to the hardware
and software on a network and provides a centralized storage area. The other computers on
the network, called clients, rely on the server(s) for resources.
Now, if we use the above definition, most, if not all, OS's are NOS (which OS's do "not"
support Networks?). If we evolve the definition a bit to refer to ones used as Heavy-Duty
Servers then perhaps a clear distinction would be between Windows XP and Windows Servers
(NT, 2000 etc.). Now if we change the meaning of NOS to mean the OS's that "routers" and
"switches" etc. use to manage networks, then we're speaking about embedded systems.
Linux for example can be considered both as stand-alone and network OS (many use it for
desktop/laptop computers with no servers and a lot of GUI programs as an example while
others strip it down and use it as a main server). It has mobile operating systems (Android for
one) built dependent on its kernel and there are another Embedded OS's that are built over its
kernel.
If by "the norm" you mean to ask about what most people use in their daily lives, then
perhaps with the original definition, yes, but you need to take into account that a lot of layers/
limitations are being removed due to the rising powers of embedded systems/devices and the
ubiquitous nature of the Internet.
84148
1 Programming Logics & Techniques
5 | Standalone and Client Server Programming Concept
more than one computers which are designed as a client machines. Such type of programming
is known as client server programming or computing.
In network architecture each computer or process on the network is either a client or a server.
Servers are powerful computers or processes dedicated to managing disk drives (file servers),
printers (print servers), or network traffic (network servers ). Clients are PCs or workstations
on which users run applications. Clients rely on servers for resources, such as files, devices,
and even processing power.
Another type of network architecture is known as a peer-to-peer architecture because each
node has equivalent responsibilities. Both client/server and peer-to-peer architectures are
widely used, and each has unique advantages and disadvantages.
Client-server architectures are sometimes called two-tier architectures.
Client/server describes the relationship between two computer programs in which one program,
the client, makes a service request from another program, the server, which fulfills the request.
Although the client/server idea can be used by programs within a single computer, it is a more
important idea in a network. In a network, the client/server model provides a convenient way
to interconnect programs that are distributed efficiently across different locations. Computer
transactions using the client/server model are very common. For example, to check your bank
account from your computer, a client program in your computer forwards your request to a
server program at the bank. That program may in turn forward the request to its own client
program that sends a request to a database server at another bank computer to retrieve your
account balance. The balance is returned back to the bank data client, which in turn serves it
back to the client in your personal computer, which displays the information for you.
The client/server model has become one of the central ideas of network computing. Most
business applications being written today use the client/server model. So, does the Internet's
main program, TCP/IP. In marketing, the term has been used to distinguish distributed
computing by smaller dispersed computers from the "monolithic" centralized computing
of mainframe computers. But this distinction has largely disappeared as mainframes and
their applications have also turned to the client/server model and become part of network
computing.
In the usual client/server model, one server, sometimes called a daemon, is activated and
awaits client requests. Typically, multiple client programs share the services of a common
server program. Both client programs and server programs are often part of a larger program
or application. Relative to the Internet, your Web browser is a client program that requests
services (the sending of Web pages or files) from a Web server (which technically is called
a Hypertext Transport Protocol or HTTP server) in another computer somewhere on the
Internet. Similarly, your computer with TCP/IP installed allows you to make client requests
for files from File Transfer Protocol (FTP) servers in other computers on the Internet.
Other program relationship models include master/slave, with one program being in charge of all
other programs, and peer-to-peer, with either of two programs able to initiate a transaction.
In the basic model of client server architecture, a relational database management system
(RDBMS) resides on the server machine. The application program that resides on the client
machine interface with another software layer called middleware that is responsible for
communicating request and their result between the application program and the RDBMS.
05150
1 Programming Logics & Techniques
5 | Standalone and Client Server Programming Concept
A Two-Tier Architecture
Any software used by the user is associated with database server, this driver is known as
proprietary client driver whereas communicating and controlling of client machines programs
is done by corresponding proprietary server driver.
Client Application SQL *.Net
Application Object
Q Q
Oracle Dbase
L L
Client Application SQL *.Net *. *.
N N
e e
t t
Client Application SQL *.Net
25152
1 Programming Logics & Techniques
5 | Standalone and Client Server Programming Concept
Presentation services
'Presentation services' refers to the portion of the application which presents data to the
user. In addition, it also provides for the mechanisms in which the user will interact with
the data. More simply put, presentation logic defines and interacts with the user interface.
The presentation of the data should generally not contain any validation rules. Delphi Client/
Server Suite's Rapid Application Development (RAD) approach to application development
and component architecture allows the developer to easily assemble the presentation layer and
move quickly from prototype to production.
Advantage
Understanding and maintenance is easier.
Disadvantage
Performance will be reduced when there are more users.
Three-tier Architecture
A 'Multi-tier', often referred to as 'three-tier' or 'n-tier,' architecture provides greater application
scalability, lower maintenance, and increased reuse of components. Three-tier architecture
offers a technology neutral method of building Client/Server applications with vendors who
employ standard interfaces which provide services for each logical 'tier'.
Advantages
1. High performance, lightweight persistent objects
2. Scalability – Each tier can scale horizontally
3. Performance – Because the presentation tier can cache requests, network utilization is
minimized, and the load is reduced on the application and data tiers.
4. High degree of flexibility in deployment platform and configuration
5. Better Re-usability
6. Improve data integrity
7. Improved Security – Client is not direct access to database.
8. Easy to maintain and modification is a bit easy, won’t affect other modules
9. In three tier architecture application performance is good.
45154
1 Programming Logics & Techniques
5 | Standalone and Client Server Programming Concept
Disadvantages
Increased Complexity/Effort
Multi-tier architectures
A multi-tier, three-tier, or N-tier implementation employs a three-tier logical architecture
superimposed on a distributed physical model. Application Servers can access other application
servers in order to supply services to the client application as well as supply services for other
application servers.
For example, in the diagram below the client application looks for Application Server #1 to
supply data from a mainframe based application. Application Server #1 has no direct access to
the mainframe application but, it does know, through the development of application services,
that Application Server #2 provides a service to access the data from the mainframe application
which satisfies the client request. Application Server #1 then invokes the appropriate service
on Application Server #2 and receives the requested data which is then passed on to the client.
Application
Server
Legacy
Application
Data Server
Server
a days Internet is not only concentrated on text mode system but also it combines graphics
text, sound and animation into a rich command communication media.
A web-based application is any program that is accessed over a network connection using
HTTP, rather than existing within a device’s memory. Web-based applications often run inside
a web browser. However, web-based applications also may be client-based, where a small part
of the program is downloaded to a user’s desktop, but processing is done over the internet on
an external server.
Web-based applications are also known as web apps.
There is a lot of confusion created by the use of terms like web-based, internet-based and
cloud-based when referring to applications. Web-based applications actually encompass all
the applications that communicate with the user via HTTP. This includes light applications like
Flash games, online calculators, calendars and so on, as well as more intensive applications
such as web-based word processors and spreadsheet applications.
A key difference between cloud and web applications is architecture. A web application or
web-based application must have a continuous internet connection to function. Conversely, a
cloud application or cloud-based application performs processing tasks on a local computer or
workstation. An internet connection is required primarily for downloading or uploading data.
A web application is unusable if the remote server is unavailable. If the remote server becomes
unavailable in a cloud application, the software installed on the local user device can still
operate, although it cannot upload and download data until service at the remote server is
restored.
The difference between cloud and web applications can be illustrated with two common
productivity tools, email and word processing. Gmail, for example, is a web application
that requires only a browser and internet connection. Through the browser, it's possible
to open, write and organize messages using search and sort capabilities. All processing
logic occurs on the servers of the service provider (Google, in this example) via either the
internet's HTTP or HTTPS protocols.
A CRM application accessed through a browser under a fee-based software as a service
(SaaS) arrangement is a web application. Online banking and daily crossword puzzles are
also considered web applications that don't install software locally.
An example of a word-processing cloud application that is installed on a workstation is
Word's Microsoft Office 365. The application performs tasks locally on a machine without
an internet connection. The cloud aspect comes into play when users save work to an Office
365 cloud server.
Most of the web applications - online banking, e-ticketing, flight status checking etc. are real-
ly web applications and are limited by scalability and availability.
The difference between cloud application and web application are given in the tabular format:
Sno. Cloud Application Web Application
1. The application is accessed through the The application is accessed through the
internet or other computer network internet or other computer network
2. All cloud applications are web Not all web applications are cloud
application applications.
3. Majority of the computed cycles Somewhere located elsewhere and are
happening in a data center accessible from almost anywhere
4. Inherently scalable Limited by scalability
5. Very high uptime Limited by availability
6. User Data & Business Process Store in a User Data & Business Process Store in
multiple replicated data centers single data center
7. The provided application is standardized Each customer uses its own instance of
for all customers the application.
8. Multi-tenancy solution Isolated-tenancy solution.
9. Can run on the users' computing systems Only run on the provider's web servers.
or the provider's web servers.
The overall connection system of Internet or web based program is clearly given in the figure
below. It has following components to make connection with the user.
• The internet backbone which provides the control zone of information.
• VSAT which provides the connection (Command) service between satellite and local ser-
vice provider.
• A telephone or cable network line for connection between first and user interface machine.
• To communicate information certain interlinking devices are necessary known as modem/
router which is used to modulate and demodulate (digital to analog and vice versa)
• The browsing system is done by a PC, which is used by user to access the information.
85158
1 Programming Logics & Techniques
5 | Standalone and Client Server Programming Concept
Connection Types
There exist several ways to connect to the internet. Following are these connection types
available:
• Dial-up Connection
• ISDN
• DSL
• Cable TV Internet connections
• Satellite Internet connections
• Wireless Internet Connections
• Dial-up Connection
Dial-up
Dial-up connection uses telephone line to connect PC to the internet. It requires a modem to
setup dial-up connection. This modem works as an interface between PC and the telephone line.
There is also a communication program that instructs the modem to make a call to specific
number provided by an ISP.
Dial-up connection uses either of the following protocols:
• Serial Line Internet Protocol (SLIP)
• Point to Point Protocol (PPP)
The following diagram shows the accessing internet using modem:
Internet
Fr
P
om
IS
To
IS
P
Digital Digital
Signal Signal
Modem Modem
Computer Computer
Fig.: Internet accessing using modem
ISDN
ISDN is acronym of Integrated Services Digital Network. It establishes the connection
using the phone lines which carry digital signals instead of analog signals.
There are two techniques to deliver ISDN services:
• Basic Rate Interface (BRI)
• Primary Rate Interface (PRI)
Key points:
The BRI ISDN consists of three distinct channels on a single ISDN line: 64kbps B (Bearer)
channel and one 16 kbps D (Delta or Data) channels.
The PRI ISDN consists of 23 B channels and one D channels with both have operating capacity
of 64kbps individually making a total transmission rate of 1.54Mbps.
The following diagram shows accessing internet using ISDN connection:
Internet
Fr
SP
om
I
To
IS
P
Digital Digital signal travels over
Signal Digital local digital local telephone line
telephone lines
Computer Computer
Fig.: Internet accessing using ISDN adapter
DSL
DSL is acronym of Digital Subscriber Line. It is a form of broadband connection as it
provides connection over ordinary telephone lines.
Following are the several versions of DSL technique available today:
1. Asymmetric DSL (ADSL)
2. Symmetric DSL (SDSL)
3. High bit-rate DSL (HDSL)
4. Rate adaptive DSL (RDSL)
5. Very high bit-rate DSL (VDSL)
6. ISDN DSL (IDSL)
All of the above-mentioned technologies differ in their upload and download speed, bit trans-
fer rate and level of service.
06160
1 Programming Logics & Techniques
5 | Standalone and Client Server Programming Concept
The following diagram shows that how we can connect to internet using DSL technology:
Internet
DSL Modem
Modem
Router
Key Points:
A cable modem is used to access this service, provided by the cable operator.
The Cable modem comprises two connections: one for internet service and other for Cable
TV signals.
Since Cable TV internet connections share a set amount of bandwidth with a group of
customers, therefore, data transfer rate also depends on number of customers using the internet
at the same time.
The following diagram shows how internet is accessed using Cable TV connection:
From ISP
Node Cable Modem
Internet
Splitter
Cable TV
Converter
Satellite
Modem
26162
1 Programming Logics & Techniques
5 | Standalone and Client Server Programming Concept
Similarly, a simple architecture supporting oracle developer 2000 for the web-based
programming is given in fig below. In this architecture the three tiers are associated to each
other to browse the information.
Mobile Mobile
Sync
Application Module Mobile Server
Message Repositery
Mobile Generator
Oracle Life RDBMS &
Server Processor
(MGP)
Oracle Database
The Oracle Database Lite 10g architecture consists of the Client System, Middle Tier, and the
Database Server. The Client System contains the Oracle Lite database, Oracle Lite RDBMS,
mobile applications, and a mSync (Mobile synchronous) module. The Middle Tier consists
of a Mobile Server and the MGP (message generator and processor). The Database server
contains the Mobile Server Repository.
HTML
It stands for Hypertext markup language. A web page is created using HTML. It consists of
standardized codes known as tags that are used to define the structure of information on a web
page. These codes enable web pages to have many features including bold text, italic text,
headings, paragraph break and numbered or bulleted lists.
HTML is a way of defining the formats of the text in a web page. However, it goes further by
also being able to define placement of graphics and hypertext links. HTML is a sub language
of SGML (Standard Generalized Markup Language) SGML is a system that defines and
standardizes the structure of document. Both SGML and HTML utilize descriptive mark up to
define, the structure of an area of text.
To develop a program through HTML, the tags can be viewed using a varieties of web
browsers. HTML tags are used to define area of a document as having certain characteristic.
The tags used in HTML usually consist of a code in between two wickets. These codes are
called container tags because the formatting described by the tag affects only the text between
the tags.
<B> and </B> - For starting and ending tags for bolding.
<H1> and </H1> - For first heading.
<I> and </I> - For Italics
<jmg. src-"name of picture"> - For an image in sorting
<P> - For paragraph breaking
46164
1 Programming Logics & Techniques
5 | Standalone and Client Server Programming Concept
Java Programming
Java is an object-oriented programming language that was developed after C++ , Java software
has been developed to overcome the complexity of C++.
It is the most popular because it is widely used for internet programming system. Previously
only HTML was used for creating web pages but it is difficult to depend only upon one
language for developing the application as a typical diversity exists on internet in terms of
hardware and software.
Java supports the following data types- bytes, short, int, long, float, double, char.
The looping structure is the same as those of C++. For example, if else, switch, while do, do-
while and for loop. Java programs are of two-types application and applets.
An application is a program that resides on the local hard disk on a machine. The application
program is a standalone program. All the resources that are required like runtime library are
available whereas applet is client server programming to share data in between the no of
clients.
Q. Write a program in Java to print "Nice to meet you".
// Given below is an application that prints "nice to meet you" on the screen.
// Program to display nice to meet you.
class nice
{
Public static void main (string arg [ ] )
{
System.out.println ("nice to meet you");
}
}
HTML
HTML is the standardized markup language that structures and formats content on the web.
Page elements like titles, headings, text and links are included in the HTML document. It is
one of the core technologies in use on the Internet and serves as the backbone of all webpages.
CSS
CSS (Cascading Style Sheets) is a style-sheet language that basically allows web developers
to “set it and forget it.” Paired with HTML, CSS allows a programmer to define the look and
Programming Logics & Techniques 165
165
5 | Standalone and Client Server Programming Concept
format of multiple webpages at once; elements like color, layout and fonts are specified in one
file that’s kept separate from the core code of the webpage.
These two languages provide the basic structure and style information used to create
a static webpages a page that looks the same to everyone who visits it. Many webpages now
are dynamic webpages, which are slightly tailored to each new visitor. To create these more
complex webpages, you need to add more advanced client-side and server-side scripting.
Client-side scripting
Client-side scripting — which includes HTML and CSS — is any code that runs within a web
browser. This means that the web browser temporarily downloads all the files from a web
server and, in turn, displays a static web page; you would be able to view these files even if
you lost your Internet connection (as long as you left your web browser open). JavaScript and
ActionScript are the two most commonly used client-side scripts.
JavaScript
JavaScript is the programming language that brings animation, games, apps, interactivity and
other dynamic effects to life. After HTML and CSS, it’s the most ubiquitous of the client-side
scripts. Some JavaScript applications can even run without connecting back to a web server,
which means they’ll work in a browser with or without an Internet connection.
ActionScript
ActionScript is the language used for Adobe Flash, which is especially well suited for rich
Internet applications that use Flash animation and streaming audio and video.
Whether you use ActionScript or JavaScript is a matter of personal preference, but if you want
to use the popular Adobe Flash Player software to share multimedia applications, ActionScript
is a must.
Server-Side Scripting
All websites need to be hosted (i.e. stored) in a database on a web server. Server-side scripting
simply refers to any code that facilitates the transfer of data from that web server to a browser.
It also refers to any code used to build a database or manage data on the web server itself.
Server-side scripts run on the web server, which has the power and resources to run programs
that are too resource intensive to be run by a web browser. Server-side scripts are also more
secure, because the source code remains on the web server rather than being temporarily
stored on an individual’s computer.
PHP
Used by 75 percent of all web servers, PHP is a general-purpose server-side scripting language.
The chief advantages of PHP are that it is open source, with a huge online community to
support it, and that it’s compatible across multiple platforms. PHP is most often used by
websites with lower traffic demands.
66166
1 Programming Logics & Techniques
5 | Standalone and Client Server Programming Concept
Java
According to a study conducted by W3Tech, Java is the server-side language of choice for
large-scale websites with a high volume of traffic. Sam’s Club, Amazon and Apple App
Store use Java-based web frameworks.
One potential reason for its popularity among high traffic websites is that Java frameworks
outperform other language frameworks in raw speed benchmark tests. That means faster
server-based web applications for large scale websites. Java Servlets, JSP and WebObjects
are examples of server-side solutions that use Java.
Python
Python is a general purpose, high-level programming language that puts an emphasis on code
readability; for web developers, this means they can do more with fewer lines of code than
other popular languages.
Python does this through the use of a large standard library, which keeps the actual code
short and simple. This library is a file that contains pre-coded functions, provided by the
community, which you can download to your server and use in your own code whenever a
specific task appears. Like Java, Python was designed for web servers that deal with a large
amount of traffic. Shopzilla, Yahoo Maps, and the National Weather Service are examples of
sites that use Python.
Ruby
Ruby is similar to Python in that it was designed to make programming more productive by
emphasizing short and simple code that’s concise, consistent and flexible.
Where Ruby differs is in its language or syntax. In Python, there is only one right way to
program things, and it’s efficient and fast. In Ruby, there are multiple ways to do the same
thing, and some may be faster than others. Which language you use is really a matter of
preference.
Ruby on Rails is a very common open-source web framework that enables web developers to
create dynamic websites quickly and efficiently. Like Java, Ruby is more frequently used on
web servers that deal with a large amount of traffic. Scribd, Hulu and Twitter all use Ruby.
Platform Independent
The most popular high-level language is machine independent, due to this special kind of
feature the software production field is becoming popular day by day. Similarly, in web based
programs most of the programs are machine independent. Out of them Java is most popular one.
It is difficult to depend only upon single language for developing the application as a typical
diversity exist on the client server programming fields in the terms hardware and software.
The Java can perform its uniform capability that has been compiled for different hardware and
software environments. In the case of Java, a compiler is a program that translates the source
code for another program from a programming language into executable code.
This executable code may be a sequence of machine instructions that can be executed by
the CPU directly, or it may be an intermediate representation that is interpreted by a virtual
machine. This intermediate representation in Java is the Java Byte Code.
Platform independent means the execution of the program is not restricted by the type of
OS environment provided, thereby, making it possible to process the program at any type of
environment available.
Java is a platform independent language because of the bytecode magic of java. In java, when
we execute the source code, it generates the .class file comprising the bytecodes. Bytecodes
are easily interpreted by JVM (Java virtual machine) which is available with every type of
OS we install.
Whereas C and C++ are compiled languages which makes them platform dependent. The
source code written in C / C++ gets transformed into an object code which is machine and OS
dependent. That's the reason why C and C++ languages are termed as Platform Dependent.
Java is the answer to those problems that exist on the internet. In Java you can write a single
program called on applet that is platform independent. Platform independent means that the
program can be used on any platform with any operating system.
The Java has following features so that the platform requirement object be will fully fulfilled.
• No pointer
• No multiple inheritance
• No go to
• No operator overloading
In C++ we can allocate and delicate the memory by new and delete. The Java language has
an embedded auto garbage collection mechanism. The garbage collectors simplify Java
programming by automatically freeing memory when it is not required.
86168
1 Programming Logics & Techniques
5 | Standalone and Client Server Programming Concept
Questions
Index -1
List of Abbreviations
A
ADSL Asymmetric Digital Subscriber Line
AGP Accelerated Graphics Port
ANSI American National Standards Institute
ASME American Society of Mechanical Engineers
ASP Active Server pages
B
B-0 Business Language Version-0
BASIC Beginner’s All-Purpose Instruction Code
BCPL Baltimore County Public Library
BIOS Basic Input Output system
BPR Business Process Re-engineering
BRI Basic Rate Interface
C
CASE Computer Aided(Assisted) Software/System Engineering
CCS Cascading Style Sheets
CDROM Compact Disk read Only memory
CEO Chief Executive Officer
CERN European Organization for Nuclear Research
COBOL Common Business Oriented language
CODASYL Conference on Data Systems Languages
COM Component Object Model
CORBA Common Object Request Broker Architecture
CPU Central Processing Unit
CRM Customer Relationship Management
CRT Cathode Ray Tube
D
DCOM Distributed Component Object Model
07170
1 Programming Logics & Techniques
5 | Standalone and Client Server Programming Concept
E
ETH Ethan Allen Interiors, Inc.
F
FORTRAN Formula Translator
FTP File Transfer Protocol
G
GL Generation of Language
GNU Gnus Not Unix
GUI Graphical User Interfaces
GWBASIC Gee-Whiz BASIC
H
HAL Heuristically Programmed ALgorithmic
HLD High Level Design
HLL High Level Language
HTML Hyper Text Markup Language
HTTP Hyper Text Transfer Protocol
I
I/P Input
IBM International Business Machine
ICT Information Communication Technology
ISDN Integrated Services Digital Network
ISO International Standard Organization/International Organization for
Standardization
ISP Internet Service Provider
IT Information Technology
J
JAVA Just Another Vague Acronym
JSP Java Server Pages
L
LAN Local Area Network
LCD Liquid Crystal Display
LED Light Emitting Diode
LISP List Processing
LLD Low Level Design
LLL Low Level Language
LOGO Language of Graphic Oriented
M
MAN Metropolitan Area Network
MGP Messaging Gateway Protocol/ Message Generator and Processor
MICR Magnetic Ink Character Recognition
N
NOS Network Operating System
NT New Technology
O
O/P Output
OCR Optical Character Recognition
OMR Optical Mark Recognition
OOAD Object Oriented Analysis and Design
OOPS Object Oriented Programming System
ORACLE Oak Ridge Automatic Computer and Logical Engine
OS Operating System
P
PC Personal Computer
PDQ Parallel Data Query
PHP PHP: Hypertext Preprocessor (earlier called Personal Home Page)
PL Programming Language
27172
1 Programming Logics & Techniques
5 | Standalone and Client Server Programming Concept
PM Planned/Preventive Maintenance
PPM Planned Preventive Maintenance
PPT Point to Point Protocol
PRI Primary rate Interface
PROLOG PROgramming in LOGic
Q
QBASIC Quick BASIC
QBE Query By example
QoS Quality of Service
R
RAD Rapid Application Development
RAM Random Access Memory
RDBMS Relational Database Management System
ROI Return on Investment
ROM Read Only Memory
RPMS Revolution Per Minutes
S
SaaS Software as a Service
SAS Stand Alone System
SDLC System Development Life Cycle
SDM System Development Method
SGML Standard Generalized Markup Language
SLIP Serial Line Internet Protocol
SQL Structure Query Language
SSADM Structured Systems Analysis and Design Method
T
TCP/IP Transmission Control Protocol/ Internet Protocol
TV Television
U
UDP User Diagram Protocol
UML Unified Modeling Language
V
VAT Value Added Tax
VCR Video Cassette Recorder
VGA Video Graphics Array
VoIP Voice over Internet Protocol
VS Versus
VSAT Very Small Aperture Terminal
W
WAN Wide Area Network
WWW World Wide Web
X
XML EXtensible Markup Language
47174
1 Programming Logics & Techniques
5 | Standalone and Client Server Programming Concept
Index-2
CMP 124.3
Programming Logics and Techniques (3-0-0)
Evaluation:
Theory Practical Total
Sessional 50 - 50
Final 50 - 50
Total 100 - 100
Course Objectives:
This course is designed to acquaint the student with the concept off fundamental
problem analysis, modeling and coding techniques.
Course Contents:
1. Programming Languages 14 hours
1.1 Introduction
1.2 Analogy with Natural Language
1.3 Classification of Computer Language
(Low Level Language and High-Level Language)
1.3.1 Low Level Languages, (Machine and Assembly Language)
1.3.2 Advantages and Disadvantages of Machine Level Language
1.3.3 Advantages of Assembly Language over Machine Level Language
1.3.4 Disadvantages of Assembly Language
1.4 High Level Language
1.4.1 Advantages and Limitations of High Level Language
1.4.2 Difference between Low Level and High-Level Language
1.4.3 Program Language Translator
1.4.3.1 Types of Translators (Compiler, Assembler and Interpreter)
1.4.3.2 Difference among Translators
1.5 Linker and Loader
1.5.1 Types of Linker and Loader
1.6 Generation of Computer Languages
1.6.1 3GL and 4GL
1.6.2 Advantages of 4GL over 3GL
1.6.3 Feature of 4GL (Object Oriented Language)
1.7 Some Important Types of High Level Language
1.8 Machine Independence and Portability of programs
Programming Logics & Techniques 175
175
5 | Standalone and Client Server Programming Concept
67176
1 Programming Logics & Techniques
5 | Standalone and Client Server Programming Concept
Reference Books:
a. V.K. Jain: Computer Fundamentals, BPB Publication
b. Foundations of Computing, BPB Publication (Third Edition)
Index -3
POKHARA UNIVERSITY
Level: Bachelor Semester - Fall Year : 20XX
Programme: BCA Full Marks: 100
Course: Programming Logic and Techniques Pass Marks: 45
Time : 3hrs.
Candidates are required to give their answers in their own words as far as practicable.
The figures in the margin indicate full marks.
POKHARA UNIVERSITY
Level: Bachelor Semester - Fall Year : 20XX
Programme: BCA Full Marks: 100
Course: Programming Logic and Techniques Pass Marks: 45
Time : 3hrs.
Candidates are required to give their answers in their own words as far as practicable.
The figures in the margin indicate full marks.
08180
1 Programming Logics & Techniques
5 | Standalone and Client Server Programming Concept
POKHARA UNIVERSITY
Level: Bachelor Semester - Fall Year : 20XX
Programme: BCA Full Marks: 100
Course: Programming Logic and Techniques Pass Marks: 45
Time : 3hrs.
Candidates are required to give their answers in their own words as far as practicable.
The figures in the margin indicate full marks.
POKHARA UNIVERSITY
Level: Bachelor Semester - Fall Year : 20XX
Programme: BCA Full Marks: 100
Course: Programming Logic and Techniques Pass Marks: 45
Time : 3hrs.
Candidates are required to give their answers in their own words as far as practicable.
The figures in the margin indicate full marks.
Attempt all the questions.
1. a) What do you mean by fourth generation language (4GL)? Discuss its advantages
and limitations. 8
b) Compare and contrast low level language with high level language. 7
2. a) What do you understand by program development? Does requirement analysis
play important role while system development? Justify your answer with suitable
reasons. 7
b) Assume the tax system of any company as:
• If the employee is male and annual salary is <=2,00,000 then no income tax.
• If the employee is female and annual salary is <=2,00,000 then 5% tax on total
salary.
• If the employee is male and salary is above 2,00,000 but <=3,00,000 then 10 %
income tax on total salary.
• If the employee is female and annual salary is above 2,00,000 but <=3,00,000
then 12 % income tax on the total salary.
• If annual salary is more than 3,00,000 then 20% income tax on total salary for
all employees.
Now construct a decision table to represent the above conditions. 8
3. a) Explain in details about the spiral model of program development with the help of
diagram. 7
b) Define iterative and recursive logic of program development with suitable
example. 8
4. a) What is program maintenance? What are the impact of poor software maintenance
budget while system development and planning? 7
b) What is the significance of DFD? Differentiate between DFD and Flowchart. 8
5. a) Why do you use mostly client server programming rather than standalone
programming? Also show the architecture of the client server programming. 8
b) How does JAVA programming work as a platform independent system? 7
6. a) How modules communicate with each other? Explain.
b) Explain the need for testing and debugging in program development.
c) Explain the importance of compilers and interpreters in programming language. 3×5
7. Write short notes on: (Any Two) 2x5
a) Program design and program coding
b) Object Oriented Programming c) Prototype of program development
28182
1 Programming Logics & Techniques
5 | Standalone and Client Server Programming Concept
POKHARA UNIVERSITY
Level: Bachelor Semester - Fall Year : 20XX
Programme: BCA Full Marks: 100
Course: Programming Logic and Techniques Pass Marks: 45
Time : 3hrs.
Candidates are required to give their answers in their own words as far as practicable.
The figures in the margin indicate full marks.
Attempt all the questions.
1. a) What do you mean by program language translator? Compare and contrast between compiler
and interpreter. 8
b) Explain the computer programming language generations with classification diagram. 7
2. a) Discuss the need of loader and linker. Is it essential for a programming language to
attain machine independence? Justify you answer with reference to some well-known
programming language. 8
b) Explain flowchart and algorithm along with its uses in program development. Draw a flow
chart to find the sum of the digits of the input number. 7
3. a) What types of program designing tools are widely used for software development? Draw
a flow chart to ask marks obtained in any five subjects in Semester End Examination and
calculate total marks, percentage of marks and division where if:
percentage>=90 : ‘A Grade’ 8
percentage>=80 & percentage <90 : ‘B Grade’
percentage>=70 & percentage<80 : ‘C Grade’
percentage>=60 & percentage<70 : ‘D Grade’
percentage>=45 & percentage<60 : ‘E Grade’ otherwise ‘Fail’.
b) Why is it essential to follow software development life cycle? How are design and analysis
related to each other? Illustrate your understanding with a relevant example. 7
4. a) What are the Program Development Models (methods)? Which type of model do you
suggest for developing a project whose requirements are not clearly provided by the client?
Provide reasons to support your answer. 7
b) How can the communication between modules be done? Differentiate between cohesion
and coupling. 8
5. a) Explain Data flow diagram with its elements. Draw a neat DFD for College Student
Registration System 8
b) What are different cost issues to be considered in software maintenance? Explain with
examples. 7
6. a) What do you mean by Standalone and Client-Server programming? Is client-server
programming is better than Standalone programming? If yes, explain how? 8
b) Discuss the architecture of web based programming. Which web based language would you
prefer for developing a web application? Explain with reasons. 7
7. Write short note on any two:
• Good documentation
• Natural programing Language (NPL)
• Modular designing and programming 2×5
Programming Logics & Techniques 183
183
5 | Standalone and Client Server Programming Concept
POKHARA UNIVERSITY
Level: Bachelor Semester - Fall Year : 20XX
Programme: BCA Full Marks: 100
Course: Programming Logic and Techniques Pass Marks: 45
Time : 3hrs.
Candidates are required to give their answers in their own words as far as practicable.
The figures in the margin indicate full marks.
48184
1 Programming Logics & Techniques