nianio pattern błażej chodarcewicz warsaw, 2006-02-22

13
NIANIO Pattern Błażej Chodarcewicz Warsaw, 2006-02-22

Upload: alexandra-lockhart

Post on 26-Mar-2015

215 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: NIANIO Pattern Błażej Chodarcewicz Warsaw, 2006-02-22

NIANIO Pattern

Błażej ChodarcewiczWarsaw, 2006-02-22

Page 2: NIANIO Pattern Błażej Chodarcewicz Warsaw, 2006-02-22

Presentation Plan• Current UI problems• The Nianio introduction• Test application• Java patterns• Genrap UI future

Page 3: NIANIO Pattern Błażej Chodarcewicz Warsaw, 2006-02-22

Current prblems• Incomplete application state• A lot of state full objects• Synchronization and threads• Models, MM, listeners – loops• Un clear event flow

Page 4: NIANIO Pattern Błażej Chodarcewicz Warsaw, 2006-02-22

The NIANIO• State type

definition• Command type

definition• External command

type definition• Function – nianio

implementation – logic

Page 5: NIANIO Pattern Błażej Chodarcewicz Warsaw, 2006-02-22

Test application – Nianio in practice

Page 6: NIANIO Pattern Błażej Chodarcewicz Warsaw, 2006-02-22

Java implementation of Nianio• State - schema structure• Command - schema

variant• External command -

schema variant

• State = { … }• Cmd = variant [java

mm] { … }• ExtCmd = variant [java

mm] {…}Nianio = public State invoke(State, Cmd, ExtCmd.MM)• Function• No side efects• ExtCmd.MM accumulates commands

Page 7: NIANIO Pattern Błażej Chodarcewicz Warsaw, 2006-02-22

AppState = {reportFile, xmlFile, xsdFile, outputFile : SelectFileState = {

fileName : string? fileChooserState : FileChooserParams= {

kind : FileChooserKind = variant {open | save}extensions : array of stringdescription : string

}}outputKind : OutputKind = variant {html | pdf | xls}status : Status = variant { generatingReport of int | ready }messageDialogStates : MsgDialogs

}MsgDialogs = [java dict [key]] array of Entry = {

key : MsgDialogKey = stringvalue : MessageDialogParams = {

dialogKind : MessageDialogKind = variant {info | warning | error }

message : string}

}

Page 8: NIANIO Pattern Błażej Chodarcewicz Warsaw, 2006-02-22

AppLogicCmd = [java mm] variant {run | close| setPdfOutput | setHtmlOutput | setXlsOutput| generateRequest| reportGenerated of GenrapPluginEvent| reportFileCmd of SelectFileCmd| xmlFileCmd of SelectFileCmd| xsdFileCmd of SelectFileCmd| outputFileCmd of SelectFileCmd| messageDialogClosed of MsgDialogKey

}SelectFileCmd = [java mm] variant {

setFileName of string| selectFromFileChooser| fileSelected of FileChooserResult = {

? path : string}

}GenrapPluginEvent = [java mm] variant {

success of ReportParams| failure of ReportGenerationFailure = {

params : ReportParamscause : string

}}

Page 9: NIANIO Pattern Błażej Chodarcewicz Warsaw, 2006-02-22

AppLogicExtCmd = [java mm] variant {generate of ReportParams| showMainFrame of MainFrame = {

reportFileName, xmlFileName, xsdFileName,outputFileName : stringoutputKind : OutputKindstatus : string

}| setOutput of OutputKind| setStatus of string| reportFile of SelectFileExtCmd| xmlFile of SelectFileExtCmd| xsdFile of SelectFileExtCmd| outputFile of SelectFileExtCmd| showMessage of ShowMessageCmd = {

key : MsgDialogKeyparams : MessageDialogParams

}| closeMainFrame | exit

}SelectFileExtCmd = [java mm] variant {

openFileChooser of FileChooserParams| setFileName of string

}

Page 10: NIANIO Pattern Błażej Chodarcewicz Warsaw, 2006-02-22

More Nianio examples – Test Application Source

• Nianio implementation• Nianio invocation• Nianio parameterization• Connecting nianios

Page 11: NIANIO Pattern Błażej Chodarcewicz Warsaw, 2006-02-22

Genrap UI future• Nianio and functional code

everywhere (no models, listeners)• Small part of code which touch

threads, synchronization etc.• Controlled event flow• Clear core structure

Page 12: NIANIO Pattern Błażej Chodarcewicz Warsaw, 2006-02-22

Genrap core architecture

Page 13: NIANIO Pattern Błażej Chodarcewicz Warsaw, 2006-02-22

Thank you

Questions?