LOG8430E: Frameworks and Distributed Systems - Fall 2021 M. Fokaefs et F. Guibault

Page created by Greg Brown
 
CONTINUE READING
LOG8430E: Frameworks and Distributed Systems - Fall 2021 M. Fokaefs et F. Guibault
LOG8430E: Frameworks and
   Distributed Systems
               Fall 2021
       ©M. Fokaefs et F. Guibault
LOG8430E: Frameworks and Distributed Systems - Fall 2021 M. Fokaefs et F. Guibault
So far…
LOG2410
          OO Design
           (SOLID)
                      Styles and Patterns of Distributed
                                Architectures
           Design
          Patterns

                                                           2
LOG8430E: Frameworks and Distributed Systems - Fall 2021 M. Fokaefs et F. Guibault
Today
LOG1410
          OO Design      Styles and Patterns of Distributed Architectures
           (SOLID)

           Design
          Patterns    Frameworks

                      Ecosystems

                          Pluggable
                         Architectures

                           LOG8430 – ©M. Fokaefs et F. Guibault             3
LOG8430E: Frameworks and Distributed Systems - Fall 2021 M. Fokaefs et F. Guibault
The distributed systems…in the wild!

Definitions    Examples                                Development        Maintenance
• Frameworks   • AngularJS                             • The culture      • Break the framework
• Plugins      • Django                                • The priorities
• Ecosystems   • Eclipse
               • Android
               • Node.js
               • R/CRAN

2021-09-06                   LOG8430 – © M. Fokaefs et F. Guibault                                4
LOG8430E: Frameworks and Distributed Systems - Fall 2021 M. Fokaefs et F. Guibault
Frameworks: Definition
• The frameworks are architectures half implemented and generic (agnostics
  to the application).
• They provide a skeleton with basic functionality intended to be extended.
• In a framework, there are abstract modules (hot spots), which the
  developers should extend, and concrete modules (frozen spots), which
  should not be changed.
      • So, frameworks implement the OCP principle by definition.
• A good example is the Template Method pattern.
      • The template method is the concrete part. The abstract methods called by the
        template method constitute the part that will be extended.
      • For other examples of the use of patterns in frameworks, consult the article: “Meta
        Patterns—A Means For Capturing the Essentials of Reusable Object-Oriented
        Design”, by Wolfgang Pree.

2021-09-06                          LOG8430 – © M. Fokaefs et F. Guibault                     5
LOG8430E: Frameworks and Distributed Systems - Fall 2021 M. Fokaefs et F. Guibault
Frameworks: Properties
• Inversion of control: It’s the concrete modules of the framework that
  dictate the control flow and the not the modules extended by the
  program.
      • Also known as the Hollywood principle: “Do not call us, we will call you.”
      • One implementation of the DIP principle.
      • Example 1: ActionListeners. The framework manages the events of the
        graphical interfaces and the code of the developer is notified to provide the
        reaction to these events.
      • Example 2: The Strategy pattern.
• Extensibility and reusability are increased, but modifiability is
  reduced.

2021-09-06                        LOG8430 – © M. Fokaefs et F. Guibault                 6
Plugins: Definitions
• The plugins follow a “microkernel” architecture (as in the case of
  operating systems).

2021-09-06                  LOG8430 – © M. Fokaefs et F. Guibault      7
Plugins: Properties
• The basic system is atomic and independent. This means that the
  base system can function without plugins.
• The plugins add supplementary functionalities.
• Contrary to frameworks, the plugins improve the experience of the
  user more than that of the developer.
• The plugins definitely depend on the base system, but it is possible
  that they also depend on other plugins.
• The flexibility and the extensibility are increased, but the
  maintainability may suffer.
      • The plugins strongly depend on the version of the base system (a form of the
        vendor lock-in).
2021-09-06                        LOG8430 – © M. Fokaefs et F. Guibault                8
Software ecosystems
• In fact, a software ecosystem is a collection of modules, which have something in
  common, e.g., a language, a framework etc.
      • There are numerous definitions that also include business aspects and economic
        relationships. Often, an ecosystem is simply a repository of software modules shared by a
        community of developers.
• The presence of a platform, as in the case of frameworks or plugins, is not
  necessary.
      • WARNING! This does not mean that plugins or frameworks are not an ecosystem, but we can
        classify these systems in a more concrete fashion.
• The modules, or the “packages”, contribute functionalities.
• The base of the packages is just a language or an execution environment (like
  JRE).
• Like the frameworks, but unlike the plugins, the packages facilitate the work of
  the developers.

2021-09-06                             LOG8430 – © M. Fokaefs et F. Guibault                        9
Ecosystems: Properties
• It’s the principal model for open source systems.
• The contributions are managed by the community, which specifies
  the regulations and habits of development and of contribution.
• Any contribution is possible, as long as it conforms to the terms and
  regulations.
• The functionalities are separated and isolated.
• The modularity, the testability and the reusability are increased.
• Maintainability may suffer as in the case of plugins.

2021-09-06                  LOG8430 – © M. Fokaefs et F. Guibault         10
Examples

2021-09-06   LOG8430 – © M. Fokaefs et F. Guibault   11
AngularJS
• AngularJS is a framework for the development of web applications in
  JavaScript.
• The framework follows a MVC architecture.
      • It is possible to implement any variant of this style: MVC, MVP, MVVM
• The principles of AngularJS are:
      • Less code
      • Increased automatization: data association, page transition.
      • Increased testability and reusability.
• The disadvantages:
      • Poor security

2021-09-06                        LOG8430 – © M. Fokaefs et F. Guibault         12
Architecture of AngularJS

2021-09-06       LOG8430 – © M. Fokaefs et F. Guibault   13
Django
• Django is a framework for web application development in Python.
• The framework follows a MVT architecture (Model-View-Template).
      • The controller is part of Django.
      • The Templates are a mix of HTML and DTL (Django Template Language). The
        DTL specifies actions or variables in the HTML code of the page.
• The principles of Django
      •      Low coupling, high cohesion
      •      Rapid development
      •      Less code
      •      SRP guaranteed, cloning is minimized.
      •      Secure, extensible, coherent.

2021-09-06                            LOG8430 – © M. Fokaefs et F. Guibault       14
Architecture of Django

2021-09-06       LOG8430 – © M. Fokaefs et F. Guibault   15
Eclipse
• Eclipse is an integrated development environment (IDE).
• Basically, it’s a more sophisticated Java editor.
• Eclipse is a pluggable architecture.
      • Additional plugins offer much more capabilities, among others programming in other
        languages.
• The plugins use the SDK (Standard Development Toolkit) to add to the
  functionality, the interface or both.
• The principal objective of Eclipse is the unification of programming tools under a
  single platform.
• Eclipse is officially supported by IBM, but there are numerous companies and
  developers that work with the platform.
      • 490 contributors from 40 companies worked on the first version.
      • Today, there are 1000 contributors from 170 companies.

2021-09-06                             LOG8430 – © M. Fokaefs et F. Guibault                 16
Architecture of Eclipse

2021-09-06        LOG8430 – © M. Fokaefs et F. Guibault   17
Android
• Android is a platform for the development of mobile applications.
• Android is also an operating system for mobile devices.
• In fact, it is a framework, a pluggable architecture and an ecosystem
  at the same time.
• The Android applications follow a MVVM architecture.
      • Model – Room/Retrofit
      • ViewModel – Lifecycle, LiveData
      • View - UI

2021-09-06                       LOG8430 – © M. Fokaefs et F. Guibault    18
Architecture of Android

2021-09-06       LOG8430 – © M. Fokaefs et F. Guibault   19
Architecture of Android Applications

2021-09-06       LOG8430 – © M. Fokaefs et F. Guibault   20
Node.js
• Node.js is an execution environment for JavaScript.
• The developers can contribute modules to Node.js in the form of
  packages.
• The packages are managed, installed and configured by npm (Node
  Package Manager).
• Node.js is a platform for the development of server applications, and
  it is also an ecosystem.
• It follows an event-driven architecture.

2021-09-06                 LOG8430 – © M. Fokaefs et F. Guibault          21
Architecture of Node.js

2021-09-06       LOG8430 – © M. Fokaefs et F. Guibault   22
R/CRAN –
The Comprehensive R Archive Network
• CRAN is a distributed repository for R packages.
      • R is a language for scientific calculations and statistics.
• The developers can contribute their own packages in CRAN.
• The community has regulations for the submission of packages.
• CRAN follows a peer-to-peer architecture.
      • Distributed servers have duplicated files between them.
      • The selection of the server, from which to download a package, is based on
        proximity.

2021-09-06                          LOG8430 – © M. Fokaefs et F. Guibault            23
Development and maintenance
of distributed systems

2021-09-06   LOG8430 – © M. Fokaefs et F. Guibault   24
Maintenance of distributed systems
• Statement: The design quality of a software does not play any role in
  its functional maintenance.
• True? Two systems with different designs/architectures (e.g.,
  monolithic vs modular) can have identical functionality.
• False! The design quality affects the capacity to efficiently maintain
  the functionality of the system.
      • A flat or complex design can complicate the maintenance, especially in the
        case of an external change.
      • So, we “clean up” beforehand, so that we can be ready to receive our
        “visitors”.

2021-09-06                        LOG8430 – © M. Fokaefs et F. Guibault              25
How to break an API?
• Interviews with the developers of three ecosystems (Eclipse, R, Node.js)
• Questionnaires with responses from 2000 developers from 18 ecosystems.

2021-09-06                    LOG8430 – © M. Fokaefs et F. Guibault          26
Definitions of the study
• Breaking changes: Due to
  dependencies between the
  modules that are developed
  independently, changes can
  propagate through the
  ecosystem.
• Negotiations of the impact of
  breaking changes: The strategy
  of the developers with respect
  to who is responsible of
  adapting to changes.

2021-09-06                LOG8430 – © M. Fokaefs et F. Guibault   27
Eclipse
• Value: Backwards compatibility to
  reduce the cost for users.
• Eclipse is updated every year with
  few breaking changes.
• Expensive for maintainers.
• Minimal effort and cost for users.
• The development is perceived as
  stagnant.
• New contributors are discouraged.

2021-09-06                 LOG8430 – © M. Fokaefs et F. Guibault   28
R/CRAN
• Values: Easy for users, rapid access
  to current research.
• The packages in CRAN are
  synchronized every month.
• Medium volume of breaking
  changes.
• The costs are shared between
  maintainers and users.
• Collaboration with external
  maintainers are encouraged.
• The urgency to react to updates
  can be perceived as an obstacle.

2021-09-06                    LOG8430 – © M. Fokaefs et F. Guibault   29
Node.js
• Value: The publication and use of
  packages need to be easy and fast
  for developers.
• The update of packages is
  independent and decoupled.
• It is the responsibility of the user to
  update their package based on
  changes on other packages.
• Many breaking changes.
• Rapid evolution requires constant
  maintenance or risk of falling
  behind.

2021-09-06                      LOG8430 – © M. Fokaefs et F. Guibault   30
So, how to break an API?
• Eclipse: not possible.
• R/CRAN: communicate with affected developers.
• Node.js: increase the number of the major release.

2021-09-06                 LOG8430 – © M. Fokaefs et F. Guibault   31
Which value is the most important one for
each ecosystem?

2021-09-06       LOG8430 – © M. Fokaefs et F. Guibault   32
Frequency of breaking changes

2021-09-06      LOG8430 – © M. Fokaefs et F. Guibault   33
Coordination between maintainers

2021-09-06      LOG8430 – © M. Fokaefs et F. Guibault   34
Refrain to evolve due to dependencies

2021-09-06       LOG8430 – © M. Fokaefs et F. Guibault   35
It’s worth adding a dependency if it will add
significant value.

2021-09-06        LOG8430 – © M. Fokaefs et F. Guibault   36
The frequency of collaboration and
communication between the maintainers.

2021-09-06      LOG8430 – © M. Fokaefs et F. Guibault   37
Next time
LOG1410
             OO Design      Styles and Patterns of Distributed Architectures
              (SOLID)

              Design
             Patterns    Frameworks

LOG8371                  Ecosystems

                             Pluggable
                            Architectures
   LOG3430
              Design
              Quality
                              LOG8430 – ©M. Fokaefs et F. Guibault             38
You can also read