roadmap
Download
Skip this Video
Download Presentation
Roadmap

Loading in 2 Seconds...

play fullscreen
1 / 9

Roadmap - PowerPoint PPT Presentation


  • 103 Views
  • Uploaded on

Roadmap. Generics Abstract Factory Annotations Model-Driven Engineering. Design Patterns, a preview…. “Each pattern describes a problem which occurs over and over again in our environment; and it describes the core of the solution to that problem, in such a way that

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about ' Roadmap' - karsen


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
roadmap
P2 — Clients and ServersRoadmap
  • Generics
  • Abstract Factory
  • Annotations
  • Model-Driven Engineering
design patterns a preview
P2 — Clients and ServersDesign Patterns, a preview…

“Each pattern describes a problem which occurs over

and over again in our environment; and it describes the

core of the solution to that problem, in such a way that

you can use this solution a million times over…”

— Christopher Alexander

creational patterns
P2 — Clients and ServersCreational Patterns

… deal with the best way to create objects

abstract factory pattern
P2 — Clients and ServersAbstract Factory Pattern
  • A Factory is the location in the code at which objects are created.
  • Provides an interface for creating families of related dependent objects.
  • Let clients create products in any family of products in an abstract way, without having to specify their concrete class.
  • Separates the details of implementation of a set of objects from its general usage.
structure of the abstract factory pattern

ConcreteFactory1

createProduct()

ConcreteFactory2

createProduct()

P2 — Clients and Servers

Structure of the Abstract Factory Pattern

AbstractFactory

createProduct()

Client

AbstractProduct

concreteProduct

abstract factory with generics ludo example
P2 — Clients and ServersAbstract Factory with Generics: Ludo Example

package ludo;

// NOTE interface for "Abstract Factory" pattern.

public interface Factory<T> {

public T createInstance();

}

the concrete factory
P2 — Clients and ServersThe Concrete Factory

package ludo;

public class LudoFactory implements Factory<Ludo> {

public Ludo createInstance() {

initializeHome();

initializeBranchings();

initializeMainRing(quarterLength);

initializeHomeRuns(quarterLength);

initializeNests();

return new Ludo(nest);

}

We specify the

type to be Ludo

the ludo example

«interface»

AbstractFactory

createInstance() : T

«interface»

Board

addPlayer(Player )

LudoFactory

createInstance() : Ludo

Ludo

P2 — Clients and Servers

The Ludo Example
the client drives the ludo game
P2 — Clients and ServersThe Client drives the Ludo Game

The Driver can drive any Board game

public class Driver implements Runnable {

private Board board;

public Driver(Factory<? extends Board> factory) {

this.board = factory.createInstance();

board.addPlayer(new Player());

board.addPlayer(new Player());

board.addPlayer(new Player());

}

We specify the Game Factory we want

public class Main {

public static void main(String[] args) {

Runnable gameDriver = new Driver(new LudoFactory());

gameDriver.run();

}

ad