- Standardized Contracts: Guaranteeing interoperability and harmonization of data models.
- Loose Coupling: Reducing the degree of component coupling fosters.
- Abstraction: Increasing long-term consistency of interoperability and allowing underlying components to evolve independently.
- Reusability: Enabling high-level interoperability between modules and potential component consumers.
- Stateless: Increasing availability and scalability of components allowing them to interoperate more frequent and reliable.
- Composability: For components to be effectively composable they must be interoperable.
A key objective is for interoperability to become a natural design of the NEM2-SDK, ideally to extend that components to work with other products or systems.
- Reactive Programming
- In computing, reactive programming is a declarative programming paradigm concerned with data streams and the propagation of change. This means that it becomes possible to express static (e.g. arrays) or dynamic (e.g. event emitters) data streams with ease via the employed programming language(s), and that an inferred dependency within the associated execution model exists, which facilitates the automatic propagation of the change involved with data flow. Wikipedia reference.
- Observer Pattern
- The observer pattern is a software design pattern in which an object, called the subject, maintains a list of its dependents, called observers, and notifies them automatically of any state changes, usually by calling one of their methods. Wikipedia reference.
NEM2-SDK uses intensely ReactiveX Library. See reactivex here.
- Functional: Developers can avoid complex stateful programs using clean input/output functions over observable streams.
- Less is more: ReactiveX’s operators often reduce what was once an elaborate challenge into a few lines of code.
- Async error handling: Traditional try/catch is powerless for errors handling in asynchronous computations, but ReactiveX will offer developers the proper tools for handling these sort of errors.
- Concurrency made easy: Observables and Schedulers in ReactiveX allow the programmer to abstract away low-level threading, synchronization, and concurrency issues.
- Frontend: Simple manipulation of UI events and API responses on the Web using RxJS
- Backend: Embrace ReactiveX’s asynchronicity, enabling concurrency and implementation independence.
In case you are not familiar with ReactiveX and you still have to deliver something fast, you can convert an observable to Promise/Future by reviewing this example. But, we encourage you to learn ReactiveX.
The HTTP requests are made following the Repository Pattern, and they return NEM Domain immutable models via the Observable Pattern.
The NEM Domain models are, usually, immutable by definition, the developer cannot change its attributes. Instead, the developer has to create new Transactions and dispatch them to NEM Blockchain via TransactionHTTP, to change the NEM Blockchain state.
Common operations that require multiple NIS2-API requests are handled by already provided services.