SlideShare uma empresa Scribd logo
1 de 23
ITERATO
R
BEHAVIORAL DESIGN
PATTERN
DESIGNED BY SAHIL,SUBHAM,HRISHIKESH
team
Design
pattern
types
Iterator
story
proble
m
n
team
Subhamsekhar
Panda
BSc Computer Science
Ramniranjan Jhunjhunwala
College
Hrishikesh
Parkar
BSc Computer Science
Vidyalankar College
Sahil
Panchbhaiya
BSc Physics
Thakur College of
Science
38 39
Design
pattern
types
Iterator
story
proble
m
4
0
Design
pattern
• Design patterns are typical solutions to common problems in
software design. Each pattern is like a blueprint that you can
customize to solve a particular design problem in your code.
• A design pattern isn't a finished design that can be
transformed directly into code. It is a description or template
for how to solve a problem that
can be used in many different situations.
• You need to implement or modify it according to your need
for the problem.
Design patterns differ by their complexity, level of detail
and scale of applicability. In addition, they can be
categorized by their intent and divided into three groups.
types
Iterator
story
m
types
Iterator
story
proble
m
n
Structura
l
Behaviora
l
Creation
al
• Abstract
Factory
• Builder
• Factory
Method
• Prototype
• Singleton
Design
Patterns
• Adapter
• Composite
• Decorator
• Flyweight
• Proxy
Iterator
• Command
• Interpreter
• Iterator
• Mediator
• Memento
• Observer
Iterator
story
problem
solution What is ITERATOR PATTERN
?  Iterator is a behavioral design pattern that lets you traverse elements of a
collection without exposing its underlying representation (list, stack, tree,
etc.).
 Sequentially access elements of collection.
 Provide a way to access the elements of an aggregate object sequentially
without exposing its underlying representation.
 The C++ and Java standard library abstraction that makes it possible to
decouple collection classes and algorithms.
 Promote to "full object status" the traversal of a collection.
 Polymorphic traversal.
Iterator
problem
Collections are one of the most used data types in programming.
What about complex data structure such as trees?
The main idea of the Iterator pattern is to extract the traversal behavior of a collection into a
separate object called an iterator. In addition to implementing the algorithm itself, an iterator object
encapsulates all of the traversal details,
solution
MP3 MUSIC
PLAYER
NOIFICATION
ALERT
SOME REAL LIFE EXAMPLES :
STRUCTURE:
The Iterator interface
declares the operations
required for traversing a
collection:
Concrete Iterators
implement specific
algorithms for traversing
a collection. The iterator
object should track the
traversal progress on its
own. This allows several
iterators to traverse the
same collection
independently of each
other.
The Collection
interface declares
one or multiple
methods for getting
iterators compatible
with the collection.
Concrete
Collections return
new instances of a
particular concrete
iterator class each
time the client
requests one.
CODE IMPLEMENTATION:
Code
OUTPUT:
Pros
and
cons
 Single Responsibility Principle.
You can clean up the client code
and the collections by extracting
bulky traversal algorithms into
separate classes.
 Open/Closed Principle. You can
implement new types of
collections and iterators and pass
them to existing code without
breaking anything.
 You can iterate over the same
collection in parallel because
each iterator object contains its
own iteration state.
Applying the pattern can be an
overkill if your app only works
with simple collections.
Using an iterator may be less
efficient than going through
elements of some specialized
collections directly.

Mais conteúdo relacionado

Semelhante a apna ppt 2.pptx

P Training Presentation
P Training PresentationP Training Presentation
P Training Presentation
Gaurav Tyagi
 
7 latest-dot-net-interview-questions
7  latest-dot-net-interview-questions7  latest-dot-net-interview-questions
7 latest-dot-net-interview-questions
sadiqkhanpathan
 

Semelhante a apna ppt 2.pptx (20)

Module 2 design patterns-2
Module 2   design patterns-2Module 2   design patterns-2
Module 2 design patterns-2
 
Design Pattern Notes: Nagpur University
Design Pattern Notes: Nagpur UniversityDesign Pattern Notes: Nagpur University
Design Pattern Notes: Nagpur University
 
Design Patterns - General Introduction
Design Patterns - General IntroductionDesign Patterns - General Introduction
Design Patterns - General Introduction
 
UNIT IV DESIGN PATTERNS.pptx
UNIT IV DESIGN PATTERNS.pptxUNIT IV DESIGN PATTERNS.pptx
UNIT IV DESIGN PATTERNS.pptx
 
Introduction To Design Patterns
Introduction To Design PatternsIntroduction To Design Patterns
Introduction To Design Patterns
 
Design patterns
Design patternsDesign patterns
Design patterns
 
Design Pattern lecture 2
Design Pattern lecture 2Design Pattern lecture 2
Design Pattern lecture 2
 
OOM Unit I - III.pdf
OOM Unit I - III.pdfOOM Unit I - III.pdf
OOM Unit I - III.pdf
 
Behavioral pattern By:-Priyanka Pradhan
Behavioral pattern By:-Priyanka PradhanBehavioral pattern By:-Priyanka Pradhan
Behavioral pattern By:-Priyanka Pradhan
 
Design patterns
Design patternsDesign patterns
Design patterns
 
Java Design Patterns Tutorial | Edureka
Java Design Patterns Tutorial | EdurekaJava Design Patterns Tutorial | Edureka
Java Design Patterns Tutorial | Edureka
 
P Training Presentation
P Training PresentationP Training Presentation
P Training Presentation
 
dotnet stuff.com tutorials-design-patterns_exploring-net-design-patterns-in-s...
dotnet stuff.com tutorials-design-patterns_exploring-net-design-patterns-in-s...dotnet stuff.com tutorials-design-patterns_exploring-net-design-patterns-in-s...
dotnet stuff.com tutorials-design-patterns_exploring-net-design-patterns-in-s...
 
Design Patterns
Design PatternsDesign Patterns
Design Patterns
 
Gof design patterns
Gof design patternsGof design patterns
Gof design patterns
 
Design Patterns
Design PatternsDesign Patterns
Design Patterns
 
Design Patterns Presentation - Chetan Gole
Design Patterns Presentation -  Chetan GoleDesign Patterns Presentation -  Chetan Gole
Design Patterns Presentation - Chetan Gole
 
Design patterns
Design patternsDesign patterns
Design patterns
 
7 latest-dot-net-interview-questions
7  latest-dot-net-interview-questions7  latest-dot-net-interview-questions
7 latest-dot-net-interview-questions
 
Patterns
PatternsPatterns
Patterns
 

Último

Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
VictoriaMetrics
 
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
chiefasafspells
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
Health
 
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
masabamasaba
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
masabamasaba
 

Último (20)

%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
 
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
 
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
 
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
 
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go Platformless
 
What Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the SituationWhat Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the Situation
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 

apna ppt 2.pptx

  • 1. ITERATO R BEHAVIORAL DESIGN PATTERN DESIGNED BY SAHIL,SUBHAM,HRISHIKESH team Design pattern types Iterator story proble m n
  • 2. team Subhamsekhar Panda BSc Computer Science Ramniranjan Jhunjhunwala College Hrishikesh Parkar BSc Computer Science Vidyalankar College Sahil Panchbhaiya BSc Physics Thakur College of Science 38 39 Design pattern types Iterator story proble m 4 0
  • 3. Design pattern • Design patterns are typical solutions to common problems in software design. Each pattern is like a blueprint that you can customize to solve a particular design problem in your code. • A design pattern isn't a finished design that can be transformed directly into code. It is a description or template for how to solve a problem that can be used in many different situations. • You need to implement or modify it according to your need for the problem. Design patterns differ by their complexity, level of detail and scale of applicability. In addition, they can be categorized by their intent and divided into three groups. types Iterator story m
  • 4. types Iterator story proble m n Structura l Behaviora l Creation al • Abstract Factory • Builder • Factory Method • Prototype • Singleton Design Patterns • Adapter • Composite • Decorator • Flyweight • Proxy Iterator • Command • Interpreter • Iterator • Mediator • Memento • Observer
  • 5. Iterator story problem solution What is ITERATOR PATTERN ?  Iterator is a behavioral design pattern that lets you traverse elements of a collection without exposing its underlying representation (list, stack, tree, etc.).  Sequentially access elements of collection.  Provide a way to access the elements of an aggregate object sequentially without exposing its underlying representation.  The C++ and Java standard library abstraction that makes it possible to decouple collection classes and algorithms.  Promote to "full object status" the traversal of a collection.  Polymorphic traversal.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17. problem Collections are one of the most used data types in programming. What about complex data structure such as trees?
  • 18. The main idea of the Iterator pattern is to extract the traversal behavior of a collection into a separate object called an iterator. In addition to implementing the algorithm itself, an iterator object encapsulates all of the traversal details, solution
  • 20. STRUCTURE: The Iterator interface declares the operations required for traversing a collection: Concrete Iterators implement specific algorithms for traversing a collection. The iterator object should track the traversal progress on its own. This allows several iterators to traverse the same collection independently of each other. The Collection interface declares one or multiple methods for getting iterators compatible with the collection. Concrete Collections return new instances of a particular concrete iterator class each time the client requests one.
  • 23. Pros and cons  Single Responsibility Principle. You can clean up the client code and the collections by extracting bulky traversal algorithms into separate classes.  Open/Closed Principle. You can implement new types of collections and iterators and pass them to existing code without breaking anything.  You can iterate over the same collection in parallel because each iterator object contains its own iteration state. Applying the pattern can be an overkill if your app only works with simple collections. Using an iterator may be less efficient than going through elements of some specialized collections directly.