OOP-->
object oriented programming
Data
structures-->
any
format
for
efficient
storage
and
retrieval
of
data
Design
patterns--> optimized, readymade solutions for common problems in
designing and programming logic
On
first look these three look unrelated. But there is more to it than
what meets the eyes.
So
in what way they are related?
Let’s
take
the
first
two
topics,
OOP
and
data
structures.
One
very
basic
data
structure
used
in
many
places
is
the
stack.
When
you think of stack implementation the following comes to our mind,
Class
Stack()
{
Stack_content
{
Data;
Pointer
to prev stack_content;
};
top_of_stack;
getTop();
push();
pop();
}
Here
you can see that the data and the methods associated with it are
combined together. Implementing the same without classes will lead to
messy code.
So
for data structures to be implemented neatly we need proper Object
oriented programming knowledge!!
Next
consider
the
topics
OOP
and
Design
Patterns.
Design
patterns
deal
mainly
about
how
OOP
concepts
should
be
used
properly.
It
gives
optimized
designs
and
solutions
for
common
problems
involving
classes
and
objects.
According
to me,
OOP
+
design
patterns
=>
optimized
object
oriented
program
For
example,
Introduction
of factory class, single responsibility principle, singleton class
design etc... These are examples for the relationship between OOP and
design patterns.
Data
structures
and
design
patterns
don’t
relate
directly.
They
have
the
layer
of
object
oriented
programming
in
between
them.
The diagram shows how data structures and design patterns are related via OOP.
Data structures are implemented using OOP which are in turn governed and designed by design patterns.
So
that’s it about relationship between OOP, data structure and design
patterns. See you in next blog .
Trained @ Sourcebits
Trained @ Sourcebits
No comments:
Post a Comment