O slideshow foi denunciado.
Seu SlideShare está sendo baixado. ×

apna ppt 2.pptx

Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Próximos SlideShares
Design Patterns
Design Patterns
Carregando em…3
×

Confira estes a seguir

1 de 23 Anúncio

Mais Conteúdo rRelacionado

Semelhante a apna ppt 2.pptx (20)

Mais recentes (20)

Anúncio

apna ppt 2.pptx

  1. 1. ITERATO R BEHAVIORAL DESIGN PATTERN DESIGNED BY SAHIL,SUBHAM,HRISHIKESH team Design pattern types Iterator story proble m n
  2. 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. 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. 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. 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.
  6. 6. Iterator
  7. 7. problem Collections are one of the most used data types in programming. What about complex data structure such as trees?
  8. 8. 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
  9. 9. MP3 MUSIC PLAYER NOIFICATION ALERT SOME REAL LIFE EXAMPLES :
  10. 10. 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.
  11. 11. CODE IMPLEMENTATION: Code
  12. 12. OUTPUT:
  13. 13. 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.

×