building logistics modeling implementation

Upload: diana-alvarez-marin

Post on 03-Apr-2018

219 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/29/2019 Building Logistics Modeling Implementation

    1/28

    current state

    Overcoming the limitations of Processing

    Building Logistics modeling

    Nikola Marincic

  • 7/29/2019 Building Logistics Modeling Implementation

    2/28

    / ITA Institute of Technology in Architecture / Faculty of Architecture / ETH Zurich / Chair for CAAD / N. Marincic / Name / 17.04.2012. / 2

    3000+ lines each package 2000+ 1000+ 500+ reusable code

  • 7/29/2019 Building Logistics Modeling Implementation

    3/28

    / ITA Institute of Technology in Architecture / Faculty of Architecture / ETH Zurich / Chair for CAAD / N. Marincic / Name / 17.04.2012. /

    Abstraction modeling

    3

    classes:

    MainApp (PApplet)

    Field

    FieldsControl

    Family

    GUI

    CameraState

    LocalConstants

    SQLConnection

    Edge

    Style

    ...

  • 7/29/2019 Building Logistics Modeling Implementation

    4/28

    / ITA Institute of Technology in Architecture / Faculty of Architecture / ETH Zurich / Chair for CAAD / N. Marincic / Name / 17.04.2012. /

    MainApp

    4

    PApplet

    extends

    setup

    {

    initializeSetup

    loadFonts

    initializeCamera

    initializeDrag&Drop

    }

    draw

    {

    cameraCalculations

    cameraActions

    drawGrid

    drawAllFields

    }

  • 7/29/2019 Building Logistics Modeling Implementation

    5/28/ ITA Institute of Technology in Architecture / Faculty of Architecture / ETH Zurich / Chair for CAAD / N. Marincic / Name / 17.04.2012. /

    MainApp

    5

    PApplet

    extends

    setup

    {

    initializeSetup

    loadFonts

    initializeCamera

    initializeDrag&Drop

    }

    draw{

    cameraCalculations

    cameraActions

    drawGrid

    drawAllFields

    }

    everything is adjusted to fit

    in the mechanics of setupand draw

  • 7/29/2019 Building Logistics Modeling Implementation

    6/28/ ITA Institute of Technology in Architecture / Faculty of Architecture / ETH Zurich / Chair for CAAD / N. Marincic / Name / 17.04.2012. / 6

    draw{

    cameraCalculations

    cameraActions

    drawGrid

    drawAllFields}

    whole program logics is

    dependent on draw loop ofprocessing, which is one thread

    program flow paradigm and

    animation paradigm are tied int

    one.

    Stability of the whole system o

    the stability of processing clas

    which is in principle overloade

    animation thread.

    frameRate(30)

  • 7/29/2019 Building Logistics Modeling Implementation

    7/28/ ITA Institute of Technology in Architecture / Faculty of Architecture / ETH Zurich / Chair for CAAD / N. Marincic / Name / 17.04.2012. /

    Field

    7

    Family

    extends

    familyID

    level

    classID

    dims

    children

    fieldID

    parentID

    parent

    world

    originOffset

    (static) maxLevel

    points (rendering)

  • 7/29/2019 Building Logistics Modeling Implementation

    8/28

    / ITA Institute of Technology in Architecture / Faculty of Architecture / ETH Zurich / Chair for CAAD / N. Marincic / Name / 17.04.2012. /

    FieldsControl

    8

    initializeFlag

    constructFlag

    >

    initializeIt

    constructIt

    createNewFields

    clearFields

    createField

    getNearestParent

  • 7/29/2019 Building Logistics Modeling Implementation

    9/28

    / ITA Institute of Technology in Architecture / Faculty of Architecture / ETH Zurich / Chair for CAAD / N. Marincic / Name / 17.04.2012. /

    FieldsControl-old

    9

    constructIt

    {

    determineParents

    determineChildren

    sortChildren

    sortFields

    determineFamilyID

    }

  • 7/29/2019 Building Logistics Modeling Implementation

    10/28

    / ITA Institute of Technology in Architecture / Faculty of Architecture / ETH Zurich / Chair for CAAD / N. Marincic / Name / 17.04.2012. /

    NON-CONSISTENT DESIGN

    10

    problems:

    Adding new windows (view on data)

    Adding independent parallel hierarchies of fields

    Inability to grow with new features in a consistent way

  • 7/29/2019 Building Logistics Modeling Implementation

    11/28

    / ITA Institute of Technology in Architecture / Faculty of Architecture / ETH Zurich / Chair for CAAD / N. Marincic / Name / 17.04.2012. /

    How to make it better?

    11

    reading, research, experiments on design:

    Clever OOP design:Holub on Patterns - Allen Holub

    Design Patterns:

    Head First Patterns - ORileyGang of Four - Design Patterns - Elements of reusable Object-Oriented

    Software

  • 7/29/2019 Building Logistics Modeling Implementation

    12/28

    / ITA Institute of Technology in Architecture / Faculty of Architecture / ETH Zurich / Chair for CAAD / N. Marincic / Name / 17.04.2012. / 12

    Design Overhaul

    Identify abstractions of what is going on,identify actors and their interaction.

    Program to abstraction (Java Interfaces,

    abstract classes) - define a contract what

    should actors be and what are their generalresponsibilities.

    Concrete implementation should stick to this

    contract, and if it does, it is replaceable with

    any other implementation during Runtime

  • 7/29/2019 Building Logistics Modeling Implementation

    13/28

    / ITA Institute of Technology in Architecture / Faculty of Architecture / ETH Zurich / Chair for CAAD / N. Marincic / Name / 17.04.2012. / 13

    Design Overhaul

    What is the abstraction of the concreteimplementation?

    WHAT (not how) is it doing from a larger

    perspective?

  • 7/29/2019 Building Logistics Modeling Implementation

    14/28

    / ITA Institute of Technology in Architecture / Faculty of Architecture / ETH Zurich / Chair for CAAD / N. Marincic / Name / 17.04.2012. / 14

    Design Overhaul

    from procedures

    to abstractions

    define Actors:

    Characters

    Responsibilities

    Collaborators

  • 7/29/2019 Building Logistics Modeling Implementation

    15/28

    / ITA Institute of Technology in Architecture / Faculty of Architecture / ETH Zurich / Chair for CAAD / N. Marincic / Name / 17.04.2012. / 15

    Design Overhaul

    actors should not longerpass parameters (numbers, strings) to each

    other > but other objects - data abstractions.

    not asking an object to return something

    which is needed to do the work, but askingobject to do work itself.

  • 7/29/2019 Building Logistics Modeling Implementation

    16/28

    / ITA Institute of Technology in Architecture / Faculty of Architecture / ETH Zurich / Chair for CAAD / N. Marincic / Name / 17.04.2012. / 16

    Design Overhaul

    Favor composition over inheritance.

    from IS-A-relationship to HAS-A-relationship

  • 7/29/2019 Building Logistics Modeling Implementation

    17/28

    / ITA Institute of Technology in Architecture / Faculty of Architecture / ETH Zurich / Chair for CAAD / N. Marincic / Name / 17.04.2012. / 17

    Design Overhaul

    new set of interfaces (contracts):

    View

    Field

    FamilyGrid

    UI

    Database ...

    instead of putting methods in draw

    instead of SQLConnection

    independent instead as extension of family

    independent object with its responsibilities

    managing layout of fields

    interacting with program

  • 7/29/2019 Building Logistics Modeling Implementation

    18/28

    / ITA Institute of Technology in Architecture / Faculty of Architecture / ETH Zurich / Chair for CAAD / N. Marincic / Name / 17.04.2012. / 18

    View interfacerendering of the data

    should be replaceable with other types of viewresizable

    independent of other views

    default implementation:

    orthogonal projection

    perspective

    wireframe rendering

    ...

    v1 v2

    v3 v4

    rotate

    pan

    zoom

    change camera type

    change rendering

  • 7/29/2019 Building Logistics Modeling Implementation

    19/28

    / ITA Institute of Technology in Architecture / Faculty of Architecture / ETH Zurich / Chair for CAAD / N. Marincic / Name / 17.04.2012. / 19

    Design Overhaul

    data model - plug it to

    > ConcreteView which implements

    View interface which is a contract or

    abstraction on what View should do

    > get a specific rendering for thisconcrete

    implementation of view interface!

  • 7/29/2019 Building Logistics Modeling Implementation

    20/28

    / ITA Institute of Technology in Architecture / Faculty of Architecture / ETH Zurich / Chair for CAAD / N. Marincic / Name / 17.04.2012. / 20

    Design Overhaul

    View window1,window2,window3

    window1 = new

    PerspectiveView(DataModel)

    window1 = new

    OrthoWireframe(DataModel)

    part of the same contract

  • 7/29/2019 Building Logistics Modeling Implementation

    21/28

    / ITA Institute of Technology in Architecture / Faculty of Architecture / ETH Zurich / Chair for CAAD / N. Marincic / Name / 17.04.2012. / 21

    Design Overhaul

    for (View v: views)

    {

    v.display();

    }it works because every type of

    view knows how to display its

    content.

    perspectiveView

    orthoView

    renderFlat

    xRay

  • 7/29/2019 Building Logistics Modeling Implementation

    22/28

    / ITA Institute of Technology in Architecture / Faculty of Architecture / ETH Zurich / Chair for CAAD / N. Marincic / Name / 17.04.2012. / 22

    Field

    extends

    Family

  • 7/29/2019 Building Logistics Modeling Implementation

    23/28

    / ITA Institute of Technology in Architecture / Faculty of Architecture / ETH Zurich / Chair for CAAD / N. Marincic / Name / 17.04.2012. / 23

    Field

    Family

    has

    extends

    Family

  • 7/29/2019 Building Logistics Modeling Implementation

    24/28

    / ITA Institute of Technology in Architecture / Faculty of Architecture / ETH Zurich / Chair for CAAD / N. Marincic / Name / 17.04.2012. / 24

    Field

    Family

    has

    extends

    Family

    Family

    a,b,c,d,e

    f,g,h,i,j ...

    Field

    Family

    a,b,c,d,e

    Family ff,g,h,i,j ...

    Field

    extends

    has

  • 7/29/2019 Building Logistics Modeling Implementation

    25/28

    / ITA Institute of Technology in Architecture / Faculty of Architecture / ETH Zurich / Chair for CAAD / N. Marincic / Name / 17.04.2012. / 25

    Field

    Family

    has

    Field

    Grid

    has

  • 7/29/2019 Building Logistics Modeling Implementation

    26/28

    / ITA Institute of Technology in Architecture / Faculty of Architecture / ETH Zurich / Chair for CAAD / N. Marincic / Name / 17.04.2012. / 26

    OrthogonalGrid implements Grid

    Grid contract defines:

    if specific implementation wants to be

    a part of a grid contract, it needs to

    DISPLAY itself (display())

    and it needs to provide

    SNAP points specific to this grid

    example:

  • 7/29/2019 Building Logistics Modeling Implementation

    27/28

    / ITA Institute of Technology in Architecture / Faculty of Architecture / ETH Zurich / Chair for CAAD / N. Marincic / Name / 17.04.2012. /

    Next Step

    27

    Model-View-Controller pattern

    MVC design pattern isolates the application logic from the

    user interface and permitted the individual development,

    testing and maintenance for each components.

    Model consists of application data and business rules,

    Controller mediates input, converting it to commands for the

    Model or View.

    A View can be any output representation of data, and multiple

    views on the same data are possible.

  • 7/29/2019 Building Logistics Modeling Implementation

    28/28

    / ITA Institute of Technology in Architecture / Faculty of Architecture / ETH Zurich / Chair for CAAD / N. Marincic / Name / 17.04.2012. /

    Model

    28

    View

    Controller

    Fields

    FamiliesManager

    DataBase ...

    data manipulation

    DisplayRendering engine

    GUI

    ...

    manipulate

    visual output

    Translating user

    inputs

    updating view

    updating model