O GoConqr está de visual novo! Conte para nós o que você achou.

Flashcards

EDC Flash Cards

Joel Pearson Inglês 19 flashcards

Flashcards do conjunto (19)

  1. 1How does the strategy pattern work? What would a good analogy be? When would be a good time to use them?A family of programs can often be the same with the exception of a few methods. The strategy pattern aims to separate the common part from the varying parts, and then put the varying parts into a separate module that can be plugged into the common part.
    ANALOGY: A video game cartridge on an old console, which only carries essential parts distinct to the video game, but not common parts (e.g. rendering code).
    GUIDELINES: Use this pattern when:
    - a number of related classes differ in one behaviour
    - you need variants on an algorithm
    - hiding key parts of data from clients
    - multiple alternative behaviours
  2. 2Describe the Abstract Factory Pattern with an analogy. When is a good time to use it?The abstract factory pattern allows a program to create objects from a family of related classes without knowing how the classes are implemented. This allows implementation to be changed easily. ANALOGY: plugs are different in different countries but which the same basic way.
    GUIDELINES: use it when
    - The system should be independent of how it's components are created
    -A system should be configured with one of multiple families of components
    - A family of related components are designed to be used together
    - You want to reveal the interface on a library (???)
  3. 3Describe the mediator pattern with an analogy. When is a good time to use it?A mediator pattern encapsulates the interaction behaviour of a set of objects. By separating the interaction from the objects themselves, the program is easier to understand, and easier to modify. ANALOGY: Australia Post - two users have very simple operations, Australia post takes care of the hard part of getting communication across.
    USE WHEN:
    - A set of objects is well defined but in a complex way
    - Reuse is difficult because of inter-object communication
    - Distributed behaviour in classes should be customisation without getting caught up in sub classes.
    - Many to many situations
  4. 4Describe the singleton pattern with an analogy. When should we use it?This pattern ensures that a class has only one instance and provides a point of access to it. ANALOGY: we only have one fire service because we don't want competition!
    USE WHEN:
    - There must be exactly one instance of a class, and it must be accessible to clients from a well-known point (e.g. 000)
  5. 5What is Liskov's Principle?Functions that use references to base classes should be able to use sub-class objects without knowing it (i.e. a sub-class should be a base-class; a duck should be an animal, but a rubber duck is not a duck).
  6. 6Outline the steps in lazy evaluation-- Starting states are the same
    -- Evaluate f(eclose(q))
    -- Final states are all states that include e-NFA final-state in it's set
  7. 7Outline the steps in greedy evaluation-- Starting states are the eclose of e-NFA starting states
    -- Evaluate eclose(f(q)) [the eclose function is greedy, it takes a lot in]
    -- Final state-set is the same as the NFA
  8. 8Express fit's law:time to click = a + b*log(1+d/r))
    WHERE:
    a = reflect time (hence addition)
    b = user speed constant (faster speed = less time)
    "1+" ensures log isn't negative
    d = distance to icon, larger distance = more time
    r = radius of icon, larger icon = less time
  9. 9What are Apple's 10 Usability Guidelines?(1) Use real-world metaphors
    (2) Direct manipulation
    (3) See and Point
    (4) Consistency
    (5) WYSIWYG
    (6) User in Control
    (7) Provide Feedback and Dialogue
    (8) Forgiveness
    (9) Impression of Stability and Familiarity
    (10) Aesthetic integrity
  10. 10Explain the 'interface' design pattern with an analogy. When is it good to use an interface?Interfaces have pre-defined method signatures but not the implementation. An analogy is the interfaces of remote controls, cd-players, and mp3 players.
    WHEN TO USE:
    -
  11. 11What is the 5-tuple notation of a petri-net?PTAWI:
    Places
    Transitions
    Arcs
    Weights
    Initialiser
  12. 12Explain the adaptor design pattern with an analogy. When should we use them?We may want to reuse code but the interfaces can mismatch. Use adaptors to communicate when at least one class can't understand the other's interfaces, and you don't have the option to change the interface.
    ANALOGY: Power plugs in different countries have adapters
  13. 13Explain the proxy design pattern with an analogy. When should we use it?A proxy receives method calls from clients on behalf of others. They don't provide services directly, but call methods on another object. ANALOGIES: bodyguards or ambassadors.
    USE WHEN:
    - The service-providing object can't provide the service now or is in another place
    - You want to hide the complexity of the service
    - You want to control / restrict access to the service
  14. 14Explain the decorator design pattern with an analogy. When should we use it?The decorator is a GUI pattern where the aim is to make small, reversible changes to certain objects. ANALOGY: Preparing same document for different readers.
    USE WHEN: you want to extend the functionality of a number of objects in a given class, but not to every instances, or when we want to dynamically extend or withdraw the capabilities of objects.
  15. 15Explain the composite design pattern with an analogy. When should we use it?The composite pattern allows us to treat groups of objects all in the same way. An analogy is power banks plugged into other power banks.
    USE WHEN:
    - You have a complex object that needs to be decomposed into a part/whole hierarchy
    - You want to minimise the complexity of a part-whole hierarchy by minimising different kinds of child objects.
  16. 16Explain the observer design pattern with an analogy. When should we use it?The observer pattern is used to pick up on changes made to a dataset that can then be communicated to all relevant areas. E.g. a listener. ANALOGY: google docs.
    Use the observer pattern when:
    - changing one object changes others but you don't know how many
    - An object should be able to modify objects without making assumptions about them.
  17. 17Explain the chain of command design pattern with an analogy. When should we use it?The 'chain of command' pattern comes from the military analogy, but is better understand by an example. If we want to click the mouse in a particular portion of the screen, the chain of command works from the base-level window through to the components until we find a components (if any) that underlies the mouse click.
    USE WHEN:
    - More than one object may handle a request, and the handler isn't known beforehand
    - You want to issue a request to one of several objects without specifying the receiver explicitly
    - The set of objects that can handle a request should be specified dynamically
  18. 18Explain the iterator pattern with an analogy. When should we use it?An iterator is a specific way for a program to access all components of a data structure without needing to know the representation of each structure. Analogy: Library book has been contaminated!!!!!!! Example: a hashset iterator in java.
    USE THIS PATTERN:
    - to access an aggregate object's contents without exposing it's internal representation
    - to support multiple traversals of aggregate objects
    - to provide a uniform interface for traversing different aggregate structures
  19. 19Explain the visitor design pattern with an analogy. When should we use it?In a document editor, for example, we may want to traverse a document in a number of different ways. Rather than building in all this functionality, just have a few 'guiding' functions in the class for different kinds of visitors. Analogy: tour-guides for different kinds of clients.
    USE WHEN:
    - There are a variety of operations to be performed on an object structure
    - The object structure is composed of objects that belong to different classes
    - The types of objects that occur in the object structure do not change often and the way they are connected is consistent and predictable.

Informações

Descrição
FlashCards sobre EDC Flash Cards, criado por Joel Pearson em 15-11-2018.
Criado por
Joel Pearson
Visualizações
1
Avaliação

Fale Conosco

Sobre o que é sua mensagem?

O que você acha do novo visual?

Você gostou?