Skip to content

Latest commit

 

History

History
61 lines (46 loc) · 2.74 KB

PatternIndex.md

File metadata and controls

61 lines (46 loc) · 2.74 KB

Patterns Index

Creational Patterns

  • Factory Method
  • Builder
  • Abstract Factory

Factory Method

Factory method pattern is usually applied in combination with Template method pattern:

Abstract Factory

Abstract Factory pattern examples:

Builder

Builder pattern has been implemented with different participant classes

  • Builder: ChessBuilder class declares the interface.
  • Concrete Builders
    • ASCIIOutput, the result is retried with method xXX
    • FENCoder, the result is retried with method XX
    • ChessBuilderParts
    • ChessBuilderBoard
    • ChessBuilderGame
  • Director: Board.constructBoardRepresentation() is the director method

Structural Patterns

  • Facade
  • Proxy

Facade pattern is implemented by GameImp class.

Proxy pattern is implemented by ChessPositionReader as access control interface to underlying implementation classes. Game and ChessPosition implements this interface, Game forwards all requests to ChessPosition class for actual implementation. MoveGenaratorWithCacheProxy implements a cache proxy. Another example is MoveGeneratorWithCacheProxy.

Behavioral Patterns

  • Template method
  • Command
  • Strategy
  • Visitor
  • Iterator

Template method

Template method pattern is applied in different situations by abstract classes: AbstractPawnMoveGenerator

By convention, those classes with template methods are abstract classes and named with the prefix Abstract.

Command

Command pattern in combination with Visitor pattern can be found at chess.moves package.

Interfaces Move/MoveKing/MoveCastling define DO and UNDO operations.

Classes in package net.chesstango.board.moves.imp implement these interfaces.

Strategy

Strategy pattern is implemented at net.chesstango.board.movesgenerators.pseudo.strategies package. MoveGenerator interface declares the interface, all the classes in this package implements the interface (with the exception of PeonPasanteMoveGenerator).

Iterators

Iterators can be found at net.chesstango.board.iterators package.