chapter-1 introduction introduction -...
TRANSCRIPT
Chapter-1 Introduction Page No. 1
INTRODUCTION
This is first chapter of the thesis, containing overview for the work done, statement of
problem, basic definition of terms and motivation for the research followed by talk a brief
discussion of all containing chapters given as the outline of entire thesis and contribution
of this research.
1.1 Overview
The programming languages have great deal of responsibility to solve the problems of
respondents. All aspect which are belong to computer field, are directly or indirectly
related to programming languages. The object oriented programming language is one of
the strong language among different languages. The Object-Oriented Design being
Applications development has been the essential reference to object-oriented technology
for long time, which has evolved to attempt the mainstream of strength of industry for a
software development. In this century, it is so challenging to develop an interactive and
efficient user interface.
The user interface (UI), in the industrial design area of machine interaction with human,
is the intermediate between humans and machines. The main goal of interaction between
a machine and a human at the user interface is control of the machine and effective
operation, the response from the machine which aids the operator in making operational
decisions. Examples of different concept of user interfaces (UI) are following.
• System Software(Operating System)
o Operating System facilitates interaction with Operator and other all the
computer resources like a government. There are so many operating
systems in market like windows, Linux Solaris etc.
Chapter-1 Introduction Page No. 2
• Application Software
o All the computer software which is developed to perform particular tasks
(word processing, mathematical operation, presentation, photo editing,
account management etc.) is called application software.
• Utility Software
o All the computer software which is developed to help maintain, configure,
analyze, optimize a computer is called utility software.
The main goal of human-machine interaction engineering is to design a user interface
(UI) which makes it simple, effective, enjoyable and efficient to operate a machine in the
way which produces the expected outcome. Overall the operator needs to provide
minimal input to achieve the expected output and minimizes unexpected outputs to the
operator. It is societal awareness of heavy machinery being use of the relative decline and
personal computers. The GUI has their overtone as UI. While machinery control and
industrial control design discussions more commonly refer to human-machine interfaces.
1.1.1 Hierarchy of programming paradigms
The process of problem-solving using a computer is an intricate process requiring much
thought, careful planning, logical precision, persistence and attention to detail. On the
other hand, it can be challenging, exciting and satisfying with considerable scope for
personal creativity and expression. If problem-solving is approach in the latter spirit, the
chances of success are greatly amplified.
A programmer’s primary task is to write software to solve a problem. Many
programming models have evolved to help programmers in being more effective. These
are discussed below.
1.1.1.1 Aspect-oriented programming (AOP)
Aspect oriented programming (AOP) basically design for raising modularity to allow
cross cutting technique.
Chapter-1 Introduction Page No. 3
AOP paradigm is concern breaking down a program into different parts. Mostly all the
programming paradigm support some level of grouping like abstraction, encapsulation of
concern into distinct and independent entities. Some other concern the encapsulation
called crosscutting; means “cut across” multiple abstractions in a code of program.
AOP implementations have expressions that encapsulate each and every concern in one
place. This implementations lies difference between usability, safety, and power of the
constructs provided. [1]
Figure 1.1: Aspect Oriented Programming execution methods
1.1.1.2.Subject-Oriented programming(SOP)
SOP allow the method of programming that supports to develop object oriented systems
as inheriting systems by composing them with new subjects, integrating systems by
composing them with one another and as compositions of subjects.
SOP involves dividing a system into writing rules to compose them correctly and
subjects. Subject Oriented Programming attempts to solve problems the cognitive
abilities of programmers by instantiate subjects.
Chapter-1 Introduction Page No. 4
SOP is complements OOP, solving a number of problems that arise when object oriented
programming is used to develop integrated applications or suites of inter operating or
large systems. Subject Oriented Programming paradigm relied on a compositor, that’s
why, it is reliance on class. [2]
Figure 1.2: Subject Oriented Programming Paradigm [3]
1.1.1.3.Functional Programming(FP)
Functional Programming paradigm supports computer processing as the evolution of
arithmetic functions and avoids mutable data and their state. It concentrates on functions
rather than emphasizes change in state like imperative programming.
Microsoft has also turned their attention towards FP with introduction of a.NET based
functional programming language and F#, in 2005.
FP is purely functional. Functional Programming languages have mostly been
emphasized in academia rather than in commercial software development. Functional
Programming used in commercial applications include (Haskell, Erlang, Ocaml,
Mathematica, XSLT and financial analysis) and industry.
So many non-functional programming languages like C, C++ and C# can be made to
exhibit functional behaviors using lambda functions and function pointers.
The functional programming language based on the lambda calculus. Latest version of
functional programming languages can be viewed as the lambda calculus.
Chapter-1 Introduction Page No. 5
Functional Programming in non-functional languages
Non-functional programming languages have features which are borrowed such as list
comprehensions from FPL and higher-order functions. Because of using all these
language it is easy to adopt a functional style.
There is possibility to employ a functional style of programming in languages that are not
traditionally considered functional languages. FP constructs higher order functions and
lists can be contained in C++. In case of C it can implement function pointers to achieve
effects of higher order functions.
Example: it can use common function design using function pointers. In version 3.0 and
higher of C#, to write programs in a functional style the lambda functions can be
employed.[4]
Figure 1.3: Functional Programming Method [5]
1.1.1.4. Logic Programming (LP)
Logic programming is used in arithmetic logic for computer programming. As far as
logic programming is concern, logic is used as a representation language of declaration.
Logic Programming adopts two methods to solving the problem; first method is that the
programmer is responsible only for assuring the reality of programs expressed in logical
form and the second method is that model generator or theorem-prove, which has
responsibility to solve the problem efficiently and effectively. Logic programming is
Chapter-1 Introduction Page No. 6
commonly understood. Logic can be used in procedural representation language and
declarative representation language. LP is based on the basic fact which a backwards
reasoning theorem-prove applied to declarative sentences in the form of implication:
If L1 and ………….. Ln then D
It is behave like goal-reduction procedures
For example, Logical Programming consider the implication
If the button of alarm signal will be pressed by you,
Then a possible urgency make alert to the driver of the train
As the process for the same:
The button of alarm signal should be pressed to attention the operator of the train.
Keep in mind, LDK elucidation of constructivist reason will be dependable with this; as a
result of problem D given solutions of L1……Ln there inference will be interpreted.
Conversely, logic programming’s characteristic is that group of formulas might be
considered as proof search and programs could be given a computational sense.
Restricting the underlying logic achieve to a biddable segment like traditional harrop
formulas or horn articles.
The developer will be responsible for ensuring the truth of code of programs due to the
purely declarative case. Because of infeasibility of automated proof, LP is commonly
understood, it is also relies on the developer to make certain that presumptions are
generated efficiently and effectively. It needs to be aware to achieve efficiency and
behavior of the problem solving of the theorem-prove. In this reverence, LP is equivalent
to straight IP (imperative programming). [6]
Chapter-1 Introduction Page No. 7
Figure 1.4: Logic Programming Architecture [7]
1.1.1.5. Imperative Programming(IP)
The IP (Imperative Programming) is other concept of programming paradigm. IP
illustrates computation in expressions of instructions that may transform a program state.
The imperative program expresses commands to take action and describe progressions of
commands for performance of computer. As far as declarative programming is concern, it
is opposite, without prescribing how to do and what needs to do in expressions of
progressions of exploits to be taken for the same. FP (Functional Programming) and LP
(Logical Programming) are examples of a more declarative method. [8]
Chapter-1 Introduction Page No. 8
Figure 1.5: Imperative Programming Model [9]
1.1.1.6. Event Driven Programming(EDP)
Event Driven Programming means problem solving controlling will be event based. In
EDP paradigm the problem solving is determined by user actions or event (keyboard
event-key presses, mouse event-mouse clicks) or threads or sensor outputs or messages
from different code of program.
EDP architecture can be divided into two parts: the first part includes event part and the
second part is event handling.
In any programming language can support event driven programs. It is so easy to perform
the task in languages due to high level abstractions to support for the same. There are so
many Integrated Development Environments, which provide repetitive tasks and code
generation methods for event handling. [10]
Chapter-1 Introduction Page No. 9
Figure 1.6: Event Handling Architecture [11]
1.1.1.7. Parallel Computing Paradigm (PCP)
Parallel Computing Paradigm (PCP) supports simultaneous execution of instructions of
the program. PCP is a different form of computation, which divides large program into
smaller parts and all the parts are solves concurrently or simultaneously or parallel. PCP
has different forms which show in following:
Parallel Computing Paradigm
Data Parallelism Bit Level Parallelism Task Parallelism Instruction Level Parallelism
Chapter-1 Introduction Page No. 10
Parallel computers may be considered as a supportive for that hardware which belongs to
multi-processor, multi-core systems having more than one processing elements inside a
one machine. More than one computer systems are used by MPPs, clusters and work to
do same problem.
It is so tuff to write a code for a particular problem in PCP. Because there will be
different new classes to handle concurrent execution of the programs. There is great deal
of problem between harmonization and announcement to get good performance for
parallel program. According to Amdahl’s law the result of parallelization can be achieved
so fast by speed-up of a program.
PCP basically used in high performance computing for last many years. As far as the
concept of averting frequency scaling of physical restraints, the PCP is the very ones for
the same. Due to this peculiarity, PCP has been best paradigm for last years. Now PCP is
most the dominant paradigm among other paradigms especially for multi-core processors
in computer architecture.
PCP could be separated into two models.
• The first model is called the node only model where more than one thread of a
single source code executes.
• The second model is called the host-node (master-slave) where a distinct program
(control) defined the host have responsibility to execute for different processes
collection, initialization, show outputs , timing of functions and spawning [12]
Figure 1.7: Parallel Computing Processes [13]
Chapter-1 Introduction Page No. 11
1.1.1.8 Recursive Programming(RP)
Recursive Programming requires divided complicated cases into the some base case. The
problem should be reduced in each recursive call. The recursion has been called as
generative method or structural method. Generative method or structural method
achieves the data that comes from a data structure as a list, this procedure can be called
structurally recursive otherwise it will be generatively recursive.
The new piece of data is generated using recursive algorithms from the input data. HTDP
(How To Design Programs) suggests generative recursive which includes the followings:
merge sort, quick sort, adaptive integration, gcd, Newton’s method and binary search.
[14]
Figure 1.8: Recursive Programming Paradigms [15]
Chapter-1 Introduction Page No. 12
1.1.1.9 Scalar Programming(SP)
At a time a single value should be operated, it was basis reason to develop scalar
programming (SP). SP applies that king of programming approaches which never go
with APP (Array Programming Paradigm). SP supports Low Level Programming (LLP)
approach that abstract the program to maintain data aggregation.[16]
Figure 1.9: Scalar Programming Paradigms [17]
1.1.1.10 Structured Programming Paradigm (SPP)
It can be said that Structured Programming Paradigm (SPP) is the sister concern of
procedure oriented programming (POP). SPP has been so popular being a reducing or
removing factor on the statement of GOTO (keyword). To construct structured programs,
there are different methodologies or techniques which are developed for the same. The
followings are common among them:
i. As far as Edsger Dijkstra’s view is concern, in SPP the concept or logic of a
statement is properly structured with limited ways. SPP supports the methods that
believe in understating every structure rather than understanding a program.
Chapter-1 Introduction Page No. 13
ii. According to Dijkstra, the program should be divided into sub parts with single
entry point.
iii. The process of aligning data structures in the source code of program is called
Data Structured Programming (DSP). DSP paradigm is also purposed by Edsger
Dijkstra. It supports primary structures. As far as constructing a program is
concern that applies high level structure for process of data structures.
iv. Ken Orr, Jean Dominique Warnier and Michael A. Jackson pointed three methods
for designing data structure program.
v. SPP design for structured programming but after 1969, to handle complicated or
large code of the program developed Object Oriented Programming for the same.
Structured Programming can be done in any programming language, but
procedural programming language can be preferable to use. During 1970 when
Structured Programming had been as famous as a technique, the POL applied the
some features into structured programming to enhance their performance. Pascal,
Ada, PL/I and ALGOL are most of structured programming languages.[18]
Figure 1.10: Structured Programming Paradigm [19]
Chapter-1 Introduction Page No. 14
1.1.1.11. Modular Programming Paradigm (MPP)
Module means the group of procedures that is related to data being manipulated. Modular
Programming Paradigm believes in designing of programs from procedures of the design
and toward the composition of data. MPP considers expanding the size of program.
Modular Programming Paradigm supports the data hiding principle. The grouping of
procedures of concern data is not supported by this principle. The techniques for
designing good procedures in a module are implemented for each procedure. The
definition of a stack is the example of module. The following problem must be solved.
i. The function push ( ) and pop ( ) in stack is used to user interface (UI).
ii. The user should insure that the demonstration of the stack must be done via
push ( ) and pop ( ).
iii. The initialization of stack must be done before their first use.
Bjarne Stroustrup’s C++ or C with class or incremented version of C make available a
technique the grouping of concern data, method into different namespaces. The UI of a
Stack module can be used as follows:
namespace Stack
{
char pop( );
void push(char);
}
void function( )
{
Stack::push(‘d’);
If(Stack::pop() !=’d’)
}
Chapter-1 Introduction Page No. 15
The main feature of Stack module is that the code is padding from the data demonstration
of Stack by code explaining Stack::pop() and Stack::push(). There is no require by the
user that the Stack is demonstrated using sequence of data (array) and it may be altered.
The data is one of the things that may want to hide. It is so large to the representation of
data hiding, which may be called functions or methods or procedure. [20]
Figure 1.11: Modular Programming Model
1.1.1.12. Procedure Oriented Programming (POP)
In the Procedure Oriented Programming (POP), the program to solve related problem is
separated into sub parts of the problem which is depending upon their functions. The sub
parts of the problem are also called method or functions or procedures. During the
execution of the program any method or procedure or function can be executed at any
time or point. There are two types of variable in the program, first is global variable and
second is local variable. The global variables can only be used.
Chapter-1 Introduction Page No. 16
Figure 1.12: Procedural Oriented Programming [22]
Think of each small solution as a task, to perform which you write a block of code called
a function. You can call one function from another. However, you must ensure that a
function used to change one part of the system does not have an undesirable effect on
another part of the system.
The software development in POP is procedural or functional or method-centric since it
looks at the procedures in a system. Such an approach is not ideally suited for developing
complex software because it concentrates on the processes of the application for which
the software is being developed. Consequently, the modules of the application software
constructed by such an approach are so tightly interwoven and interdependent that it is
difficult to separate one module from another. The reusability of software becomes
difficult as its complexity increases with processes.
Just as the employees of an organization can be grouped according to their functions and
then arranged in a hierarchy, you can simplify the software complexity of a system by
breaking the system into its component parts and arranging them in a hierarchy. Take the
Personal Computer (PC), for example. It is a moderately complex system. If we take a
closer look, we see that most PCs can be broken down into various components, which
can be broadly classified as the Central Processing Unit (CPU), the Visual Display Unit
(VDU), the keyboard and the secondary storage device. The CPU itself can be broken
down into its component parts: the Arithmetic Logic Unit (ALU), the math co-processor,
Chapter-1 Introduction Page No. 17
the clock, and the chip. Thus, entities as complex as the PC can be broken down to the
last logical component such that we know the individual functioning of each component.
While each component has its own logical function, the combined operation of each
component makes the PC function as a cohesive unit. When you break it down into its
component parts, and analyze the functioning of each part, you get a clearer picture.
Figure 1.13: Architecture of Computer
In other words, instead of trying to understand the working of a PC, it is easier to
determine its component objects, define their functions, and then determine how these
component objects interact with each other.
Chapter-1 Introduction Page No. 18
Let us see what would happen if we concentrate on how the PC works, instead of on the
components of the PC. Should one of the components of the PC (say, the clock chip) stop
functioning, we would not be able to figure out what precisely is wrong with the PC. If
we know the components and their behavior, we would be able to determine that the
clock chip is at fault and replace it with a new one. Thus, it is clear that an application has
to be broken down into small units for easy maintenance of software.
In the procedural approach, portions of the code are so interdependent that the code in
one application cannot be reused in another. Thus, it is not possible to use a module of an
airline reservation application that prints airline tickets to print railway tickets.
Another outcome of the interdependence between modules is that procedural or
structured software is inflexible to change. Since application areas are constantly
upgraded, the software designed for them must track these changes. In structured
software, a change means rewriting huge portions of the code. As a consequence of this,
software maintenance costs are very high.
Given the drawbacks of the procedural approach, it was only natural that software
engineers sought better approaches and methods for developing software. They wondered
why software could not be constructed the way as aircraft or a high-rise building is by
putting together several small components to build the whole. The component objects of
the application that interacted with each other could be used to build the software. What
was required in the building of software was object-orientation rather than process-
orientation.
In an attempt to solve the problems inherent in procedural programming, programmers
turned to the object-oriented programming model. POP supports Top-Down
programming method. In this paradigm error detection and identify the data by the
function is so difficult
1.1.1.13. Object-Oriented Programming (OOP)
An object is one of the first things that an infant learns to recognize. The multitude of
‘things’ that hover above its crib, that smile and talk to it, that pat its head and pinch its
Chapter-1 Introduction Page No. 19
cheeks are people. Sometime later, it learns to recognize other such things the circular
things with a dial on one wall of the house is a clock,
The longish 'things' arranged neatly on the shelves are books, and that weird contraption
resting on the table and making a noise is the stereo tape-recorder. Mind you, the infant
does not know that these things are named so, but recognizes them in much the same way
as it recognizes its mother and father.
As the infant grows older, it leads to recognize an object as not only having a definite,
distinct boundary, but also as something that has a unique identity, quite apart from the
other objects surrounding it.
The dictionary defines an object as a material thing that is capable of being presented to
the senses. For our purpose, a simple definition of an object would be a tangible entity
that exhibits some well-defined behavior. Take a tennis ball, for example:
� A tennis ball is a tangible, visible entity that has a visible boundary.
� A tennis ball has a defined purpose.
� You can direct a specific action towards a tennis ball, for example, hit it with a
racket and send it flying.
Let us not limit our definition of an object to merely something that can be seen, held and
touched, such as a tennis ball, a light bulb, an automobile, and an armchair. For the
purpose of software development, the concept of an object needs refinement. Take the
example of 'Acme Nuts and Bolts Company'. Unlike a tennis ball or a tape recorder, an
organization, you will argue, does not have a visible boundary. True, but while it does not
possess a physical boundary, it does have a conceptual boundary. Like all organizations,
it has a specific defined purpose, and one can direct a specific action towards it (just ask
the customers and shareholders). Thus, by our definition, Acme Nuts and Bolts Company'
is an object.
According to Grady Booch, a leading exponent of the object-oriented approach, an object
has the following characteristics:
� It has a state.
� It may display a behavior.
� It has a unique identity.
Chapter-1 Introduction Page No. 20
The state of an object is indicated by a set of attributes and the values of these attributes.
Thus, a chemical compound can be characterized by its temperature, pressure, and
density, and the values of each of these attributes.
The behavior refers to a change of these attributes over a period of time.
What is identity? Each object has a unique identity, just as each person has a unique
identity. Thus two tennis balls may be of the same color and material, have the same
weight and circumference, and display the same behavior but still have distinct identities.
Say, one ball has the factory seal number ALGPG1720 and the other ALGPG1721.
The following diagram displays the state, the behavior, and the identity for a light bulb.
Figure 1.14: State, Behavior, and Identity of Object
Look at the world around you. It is full of objects of different shapes, sizes and colors,
objects stationary and mobile, and objects that exist in this world for different purposes.
If we were to deal with this vast number and variety of objects simultaneously, we would
be at a loss. We can only do what zoologists do. Zoologists cannot do any meaningful
study of the millions of animals inhabiting the earth without organizing them in a logical
manner. Thus, they have classified animals into their kingdoms, genus, families, and
species.
Similarly, the millions of objects that we see in this world can be classified based on their
common attributes. Let us take a simple example from the animal world. The peacock,
the sparrow, and the kingfisher are all called Birds. Why? All of them share some
common characteristics. All three have properties that are common to the family of Birds.
Chapter-1 Introduction Page No. 21
All of them lay eggs, hatch their young ones, are covered with feathers, have hollow bone
structures, and have the ability to fly. Thus, we may say that the peacock, the sparrow and
the kingfisher all share structural and behavioral similarities and belong to the class
called Birds.
From the above example, we may define a class as 'a set of objects that share structure
and have a comma behavior'. We started by saying that the world around us is full of
objects. Making a conscious attempt to identify and classify the objects around you can
be fun. And (this is important from the point of view of software development), it can be
equally exciting to identify objects and classes in a given situation or situations. When we
are watching a play in a theater, we recognize the fact that there is a group of actors on
the stage and each actor is playing his or her own part. Similarly, in a given situation, we
can identify a group of objects that play a part. One difference here is that objects would
include both animate and inanimate objects. Thus, on the stage you would identify not
just Professor Henry Higgins, Col. Pickering and Eliza Doolittle but also identify things
like armchairs, the fireplace, and the portrait on the wall.
Object-Oriented Analysis and Design (OOAD)
Imagine an aircraft factory in which a new jetliner is being built, Picture several
competent engineers and workers with specialized tools, constructing a marvel of
technology. Can you visualize them working on pure intuition—grabbing the tools and
settling down to work immediately? Or, do you see them working according to an
elaborate design on which they have spent hours - pouring over each detail, working and
re-working the design, and finally constructing the aircraft based on the design?
For the sake of the millions of people who fly every day let us hope that the latter is true.
After all, it is comforting to know that a lot of thought has gone into first making a model
on paper and then translating that into the physical jetliner. The same holds true for
almost any item that is constructed. Fashion designer; for instance, put pen to paper
before attacking the fabric with scissors. Architects spend hours drawing up blueprints
before laying the bricks. So, why should the construction of software be any different?
According to a report published in Japan,
Chapter-1 Introduction Page No. 22
"The software industry still relies mainly on the informal paper-and-pencil approach in
the upstream development phases."
It is this 'paper-and-pencil' approach that is termed analysis and design. When we analyze
and design a system, we build a model of the system. The purpose of this model is to help
us understand the reality that we are trying to create. This model is simpler than the
system that is finally constructed. Not all the practical I aspects of building a system for
the real world can be reflected in the design. However, this does not undermine the
importance of design.
We need to distinguish between the stages of analysis and design. The analysis phase
considers the system as a solution to a problem in its environment or domain. Broadly
speaking, analysis is the stage in which the users and developers of the system arrive at a
common understanding of the system. After all, a software professional cannot be
expected to know the intricacies involved in air traffic scheduling. Similarly, airport
personnel are not expected to know the syntax of programming languages. In order to
build software for air traffic scheduling, both the software professionals and the airport
personnel must speak the same language in terms of the problem domain.
The work of software professionals in the design stage is comparable to the work of an
architect or a fashion designer. The designer generates a blueprint of the system that is to
be implemented. In this stage, the developers of the system document their understanding
of the system. (Analysis and design are described in more detail later in this session.)
Just as in the procedural approach, several experts propounded their theories of the
methodology for analysis and design; similarly, several methodologies for object-oriented
analysis and design (OOAD) have emerged. Each methodology prescribes the use of
certain tools for analysis and design. These tools differ across methodologies. Some
methodologies for OOAD that have gained prominence are those described by James
Odell and James Martin, Grady Booch, Yourdon and Coad, and Jacobson and Berard.
The identification of classes and attributes is no small task. When working on a real life
project, this step could take several weeks. As you proceed with OOD, you will realize
that you may need to take another look at the list of classes that you have identified, and
Chapter-1 Introduction Page No. 23
change it accordingly. Design is an iterative phase and there is always room for
improvement.
Basic Concepts of Object Oriented Programming
It is necessary to understand some of the concepts used extensively in object-oriented
programming. These include:
� Classes and Objects
� Encapsulation and Data Hiding
� Data abstraction
� Inheritance
� Polymorphism
� Dynamic binding
� Message passing
Figure 1.15: Object Oriented Programming Features
� CLASSES And OBJECTS
Much like Superman, the object has descended into our world, ready to fight the
evils contributing to the software crisis. Things were simpler in the old days. You
knew an object when you saw one. Now, with all this newly acquired knowledge
Chapter-1 Introduction Page No. 24
of objects and classes, you probably see objects even where there are none. So,
what is the acid test? How can you be certain that something is indeed an object?
Remember the ultimate test for an object:
"An object has state, exhibits some well-defined behavior, and has a unique
identity."
- Grady Booch
Consider a pay phone where you put in a coin and then dial the number that you
want to call. The pay phone exhibits a certain kind of behavior, that is, when you
drop a coin in and dial a number, it connects you to the person you want to talk to
at the other end of the line.
The order in which the operations are carried out is important. The pay phone
behaves in this manner because of the existence of a state. One state of the pay
phone is that of the coin inserted by the caller but not used, that is, when the
number has not yet been dialed.
The state and behavior together comprise the properties of an object. For example,
one property of the object pay phone could be the amount of money or the
number of coins to be inserted.
Grady Booch has defined a property as:
"An inherent or distinct characteristic, trait, quality or feature that contributes to
making an object uniquely that object."
Objects do not exist in isolation. They interact with other objects and react to
these interactions. These interactions take place through messages. Grady Booch
has defined behavior as:
Chapter-1 Introduction Page No. 25
“Behavior is how an object acts and reacts, in terms of its state changes and
message passing."
That explains the first part of the definition of an object—"An object has a state,
exhibits some well-defined behavior..." Now, let us examine the next part of the
definition - "and has a unique identity."
The identity of an object distinguishes it from all other objects. In the case of the
pay phone described here, its identity would be the serial number assigned to it by
the manufacturer.
Two objects may have the same behavior, may or may not have the same state but
will never have the same identity. The identity of an object never changes in its
lifetime. Several people have described techniques for identifying classes
According to one of these techniques, you first write the English description of
the problem. Then, you underline the nouns. The nouns represent candidate
classes.
Consider a small example that illustrates this. The statement in English about a
department store is as follows:
There are several counters, each manned by a single salesperson selling a specific
product. A customer approaches any counter, depending on the product he or she
wishes to purchase. The salesperson hands her or him a product and accepts
payment.
Let us apply the suggested technique to identify classes.
There are several counters, each one manned by a single salesperson selling a
specific product. A customer approaches any counter, depending on the product
he or she wishes to purchase. The salesperson hands her or him a product and
accepts payment.
Chapter-1 Introduction Page No. 26
So, the classes that have been identified are:
• Counter
• Salesperson
• Product
• Customer
• Payment
Note that some nouns occur more than once in the statement, but are listed only
once. Similarly, watch out for synonyms and do not include them in your list. You
have probably noticed that this technique of underlining nouns is not foolproof.
All nouns do not necessarily translate into classes.
Classes and objects are closely linked. You cannot consider one without the other.
While an object has a unique identity, a class is an abstraction of the common
properties of many objects.
Now that we have described what a class is, consider the following question:
"What is not a class?"
An object is not a class. A property of an object is not a class. Objects that do not
share a common structure or common behavior cannot be clubbed together in a
class.
If you have done the mammoth task of identifying classes and objects, let us
address the next important issue: what do you do with them? In the object-
oriented technique, classes and objects certainly do not end up in cold storage.
They are the basis of the object-oriented approach for system development.
In the object-oriented approach, besides identifying objects and classes, the
developer also has to define the structure of the class. This structure determines
Chapter-1 Introduction Page No. 27
how the set of objects provides the behavior needed to satisfy the requirements of
the problem domain.
Figure 1.16: Differences between Class and Object [23]
� Encapsulation and Data Hiding
The wrapping up of data and functions into a single unit (called class) is known as
encapsulation. Data encapsulation is the most striking feature of a class. The data
is not accessible to the outside world, and only those functions which are wrapped
in the class can access it. These functions provide the interface between the
object's data and the program. This insulation of the data from direct access by the
program is called data hiding or information hiding.
To fully appreciate the OOP paradigm, we must view the overall coding process
as an exercise in shared and distributed responsibilities. These chapters have used
the terms client to mean a user of a class and manufacturer to mean the provider
of the class.
A client of a class expects an approximation to an abstraction. A stack, to be
useful, has to be of reasonable size. A complex number must be of reasonable
precision. A deck of cards must be shuffle-able, with random outcome in dealing
Chapter-1 Introduction Page No. 28
hands. The internals of how these behaviors are computed is not a direct concern
of the client. The client is concerned with cost, effectiveness, and ease of
operation, not with implementation. This is the black box principle, and it has
two components.
Black Box for the Client
• Simple to use, easy to understand, and familiar
• In a component relationship within the system
• Cheap, efficient, and powerful
Black Box for the Manufacturer
• Easy to reuse and modify; difficult to misuse and reproduce
• Profitable to produce with a large client base
• Cheap, efficient, and powerful
The manufacturer competes for clients by implementing an ADT product that is
reasonably priced and efficient. It is in the manufacturer’s interest to hide details
of an implementation. This simplifies what the manufacturer needs to explain to
the client, and it frees the manufacturer to allow internal repairs or improvements
that do not affect the client’s use. It restrains the client from dangerous or
inadvertent tampering with the product.
A data-hiding scheme that restricts access of implementation detail to
manufacturers guarantees client conformance to the ADT abstraction. The
private parts are hidden from client code, and the public parts are available. It is
possible to change the hidden representation without changing the public access
or functionality. If done properly, client code need not change when the hidden
representation is modified. The two keys to fulfilling these conditions are
inheritance and polymorphism.
Chapter-1 Introduction Page No. 29
Figure 1.17: Data Encapsulation in OOP’s [24]
� Data Abstraction
Abstraction refers to the act of representing essential features without including
the background details or explanations. Classes use the concept of abstraction and
are defined as a list of abstract attributes such as size, weight and cost, and
functions to operate on these attributes. They encapsulate all the essential
properties of the objects that are to be created. The attributes are sometimes called
data members because they hold information. The functions that operate on these
data are sometimes called methods or member functions. Since the classes use the
concept of data abstraction, they are known as Abstract Data Types (ADT).
Figure 1.18: Data Abstraction Model [25]
Chapter-1 Introduction Page No. 30
� Inheritance and Reuse
Inheritance enables a derived class to reuse the functionality and interface of its
base class. The advantages of reuse are enormous: faster development time, easier
maintenance, and simpler extensibility. The designer of class hierarchies captures
the generalizations and commonality that exist among related classes. The more
general operations are located in classes that appear higher in the derivation
graph. Often, the design considerations are application-specific.
Inheritance is the process by which objects of one class acquire the properties of
objects of another class. It supports the concept of hierarchical classification.
Figure 1.19: Inheritance Model [26]
Note that each sub-class defines only those features that are unique to it. Without
the use of classification, each class would have to explicitly include all of its
features.
� Polymorphism
Polymorphism is another important OOP concept. Polymorphism, a Greek term,
means the ability to take more than one form. An operation may exhibit different
behaviors in different instances. The behavior depends upon the types of data
used in the operation.
Chapter-1 Introduction Page No. 31
For example, consider the operation of addition. For two numbers, the operation
will generate a sum. If the operands are strings, then the operation would produce
a third string by concatenation. The process of making an operator to exhibit
different behaviors in different instances is known as operator overloading.
Figure 1.20 illustrates that a single function name can be used to handle different
number and different types of arguments. This is something similar to a particular
word having several different meanings depending on the context. Using a single
function name to perform different types of tasks is known as function
overloading.
Figure 1.20: Polymorphism and Dynamic Method Lookup in OOP’s [27]
Polymorphism plays an important role in allowing objects having different
internal structures to share the same external interface. This means that a general
class of operations may be accessed in the same manner even though specific
actions associated with each operation may differ. Polymorphism is extensively
used in implementing inheritance.
Chapter-1 Introduction Page No. 32
� Dynamic Binding
Binding refers to the linking of a procedure call to the code to be executed in
response to the call. Dynamic binding (also known as late binding) means that the
code associated with a given procedure call is not known until the time of the call
at run-time. It is associated with polymorphism and inheritance. A function call
associated with a polymorphic reference depends on the dynamic type of that
reference.
Consider the procedure "draw" in Fig. 1.20 By inheritance; every object will have
this procedure. Its algorithm is, however, unique to each object and so the draw
procedure will be redefined in each class that defines the object. At run-time, the
code matching the object under current reference will be called.
� Message Passing
An object-oriented program consists of a set of objects that communicate with each other.
The process of programming in an object-oriented language, therefore, involves the following basic steps:
1. Creating classes that define objects and their behavior,
2. Creating objects from class definitions, and
3. Establishing communication among objects.
Objects communicate with one another by sending and receiving information
much the same way as people pass messages to one another. The concept of
message passing makes it easier to talk about building systems that directly model
or simulate their real-world counterparts.
A message for an object is a request for execution of a procedure, and therefore
will invoke a function (procedure) in the receiving object that generates the
desired result. Message passing involves specifying the name of the object, the
name of the function (message) and the information to be sent. - Example:
Chapter-1 Introduction Page No. 33
Figure 1.21: Message Passing In OOP’s [28]
Advantages of Object-Orientation
Why do we opt for the object-oriented approach? The principal reasons are:
� Realistic Modeling.
� Reusability.
� Resilience to change.
Realistic Modeling
Since we live in a world of objects, it logically follows that the object-oriented approach
models the real world more accurately than the conventional, procedural approach.
Reusability
In the software industry, as in other industries, a large portion of time and energy is being
spent in recreating the proverbial wheel. In the object-oriented approach, you build
classes, which can then be used by several applications. The benefit of reusability
translates to a saving in time and effort, which in turn results in cost benefits.
Chapter-1 Introduction Page No. 34
Resilience to change
Through the object-oriented approach, systems can be allowed to evolve. When a change
is suggested, the old system need not be completely abandoned and rebuilt from scratch.
Consider the example of Joy toys, a company that manufactures toys for children in the
age group of 1 to 12. The payroll system of this company has been developed using
object-oriented techniques. The company has several employees, some of whom work in
the Design department. These designers develop new toys every season. For the past
couple of years, the company has had no cause for complaint about the payroll system.
In order to keep up with the competition, the company realized the need to employ more
designers. Design work is done only in certain months of the year. Therefore, the
company has recently employed freelance product designers who work in the capacity of
temporary employees. The original payroll system was designed for employees of two
kinds confirmed employees and trainees. Though there are many attributes that are
common to confirmed employees and trainees, like the name and the address, some
attributes are different. For example, a confirmed employee receives basic pay while a
trainee receives a stipend. The company now wants the payroll system to be modified to
accommodate freelancers as well. In the object-oriented system, this change does not
mean that the entire payroll system needs to be revamped. A new subclass called
Freelancer needs to be introduced (refer to figure) to take care of all the activities related
to freelancers. The rest of the system remains unchanged.
Resilience to change results in ease of maintenance, for the same reason, even during
construction, parts of the system under development can be refined without any major
change to other parts.
Figure 1.22: Resilience to change
Employee Employee
Confirmed Trainee Confirmed Trainee Freelaneer
Chapter-1 Introduction Page No. 35
Let us go through this using another analogy. What do you think of when you hear the
word 'chair'? You probably imagine something made of wood, having four legs that
support it, a seat to sit on, a backrest to allow a person to lean back, and maybe, arm rests.
Except for the arm rests, you would expect a chair to have all these attributes - you would
not expect to see a chair without a seat! This conceptual model of a chair is a class. Using
the conceptual model, you can now make a chair on your own if you were so inclined if
you did, the resulting chair would be an object. We define an object as 'an instance of a
class. Therefore the difference between a class and an object in our analogy is that a class
is the chair you imagined, and an object is the chair you made.
How would inheritance apply? Assume that after having made a chair, you want a chair
with wheels. To create a chair with wheels, you need to know what a wheelchair looks
like and what it should be capable of doing (rolling on wheels!). In other words, you need
to define a class called wheelchair. When you do this, you will find that all the attributes
and behaviors of a chair are contained in a chair with wheels. In other words, it is a 'kind
of chair. This means that it would also have attributes and behaviors of its own a unique
attribute of a wheelchair is that it has wheels, and a unique behavior is that it can roll.
How would this help in real life? You could take the chair you made earlier, add wheels
to it, and have a chair with wheels. You would not need to build the chair from scratch
and then add wheels to it. What about encapsulation and abstraction? A well-made chair
would show no evidence of the glue or nails that have been used to hold it together. All
you would see would be four legs, a seat, and a backrest. [29]
1.1.1.14. Component-Based Model (CBM)
A component is reusable software that can be easily plugged in or unplugged from an
application. It uses the basics of object-oriented programming. In a component-based
system, components interact with each other by calling methods and passing data.
So how is the component-based model different from object-oriented programming? The
component-based model is a software architecture that allows applications and systems to
be built from components supplied by different software vendors. It is a set of standards
that allows any software to communicate with other software regardless of the hardware,
Chapter-1 Introduction Page No. 36
the operating system and the programming language used for development. It ensures
that there is a standard method of interaction between the components. All objects need
to follow these standards when providing functionality.
The model is a specification, which defines how components can communicate with each
other. Component objects can be implemented in a number of programming languages.
[29]
Figure 1.23: Component-Based Model [30]
As shown in figure 1.23, media components are encapsulating in this model at lowest
level. This level contains images, text, video, sound, small web component and structured
text. As HTML pages may be controlled media components by inheritance with them.
The second level of this model is Content Unit Component. This level has component
that can have image with textual explanation and image with audio explanation. The
main feature of this level is reusability of component.
The last level of this model supports the introduction or overview of related chapter. This
level have documents component which is used for E-learning Course like defining
chapters and their overview, introduction, fact and example. This level is also expressed
on the hyperlink view that allowed XPointer, Xlink and XPath.[30]
Chapter-1 Introduction Page No. 37
Component Based Engineering (CBE) is common to all engineering concern. The
accurate system design techniques require CBE. [31]
1.1.2 Inheritance
Inheritance is the concept of reusability of source code. It is the main feature of OOP. It
is the method to create sub class or derived class or child class from super class or parent
class or base class. The sub class can have all the property and method of super class. It is
shown in figure 1.24.
Figure 1.24: Demonstration of Inheritance [26]
In figure 1.24, the direction of the arrow is opposite of your expectation. It would be label
as inheritance when it is pointed down. The direction of arrow from the sub class to the
super class is the common method. It can be though as “derived from” arrow.
The concept of reusing code relies save money, time and reliability of the program.
Inheritance is tool of distributing class libraries among different classes. It is the basic
need of OOP. [26]
Chapter-1 Introduction Page No. 38
1.1.2.1 Inheritance and Accessibility
As far as C++ is concern, there are three access specifies, which are named public, protected and private. The table 1.1 shows following aspects:
� There is no need to count scope of public, because the public member is allowed to access by any method at anywhere.
� On the other side, the protected data or member could be accessed by member functions of their own class and member function of derived class.
� The private data member’s scope is only inside its own class and could not be accessed from member function of other class. The scope of access specifies are shown in figure 1.25.
Access Specifies
Accessible from Own Class
Accessible from Derived Class
Accessible from
Objects Outside Class
public Yes Yes Yes
protected Yes Yes No
private Yes No No
Table 1.1: Inheritance and Accessibility
Figure 1.25: Access Specifies with inheritance [26]
Chapter-1 Introduction Page No. 39
1.1.2.2 Types of Inheritance
The inheritance can support following types of inheritance
� Single Inheritance
It supports that only one super class or base class or parent class can inherit into
one sub class or derived class or child class. It has one to one communication.
Single inheritance shown in figure 1.26
Figure 1.26: Single Inheritance
� Multi Level Inheritance
In this inheritance, a first class inherits into second class and the second class
inherits into third class. It has more than one level of single inheritance so it called
multilevel inheritance. It is shown in figure 1.27.
First Class
Second Class
Third Class
A
B
C
Figure 1.27: Multilevel Inheritance
Chapter-1 Introduction Page No. 40
� Multiple Inheritance
In this inheritance, more than one super class can be inherited into a sub class.
It is demonstrated in figure 1.28.
First C lass Seco nd Class
Third Class
A B
C
Figure 1.28: Multiple Inheritances
� Hierarchical Inheritance
In hierarchical Inheritance a single super class inherits into different sub classes.
It is shown in figure 1.29.
First Class
First Class Second Class Third Class
A
B C D
Figure 1.29: Hierarchical inheritance
� Hybrid inheritance
The Mixture of more than one type of inheritance is called Hybrid inheritance.
One can be single inheritance and second can be multiple inheritances. It is shown
in figure 1.30. [31]
Chapter-1 Introduction Page No. 41
Figure 1.30: Hybrid Inheritance
1.1.2.3 Window Form Inheritance in GUI
Window form inheritance is the great feature of window programming.
� Window Based Application
Before Window there was only “Command Line Interface” (CLI) that was based
on a text processing. At a time one line could be read in CLI. It is so difficult to
handle by the user. To overcome this problem, Microsoft Windows and
Macintosh operating systems was introduced during late 1980s, which was
windows-based operating system. Microsoft is concern, the windows is a 16-bit
graphical layer for MS-DOS. This provides GUI for the user.
The advantages of Windows-Based operating system and Window-base
program:
� Single or Multiple applications can be run.
� Verifying input and output resources of CPU.
� Supporting multiple colors with graphics.
Chapter-1 Introduction Page No. 42
� Windows Programming
Windows programming concerns with windows environment (IDE), which is
based on windows operating system (GUI). It provides window, button and events
(keyboard click, mouse click) to solve the problem. There are three aspects that
belonging to window programming, first is Window Application Programming
Interface (API), second is Microsoft Fundamental Classes (MFC) and third one is
window form.
Figure 1.31: illustrations the interaction of programs and the operating system [33]
� Features of Window-Based Programming
� Windows Form, frame, applet, message and dialog boxes are containers
for representing different problems. It supports menu layout for design UI.
� Event Driven Programming is the main feature of windows-based
program. EDP is based on responding to user on clicking a button and
moving mouse on objects and pressing key events to realize tasks.
� There are so many objects or components or tools to develop the UI
including label, push button, combo boxes, image boxes, picture boxes
and list boxes for demonstrating data or information.
Chapter-1 Introduction Page No. 43
� Some of components as common dialog control, files, timer, printer etc.
are controlled by the system software (OS) and provide common resources
for program.
� Operational stability is the main aspect of window applications:
� Menu bar sequences at the top of window.
� Events of components are comparable, like pressing, moving, double-
clicking, clicking, dropping and dragging.
� Saving information and managing out resource (printer) by sharing
interfaces.
� Windows-Based Programming Tools
Windows-Based Programming Tools are followings:
Example: VB (Visual Basic), VC++, BC++, UNIX C & C++ tools, java, Delphi
and Power Builder etc. Windows-based programming tools are ease of
development v/s program execution efficiency. It could be used to develop
programs easier than others (e.g. Visual Basic). The web based application can be
built using VBScript and JavaScript. But it has strong peculiarities, the tools are
built to defend web based program.[33]
Figure 1.32: Elements of a window [34]
Chapter-1 Introduction Page No. 44
� Form Inheritance
We have been understood that the inheritance is main feature of OOP. Inheritance
considers extending object’s properties and methods one to another, inheritance
saves the timing of developer and reduce the line of source code of related
program. Visual Basic.Net provides the facility to inherit window form and
classes. The window form inheritance is great feature of VB.net. Windows form
inheritance can be understood by following example. For instance, I want to place
the logo of Government Engineering College Bikaner at the top-left corner of
each window form of my UI and other component in the top-right corner of each
window form.
� In VB6.0 or earlier version of it, the window form could be built by
creating a template from it, or I can write source code that puts the logo
and component on each form. This process takes little bit time and it is so
tedious work. The form inheritance can also be done showing one window
form into another form.
� In VB.Net, I need to build the window form once; this form can be
inherited into application with their code and interface. If any case, the
changes are made into the master window form, all those changes will be
reflected into project or application. Windows forms are the easiest
implementation of form inheritance. The process in VB.Net is simple
rather than VB6.0.
1.1.3 Polymorphism
The polymorphism is a Greek word, which can be split into two words.
Polymorphism=poly + morphs
� Poly means more than one.
� Morphs means forms.
Chapter-1 Introduction Page No. 45
It means the set of instruction can be called multiple times. The polymorphism is the
main feature of OOP. If OOP does not have this feature then OOP is incomplete. There
are two types of polymorphism which shown in figure 1.33. [35]
Figure 1.33: Polymorphism Hierarchy
1.1.3.1. Compile Time Polymorphism
Compile Time Polymorphism is categorized into two aspects function or method
overloading and operator overloading. Compile Time Polymorphism can be termed as
static binding or early binding.
� Function Overloading or Method Overloading
The multiple functions, which have same name, same return type and different
arguments or parameter in a program is called function overloading. It will be
determine at compile time, which function will be called. The function
overloading or method overloading is shown figure 1.34.
Static Binding Dynamic Binding
Chapter-1 Introduction Page No. 46
Figure 1.34: Functions Overloading or Method Overloading [36]
� Operator Overloading
Operator overloading is the coolest feature of OOP. If the programmer has great
knowledge of method overloading and operator overloading then he can develop
their own language. Operator means, the special symbol that produce result after
process on related operands. Using this method we can assign extra feature to an
operator, which have never been of related operator. According the number of
operator which are going to operating by related operator, there are three types of
operator in OOP.
� Unary operator:- it works on only one operands.
Example: ++,--,-
� Binary Operator:- it works on two operands.
Example: +,-,*,/,%,>,<,>=,<=,==,!= etc.
� Ternary Operator: - it works on three operands.
Example: Scope resolution operator (::)
Some of operators are overload able and some of them not overload able.
There are so many languages, which are based on OOP. Some Object Oriented
Programming languages do not support operator overloading, which are listed in
table 1.2.
Chapter-1 Introduction Page No. 47
Table 1.2: List of Languages over-loadable and not over-loadable [37]
1.1.3.2. Run Time Polymorphism
Run Time Polymorphism is the concept of calling related code on run time. Run Time
Polymorphism can be termed as dynamic binding or late binding. The common example
of run time polymorphism is function overloading or method overloading. The
implementation of run time polymorphism into related language is several in several
languages. Let’s try to understand run time polymorphism with different languages
Chapter-1 Introduction Page No. 48
� In C++, sub class can be pointed from the instance or object of super class
at run time. It can be possible to achieve run time polymorphism using
pointer object of base class or super class. Run time polymorphism is
supported by virtual keyword. It can be termed as dynamic binding or late
binding. The redefinition of the function or method from super class to sub
class is calling function overriding or method overriding. In this method,
the function in super class should be defines as a virtual function. The
virtual function of the super class is abstracted to override into sub class.
The pointer of super class can point the instance or object of sub class.
This can access function or method, which are belong to super and sub
class. The sub class function can be invoked by super class pointer object
or instance being the method as virtual method. Figures 1.35 demonstrates
how to support rum time polymorphism. In this figure, the super class is
names as Base which has two virtual function named show and display.
The sub class is name as Derived which overrides virtual function show
and display. The void main has the pointer of Base class named as bptr
that points object or instance of Derived class. After than call the function
show and display using pointer object or instance of Base class via (->)
operator. Which function going to be calling, it will determine at run time
by the compiler. In this process the function of Base class will be called.
Because the both classes have same named function, which have same
return type, name and parameter. This is also called function or method
overriding. It is differ from function overloading or method overloading
with respect of parameter or arguments of function. [38]
Chapter-1 Introduction Page No. 49
Figure 1.35: How to support run time polymorphism
� In Java, run time polymorphism can be achieved using abstract keyword.
For example, we have a base class with different method, which is going
to extend into derived class. If the methods of base class is abstract
method that will be abstracted to override into derived class. The static
methods cannot be overridden. Java has some API named interface, which
is used to implement the user interface. Interface is not able to extents into
sub class. It can only be implemented into sub class. Interface has
instruction to declaration of related methods. All the methods, which
Chapter-1 Introduction Page No. 50
belong to a particular interface, are abstract methods by default. Method
overriding shown in figure 1.36 in java.
Figure 1.36: Method Overriding in Java [39]
The static methods or static variables, which are respectively called class
methods or class variable that can be accessed using class’s name. There is
no need to instantiate of class to access static methods of static variables.
[39]
� In VB6, the run time polymorphism can be implemented using runtime
files or visual basic run DLL group (runtime library). After finding out the
run time error, you should run the program then a error message will be
shown which have message prompt ‘required .DLL’ not found. The run
time errors have a lot of regions being occurred and display a message
DLL file cannot be found named as msvbm60.bll. As far as different
versions are concern VB have six versions, which have their own runtime
library. There are different service pack in VB, the latest SP6 lunched
2004. Till date SP1 to SP6 has been released, which have oleaut32.dll,
olepro32.dll and msvbm60.dll. It is required to download and after run
that. It is automatically copied into related place.[40]
Chapter-1 Introduction Page No. 51
Figure 1.37: Run Time Errors in VB [41]
1.1.4. Array
The group of related data, which are sequentially or adjacently arranged is called array.
Or
The group of same kind of data is called array.
Or
The concept of colonization of variable is called array.
Or
The systematic arrangement of entity or objects or instance is called array. [42]
1.1.4.1. Array Data Structure (ADS)
The array is a form of data structure, which has a collection of variables or data or
elements. Each element identified by key or index. The stored values is computed
according their index.[43][44][45] figure 1.38 shows that how to managed array data
structure in memory.
Figure 1.38: Array Data Structure [46]
Chapter-1 Introduction Page No. 52
1.1.4.2. Array Data Type
In which array which values will be stored, it will be determined by their data types. So
an array type can be pronounced as a data type. It describes a collection or group of
variables or values or elements. In a program all the values of an array identifies by their
index or key at run time. The collection is also called array, array value or array variable.
[47] How the base type (Integer array variable) and reference type (customer array
variable) differ from each other shows in figure 1.39.
Figure 1.39: Array Data Type [48]
1.1.4.3. Associative Array (AA)
The associative array can be referred as associative map or dictionary. It is an abstract
data type, which is collection of value or key pairs. The unique key determines the
position of value in collection. This data type allows the addition, removal, modification
of pairs and lookup values associated with related key. [49][50] How are the keys
associated with values? It is shown in figure 1.40.
Chapter-1 Introduction Page No. 53
Figure 1.40: Associative Array [51]
1.1.4.4. Bit Array (BA)
The bit array is a form of data structure. It is also called as bit vector, bit-set or bitmap.
The bit array stores bits in very compact form. It is used to implement bit level
parallelism in hardware. Basically it stores kw bits, where w stands for the no. of bits in
the particular unit of storage and k stands for nonnegative integer. [52] Figure 1.41 shows
that the Bit Array contains the actual array of bits and the methods to set and reset
individual bits. The Bit Array Cursor (BAcursor) is a transient itterator used to scan a Bit
Array. A single Bit Array can have multiple associated BAcursors.
Figure 1.41: Bit Array Representation [53]
Chapter-1 Introduction Page No. 54
1.1.4.5. Dynamic Array (DA)
Due to some peculiarity of dynamic array, it is also named as array list, growable array,
dynamic table, mutable array or resizable array. The elements can be added or removed
in dynamic array. Dynamically Allocated Array (DAA) and Dynamic Array (DA) are not
same. DAA’s size is fixed during the memory allocation of array; Whereas DA may be
fixed size. [54] Figure 1.42 simply represent that how the dynamic array allocation at run
time.
Figure 1.42: Dynamic Array [55]
1.1.4.6. Parallel Array (PA)
The parallel array is example of two dimension array. PA represents array of records. PA
consist same type of array for each column, which have same no. of elements. It also can
be called matrix or relation or table, which means group of row and column. Each
column has type of record. PA is so simple to understand. It is used to declare column
with record. [56] Parallel array demonstration shown in figure 1.43 that two single
dimension parallel arrays each holding five elements one of integer data types and one of
character data types.
Chapter-1 Introduction Page No. 55
Figure 1.43: Parallel Arrays [57]
1.1.4.7 Sparse Array (SA)
The Sparse Array is different from other arrays. Most of the elements of a matrix have
same type values in that case it is called sparse array that values known as default value.
Usually default value does 0 or null. As far as computation and storage is concern sparse
array is inefficient in case of large size array. There are two types of sparse array; first
concern with one dimension array shown in figure 1.44 and second belongs with two
dimension array shown in figure 1.45.[58]
Chapter-1 Introduction Page No. 56
Figure 1.44: Sparse One Dimension Array [58]
Figure 1.45: Sparse Two Dimension Array [59]
1.1.4.8. Variable Length Array (VLA)
Variable Length Array is allocated during late binding instead of early binding. As far as
programming language is concern, there are some of them, which support VLA named as
Algol 60, Ada, APL etc. and some of them don’t support for the same named as C#,
COBOL etc.[60] Figure 1.46 shows how to Variable Length Array is managed in
memory during late binding.
Chapter-1 Introduction Page No. 57
Figure 1.46: Variable Length Array [61]
1.1.4.9. Jagged Array (JA)
Jagged Array is also known as life Vector. Instead of one dimensional array and two
dimensional array, the Jagged Arrays are n-dimensional array where n is greater than
two. In JA each row has various length whereas two dimensional arrays are rectangular
means all the rows have same length (column). Infect JA is arrays of arrays. Let’s try to
understand for the same. For example, we declare a jagged array named JA.
int [ ][ ] JA=new int[3][ ];
JA[0]=new int[3];
JA[1]=new int[5];
JA[2]=new int[2];
At the time of declaration in C# need two sets of square bracket, first bracket determine
rows of jagged array and second bracket determine column of each row.[62] Figure 1.47
shows the logical structure of jagged array. First row has three columns, second row has
five columns and third row has two columns.
Figure 1.47: Jagged Array [62]
Chapter-1 Introduction Page No. 58
1.1.4.10. Array Processor (AP)
Array Processor means a central processing unit. AP is also known as a vector processor
that execute group of instruction which operate on 1D array’s data can be called vectors.
It is used to improve performance of numerical simulation, workloads and other tasks.
AP introduced on 1970 and considered in super computer design. In video game console
hardware are controlled by this technology. AP executes a single instruction in multiple
data (SIMD) in the same clock cycle. It is also support Multiple Instruction Multiple Data
(MIMD). [63] Figure 1.48 demonstrates how to process a Single Instruction issued using
array processor ALU1, ALU2, ALU3 and ALU4.
Figure 1.48: Array Processor [64]
1.1.4.11. Array Programming
The main purpose of array programming is that the task execute only one time to an
entire set of values. It is high level model. It provides the freedom to programmer to
realize and operate on data. [65] Figure 1.49 shows the reserved space of the array before
initializing and storing values after initialization.
Chapter-1 Introduction Page No. 59
Figure 1.49: Array Programming [66]
1.1.4.12. Array Slicing (AS)
The process of extracting particular elements from an array to another array with distinct
index ranges and dimensions is called array slicing. The process of extracting substring
from a string (e.g. “ven” from “deven’) and a column of a matrix, that is called vector.
The range for substring may be determined at late binding. It may be explicitly
mentioned on early binding. It is also help to matrix transpose. There is no effect on the
real array due to array slicing. The new or latest array has elements being copied from
real array. [67] Figure 1.50 shows different slices of two dimension arrays with distinct
block with different colors.
Chapter-1 Introduction Page No. 60
Figure 1.50: Array slicing in 2D array [68]
1.1.4.13. Global Array (GA)
Global Array (GA) considers as a library, which is innovated by scientists at Pacific
Northwest National Laboratory (PNNL) for parallel computing. Some API provided by
global array for shared memory programming and distributed memory programming for
M-Dimensional array. The global array API provides global address space (GAS)
programming languages, which is developed to realize or achieve high performance
computing. [69]
1.1.4.14. Control Array (CA)
The array of control or component or tool or object is called control array, which share
same name and event procedure. The CA will have minimum resources at design time.
To construct a control array, we should assign the same type (textbox, label, button,
option button etc.) and name with different index property of each component. The value
of index property of control must be non negative. Each control of a control array can
have different property such as color, font size, visibility etc.
Chapter-1 Introduction Page No. 61
� Control Array in VB
The time of the form designing, it can be created. The CA can be created using
following methods:
� First method
� Drag a control or component from toolbox to drop on the form and
set the index property with non-negative numeric value. After the
process control array will be created with one element.
� Second Method
� Design your form with two same controls (textbox or label) and
assign same name for both of them. There will be warning dialog
box displayed, which have message prompt (“this name has been
already assigned for other control”) and asks would you like to
create a CA. then click on yes command button among them.
� Third Method
� After designing your UI select any control or component and copy
using CTRL+C or edit->copy then paste using CTRL+V or
edit->paste. There will be warning dialog box displayed, which
have message prompt (“this name has been already assigned for
other control”) and asks would you like to create a CA. then click
on yes command button among them. The controls will have same
name with different index.
CAs greatest feature of Visual basic IDE, which provide a lot of flexibility for
programmer to their programs:
• All the controls which belong to a CA will have same event procedure. It is
method to reducing the code for a developing an application.
• During late binding we can add new control to a CA. it means CA can be created
at run time which not available at design time.
Chapter-1 Introduction Page No. 62
• CA’s elements contain limited resources than a simple component. VB provides
256 different control’s name. CA can overcome this limitation for the same.
• Dynamic creation of CA is most important feature of VB. It has been helpful to
increase capability of application.
• As far as dimension of an array is concern; the CA can only be one dimensional.
So it has no need to have dimension. It is expandable means after adding any
control for further requirement to control array, the control array will be
automatically extended. The position can be traversed of related element or
control of control array using their index property’s value. The index of first
element of control array is 0.
Figure 1.51: Control Array of Textbox at design time
� Sharing Event Procedures
All the elements of CA shares event procedure at standard module. The
event procedure of element can be recognized easily being having extra parameter
named index. The parameter index gets the value of element’s index that called
the event procedure. This is shown in this example:
Chapter-1 Introduction Page No. 63
All the elements of CA share the same event procedure at standard module. Each
element (Textbox) can have individual back color or fore color. For example, one
textbox get yellow back color at time being got focus and after lost focus that can
have white color.
� Dynamic Control Array (DCA)
Dynamic Control Array (DCA) loads at run time. For example, design a form to
create a control array on a particular event. It requires control data type to create
dynamic control and set the property to add control. The method to create
dynamic control array shown in following example:
Chapter-1 Introduction Page No. 64
� Iterating and Creating Control Array
Iteration means single statement is executed repetitively. It can be done using
looping structure. The looping can be used for creating and iterating control array.
There are some looping structures are available like for….next, while…..wend, do
while…..loop.
For example:
Chapter-1 Introduction Page No. 65
1.1.5. Sorting Algorithm
Sorting is the process that arranges data according to a required order (Ascending or
Descending). For example, if we have a list of students, that can be sorted by student’s
name, by roll no., by age. We have different sorting algorithms named bubble sort,
selection sort, insertion sort, merge sort, heap sort, quick sort and shell sort. Sorting is the
main technique in computer science. The large number of data can be arranged by
required order quickly.
The data processing belongs to sorting algorithms. Some complex sorting algorithm may
create complicacy which can be more than their worth for small list of data. But it may be
vice versa in case of large collection of data. The running time of data sorting depends
upon sorting technique. If we want to use a sorting algorithm then first of all we should
think that the larger value (or smaller) must be compare with other value. This process
should be systematic to compare value. Secondly, if during the comparison come to
found not suitable position for value then both values should be exchanged. Although it is
an expensive method but it is required to evaluate the efficiency of the sorting algorithm.
In this section, I have evaluate three sorting algorithm (bubble sort, selection sort,
insertion sort) among all of them.
� Bubble Sort (BS)
The bubble sort algorithm is simple technique, which requires more than one
passes via a list. The entire sorting algorithm works with array. In this technique,
a value compares to adjacent value and swaps the value, if it is out of order. The
data places at proper place in the list during each passing. The data “bubbles” up
towards their proper place.
Figure 1.52 shows the logical structure of BS’s first pass. The grayed elements
seem compared if they are out of bound. If the list has n-values then n-1 pairs of
value is required to be compared on the first pass. In this figure, it is clearly
shown that once the largest value (part of a pair) found in list, that value will
continuously be moved their proper place until completion of pass.
Chapter-1 Introduction Page No. 66
Figure 1.52: First Pass of Bubble Sort [70]
After completing the first pass, the second pass starts while the largest value is
placed their proper place. The second pass is being started; the n-1 items are left
to sort. So the n-2 pairs remains to compare. After completing each pass the next
largest value will be placed on their proper place. The n-1 passes are required.
During the passes, the smallest value will be placed their correct place. After for
the same, there is no need to pass. Figure 1.53 shows a function to bubble sort,
which named as bubble Sort. There is a reference array used as parameter in this
function that contains list of item. This parameter gets the list of items during
calling the function and makes modification into list of items by comparison with
each other. [70]
Chapter-1 Introduction Page No. 67
Figure 1.53: Bubble Sort Algorithms [71]
During each pass, the exchange operation between two values (“swapping”)
occurs, if it is necessary. The process of swapping between two values needs
temporary variable to store related value. If we don’t use temporary variable then
one value will be overwritten. It can be understand such as
Figure 1.54: Swapping During Bubble Sort
The table 1.3 shows the list of passes with their comparisons. It demonstrate that
first pass will compare n-1 pairs, second pass compare n-2, third pass compare n-3
and n-1 pass compare 1 value.
Chapter-1 Introduction Page No. 68
Table 1.3: The Comparison with Each Pass in Bubble Sort [70]
� Selection Sort (SS)
This sorting algorithm is an important sorting technique. Selection Sort is
improved technique over bubble sort technique. During each pass through list, it
makes only one exchange. In this technique, the largest value is to be selected to
place on their correct location during each pass. In bubble sort technique, the
largest value places on their correct position and after second pass are to order
next largest value on proper place. To sort n items require n-1 passes. The last
largest value must be placed their correct position after completing n-1 pass.
Chapter-1 Introduction Page No. 69
Figure 1.55: Selection Sort Algorithm with different passes [70]
The selection sort process shows in figure 1.55. This figure clearly shows that a
largest value places their correct position during each pass. It demonstrate that the
first pass select largest value (93) places their correct position, the second pass
select next largest value (77) places proper place, the third pass select next largest
value (55) places proper place and so on. Figure 1.56 shows a function to
demonstrate selection sorting technique named selection sort. [70]
Chapter-1 Introduction Page No. 70
Figure 1.56: Selection Sort Algorithms [72]
� Insertion Sort (IS)
This sorting technique is the simplest algorithm. It works with O (n2) method, it
has sorted sub list of the list before completing sorting. Whatever we insert the
data into list that will be inserted back into sorted sub list. As far as algorithm’s
efficiency is concern; Insertion Sort technique is not so efficient for large amount
of list like merge sort, quick sort or heap sort. But insertion sorting algorithm is so
efficient for small list of items.
• It can be implemented very easily.
• In insertion sort algorithm, the user insert data into list, at that iteration
being occurred to iterates sorted sub list and find out related position for
inserted data into array.
• This process sustains till no input remain.
• Whenever we insert the data into list, it investigate that the value is larger
than sorted list or not. If it is larger then moves after the next and it is
smaller then it finds the proper place in sorted sub list.
In the Figure 1.57, it shows some part is grayed and other part is not grayed. The
grayed part is the sorted sub list of the list. Let’s try to understand the mechanism,
assume that we create a list which has only one item placed on first (0 position), it
can be understood as sorted, it means each passing through list, inserted item will
Chapter-1 Introduction Page No. 71
placed on at 1st position or shift item to 1st position from 0th position through n-1
by compare or we can say that the item insert at right side being greater then
sorted list and vice versa.
Figure 1.57: Insertion Sort Algorithms [70]
The demonstration of the vth pass of insertion sort algorithm is shown in figure
1.58. In this figure, we can easily understand the sorting process. The top of figure
represent sorted sub list containing 17, 26, 54, 77 and 93. If we insert 31 data into
list than the value will compare with 93, 77, 54, which will be shifted to right side
of sorted sub list against given value 31. After completion of the process, we will
have six items as sorted sub list.
Chapter-1 Introduction Page No. 72
Figure 1.58: Fifth Pass of Insertion Sort Algorithms [70]
The Figure 1.59 shows the Algorithm of insertion sort using function named as
insertion_sort. It demonstrates that how insertions sort can be implemented
programmatically. [70]
Figure 1.59: Insert Sort Algorithm [73]
Chapter-1 Introduction Page No. 73
1.2. Statement of Problem
Object Oriented Programming language is strong language in current vogue.
There are several features of OOP’s like object, class, data abstraction/Encapsulation,
polymorphism, inheritance and message passing.
There are also available different types of languages according to their interfaces
like Graphical User Interface (GUI) and Character User Interface (CUI).
Figure 1.60: Types of Languages
All GUI based languages are itself Integrated Development Environment (IDE)
means which have different windows to develop an interactive and efficient interface or
application like form window, code window, project explorer, toolbox, property window,
object browser, immediate window, form layout window, locals window, watch window
etc. during the development of application we require different object or control or
component like label, textbox, button, checkbox, scrollbar etc. all the components have
their properties. As far as my research is concern; I will use window based programming
language. The language name is concern, it is visual basic.
Visual basic is the strong object based IDE. It supports to develop any kind of
User Interface. Some time we require copy of control (object or component) during the
development of an interface. But in visual basic, if we trying to do for the same, then a
control array of related object will be created. This will have same name with different
index. Due to creating control array, it is so complicated to handle with code. Generally
Chapter-1 Introduction Page No. 74
the control array is used to develop a calculator or comparisons of different sorting
algorithm etc. other then it is not used. In fact, there is limited use of control array. Not
only, we know about the program of calculator but also there has been developed a user
interface (UI) using control array, which UI is capable to compare different sorting
algorithm and show result for the same.
After studied previous section in this chapter, I concluded that Object Oriented
Programming language is correct option to research and the features of OOP’s are
ultimate concept like polymorphism, inheritance etc. I should adopt an object based
programming language like visual basic. VB provide graphical user interface, no dough it
will take comparatively less time to develop UI and less line of code to program. In
Visual Basic, I just noted that the control array, which has their limitation, can be my
research topic.
As per data structure is concern; there are different sorting algorithms, which are
described just before of this section. The different sorting algorithms have different
methods to sort the list of data. The sorting is little bit difficult to understand by someone
and make understand to someone. The sorting is directly belonging to array.
As far as statement of problem is concern; the control array can play great role to
develop a user interface (UI), which can overcome the problem to understand different
sorting algorithm being some optimization and polymorphism, inheritance can be helpful
to increase their efficiency and effectiveness of UI. As per research is concern, an UI can
be developed, which should have different panel to demonstration to process of sorting
and their algorithm. In this UI, the first panel should have list of data in textbox (control
or object or component or tool), the second panel should demonstrate related sorting
algorithm with array of label (control or object or component or tool) and third panel
should have buttons that control the sorting process in first panel, provides tracing view
of sorting algorithm with their speed, this panel should also have control like scroll bar.
Different sorting algorithm form (child form) must be controlled at a single form (MDI
form) as per requirement of user. The all the problem can be solved using control array,
inheritance and polymorphism in Visual Basic.
Chapter-1 Introduction Page No. 75
1.3. Key Objectives of the thesis
We all know that an interactive User Interface (UI) have been required by user since
beginning to solve their problem. Due to this requirement all the productive entities are
busy to develop for the same. The efficient and effective UI can produce good result with
taking minimum time. So a good UI can solve great deal of problem in simple manner.
As far as academics are concern; the different sorting methods in data structure are main
issue for the student to understand. It has been hectic for the student to understand
different sorting algorithm.
The main objective of this is to develop a User Interface (UI), which will demonstrate
different sorting process, tracing sorting algorithm with controlling their speed being
some optimization into development.
There are different types of sorting methods to order data in proper manner. In this thesis,
I have targeted three sorting method to involve in UI named as bubble sort, insertion sort
and selection sort. The UI will help to understand these sorting processes and their
algorithms for respondents. The respondent can be among trainer, students, and
professionals. To develop the UI, I require a programming language to design my
purposed UI. The language visual basic will help me for the same, which have GUI based
control or object, or component or tool. As I mentioned earlier that array of control is
called control array. The control array can be created with different method, which is
mentioned earlier. The control array will play main roll to design my user interface.
Because the sorting is directly related to array then it will be basic need for the same. If I
want to design a great UI then I require other features of object oriented programming
language like polymorphism and inheritance.
So, the key objective of my thesis is to design a UI, which will be definitely helpful for
the respondent to understand sorting method, who deals with sorting data. It will also be
boon for the student, who will not need any trainer or teacher to understand sorting
algorithms that belongs to their academics. It will also be great technique to deal with
Chapter-1 Introduction Page No. 76
students for professionals. The key objective of thesis is demonstrated in figure 1.61.,
which will clearly show the purposed model of UI.
Figure 1.61: Purposed Model of User Interface
Parent Form or
MasterLayout Tracing View of Sorting Algorithm
Co
ntro
l pa
ne
l
So
rtin
g P
roce
ss
Speed Controller
Chapter-1 Introduction Page No. 77
1.4. Background
All the applications that were developed being simplify the problem of user can be
consider as the background of my research. There are a lot of examples to describe for
the same that are following.
• A bank implements software (UI) to simplify the working method for employee.
This UI is able to handle all the banking related work like account management,
loan particular etc.
• The railway uses other UI to customer for related journey like reservation,
cancellation etc.
• Air ways use software that are based on simulation and the software controls air
traffic.
• A hotel implements an UI to manage their activity properly such as check in or
check out or salary management of employee etc.
• The defense authority of the country works with approved UI that helps to defend
concern country from another country.
• In the medical field, a UI has been play great role to determine disease of patient
like ultra sound, brain scan etc.
• A lot of show rooms have software to handle purchasing, selling statement, stock
management etc.
• Social web sites are used to interconnect with whole world. It has also been the
media of entertainment for users.
• The programmer generally adopts that kind of language to develop software that
supports GUI.
There are a lot of UI, which are used in academics to solve the related problem with
animation or GUI. Overall, it seems that an interactive UI has been basic requirement of
Chapter-1 Introduction Page No. 78
whole world since beginning. The background of my research is all the UI that simplify
the problem.
1.5. Motivation to This Research
I have seen a lot user interface in the form of system software, application software and
utility software. I feel that the system software is basic need for computer system. It is
able to control all the peripheral, which are attached with computer system. The
application software are developed to solve a particular problem like word processing,
graph making, database management, presentation making, photo editing, account
management etc.
Basically, I was motivated due to utility application. There are a lot of utility applications
such as media players, type writer, video games, calculator, other application that are
used in academics etc. There are following region being motivated.
• An UI that is developed by Randy Birch. This UI is developed to calculate the
taken time by different sorting such as bubble sort, selection sort, shell sort and
quick sort. The UI have different push buttons to control the process. To sort the
data, he used an array containing list of dates. I was inspired to develop such type
of UI.
• I also observed about the source code of the calculator. I felt, there is control array
of button (0 to 9) and (/,+,*,-,=) that use only a single event procedure to calculate
the given number.
Both aspects have been main region behind my research. The first aspect motivated about
the appearance of UI and the second is motivated that how it can be developed using
control array.
Chapter-1 Introduction Page No. 79
1.6. Outline of Entire Thesis
This thesis divided into eight chapters. The first chapter is an introductory part of the
research study. This chapter gives us the transparent introduction to the research work
followed by the purpose of the research, contribution and overview of the entire thesis.
The next second chapter explores the review of the literature and theories associated
with interface, OOP, inheritance, polymorphism, array, control array, sorting algorithm
and implementation. The third chapter is describing material and methods with research
methodology containing the process of data collections and presentation. The fourth
chapter represents the observation, results and discussion from research work done. In
the fifth chapter conclusion and important finding are given with in order to accomplish
an analysis. The sixth chapter represents the recommendations of the thesis approach
and new purposed scenario with empirical findings. In seventh chapter bibliography is
given which is used in this research study. At the end of this thesis, eighth chapter is
given which describe our published paper related to this research in national and
international conferences and journals.
Chapter-1 Introduction Page No. 80
1.7. Contribution of This Research
The contribution of my research work will be as a tool for students, trainer or any
respondent who want to learn different sorting process and understating their algorithm
such as bubble sort, selection sort and insertion sort. The sorting of data is main part of
data structure, which is in the curriculum of students of different stream. It is also
challenging for trainer or teacher to make understand the algorithm to the student. The
implementation of my research as an UI will be helpful for the same. Academically, this
UI will play great role to simplify the sorting process and tracing related algorithm. This
UI will also provide tracing speed controller that will help to control the speed of the
sorting process and tracing algorithm. So the respondent can learn according their ability.
If he is comfort with default speed, it will do. Otherwise he can decrease or increase
process speed according to their requirement. This UI provide a demonstration that will
have ten different values to be sorted. Otherwise the respondent can say to no. of data to
be sorted. But the respondent cannot assign more than fifteen elements. I am very sure
that my research may be appreciable.