GoConqr has a new look! Let us know what you think.

Flashcards

CS

James Drover Computer Science English 27 cards

Cards in this deck (27)

  1. 1Defines the skeleton of an algorithm, deferring some steps to subclasses. It lets subclasses redefine certain steps of an algorithm without changing the algorithms structureTemplate Method
  2. 2Ensures a class has only 1 global instance, and provides a global access point to itSingleton
  3. 3Defines an interface for creating an object, but defers instantiation to the subclasses, letting them decide which class to instantiateFactory Method
  4. 4Attaches additional responsibilities to an object dynamically. It provides a flexible alternative to sub-classing for extended functionalityDecorator
  5. 5Defines a family of algorithms, encapsulates each one, and makes the interchangeable. It lets the algorithm vary independently from the users.Strategy
  6. 6Allows clients to manipulate individual objects and groups of objects uniformlyComposite
  7. 7Encapsulates operations as an object, thereby supporting parameterize clients with different operations. It also supports "undo" functionality.Command
  8. 8Provides a uniformed interface to a set of interfaces in a subsystem. It defines a higher-level interface that makes the subsystem easier to useFacade
  9. 9Provides a way to access the elements of an aggregate object sequentially without exposing its underlying representation.Iterator
  10. 10Defines a one-to-many dependency between objects so that when one object changes state, all its dependents are notified and updates automatically.Observer
  11. 11State a circumstance in which you would prefer an abstract class to an interface.A Template pattern. Where the sub classes use many of the methods in the abstract class but a few are different.
  12. 12In java's interface why does the update method include a reference to the object being observed?Observer can be observing multiple objects update notifies all the dependents of the object
  13. 13Why is it desirable to "program to an interface not an implementation"?This implies that variables should not be declared to be variables of particular concrete classes. Instead, objects should be manipulated solely in terms of interfaces they support, so Clients remain unaware of the specific types of objects they use. Clients remain unaware of the classes that implement these objects. It is desirable to “factor out”operations that are common to a set of classes.These should be declared in a separate interface, which the classes implement.
  14. 14When studying the Adapter pattern, the example we looked at was technically an "Object Adapter Pattern" in java". why don't we use the "class adapter pattern" in javaBecause you need multiple inheritance's to implement a "class adapter pattern", which is not possible in java.
  15. 15Tony Hoare said, "______________ arises from a recognition of similarities between certain objects, situation, or processes in the real world, and the decision to concentrate upon those similarities and to ignore for the time being the differences."Abstraction
  16. 16What is a "macro" and which pattern is ideal for implementing macros?A macro is a Sequence of commands that are "mapped" in this care to a method or class and is used in command patterns.
  17. 17What are the 5 SOLID principalsS - single responsibility principal
    O - open closed principal
    L - Liskove substation principal
    I - Interface segregation principal
    D - Dependency Inversion Principle
  18. 18S - single responsibility principalA class should have one and only one reason to change, meaning that a class should have only one job
  19. 19O - open closed principalObjects or entities should be open for extension, but closed for modification
  20. 20L - Liskove substation principalLet q(x) be a property provable about objects of x of type T. Then q(y) should be provable for objects y of type S where S is a subtype of T.
  21. 21I - Interface segregation principalA client should never be forced to implement an interface that it doesn't use or clients shouldn't be forced to depend on methods they do not use.
  22. 22D - Dependency Inversion PrincipleEntities must depend on abstractions not on concretions. It states that the high level module must not depend on the low level module, but they should depend on abstractions.
  23. 23List three design categoriesBehavioral patterns
    Creational Patterns
    Structural Patterns
  24. 24Behavioral patternsex template method, command
  25. 25Creational Patternssingleton
    factory method
  26. 26Structural Patternsdecorator
    compozsite
    facade
    adapter
  27. 27—

Information

Description
Computer Science Flashcards on CS, created by James Drover on 12/06/2017.
Created by
James Drover
Views
0
Rating

Feedback

What is it about?

What do you think of the new look?

How do you like it?