by Vladimir Minkin
Intoduction to Wire
More than 13 years of IT production experience
I'm Software Engineer, Tech Lead and System Architect
A design is a plan or specification for the construction of an object or system.
Wikipedia
Why?
When?
Who?
It is bout answering questions
Architecture is not about making decisions earlier, but making decisions late.
Robert C. Martin
another common definition of design is the word - architecture
ideal representation of system parts
every software system is based on
System could be presented as 2 sets of strings
key - value
They can be represented with 2 layers
Strings are good candidates for keys in a set
Set of signals it produces or consumes
any "Black Box" can be described as two sets of strings:
Set of keys to retrieve data
User_Account: {
name : "Vladimir Minkin"
email : "vladimir.minkin@gmail.com"
}
Submit_User_Account: {
payload (DTO)
}
abstract representation of UI component
Data API - input
Signals API - output
component described in Strings constants:
ACCOUNT: "UserAccount",
POSTS: "UserPosts",
SUBMIT_ACCOUNT: "AccountSubmit", CREATE_POST: "CreatePost", }
system's functional parts can be united in a set of String keys:
another "Black Box" in the system listening for the signals and process them
A processor that knows how to analyze signals and makes decisions based on other data sources
independent components in the system
implement Component Driven Development concept
Components retrieve data with Data API
They listen and send messages with Signals API
Flux is a pattern for managing data flow in application. The most important concept is that data flows in one direction.
Conceptual diagram
what else do we need?
but component already know about data
observer pattern
"UserAccount"
value: {
name: ""
email: ""
}
- subscribe (params)
- unsubscribe (params)
- value (set / get )
observer realizes unidirectional data flow
"UserAccount"
subscribe (callback)
Send signals
know how to update itself
Process signals
Update data
black box
another black box
in result:
Originally written in Dart but available in other languages.
Two static layers
// Signals API
Wire .add(scope, signal, listener)
bool .send(signal, {payload, scope})
bool .remove(signal, {scope, listener})
bool .has({signal, wire})
// Data API
WireData .data(key, [value])
Processors
(or Controllers)
listen for signals,
business logic units,
know about externals,
trigger update of the data,
sends consequent signals.
Possible to distinguish two types of entities in the system:
Consumers
(or View)
retrieve data container,
subscribe for updates,
unsubscribe,
send signals with payload,
can listen for signals.
Active Models *