SlideShare a Scribd company logo
1 of 32
Download to read offline
Motivation
                  Implementation
                  Going Universal
                        Summary




            Universal Declarative Services
A component framework for C++ and a model-driven solution to
                    polyglot components




                      Simon Chemouil
                                            1

                      1 Global Vision Systems


                OSGi Community Event, 2012




                  Simon Chemouil    Universal Declarative Services
Motivation
                        Implementation
                        Going Universal
                              Summary

Who am I?

     Free Software enthusiast, functional programmer, interested in
     model-driven development, modularity, re-usability,
     maintainability. . .

          How to never have to write that piece of software again?



     Technical Architect at Global Vision Systems, Toulouse

          We create data visualization software for large industries (2D,
          3D, tables, etc).
          We do both Java and C++

                Java using OSGi (Felix, iPojo) for server and client side
                (Eclipse RCP and Android)
                C++ to keep a fast 3D engine-agnostic manipulation layer

                        Simon Chemouil    Universal Declarative Services
Motivation
                        Implementation
                        Going Universal
                              Summary

Outline

  1   Motivation
        The case for modularity
        Service Components and C++

  2   Implementing Declarative Services for C++
        Challenges in C++
        Dening components

  3   Going Universal
        Simpler Component Denitions
        What's next?

  4   Summary
        Conclusion



                        Simon Chemouil    Universal Declarative Services
Motivation
                        Implementation    Why modularity?
                        Going Universal   Service Components
                              Summary

Native OSGi



     Did you miss Native-OSGi, Modular Software Development in
     a Native world by Alexander Broekhuis and Sascha Zelzer?



     Universal OSGi

         an RFP and a blog post by Peter Kriens in 2007.



     Apply OSGi techniques to native (C/C++) development.




                     Simon Chemouil       Universal Declarative Services
Motivation
                        Implementation    Why modularity?
                        Going Universal   Service Components
                              Summary

An OSGi Architect Walks in a C++ Bar...


     Our C++ project going through re-architecture / refactoring

         Custom-made plugin system, limited.

                Plugins can't use each other


     C/C++ OSGi ports:

         Celix (Alexander), CppMicroServices (Sascha), SOF, CTK,
         nOSGi, . . .



     Yet no service component framework such as Declarative
     Services




                        Simon Chemouil    Universal Declarative Services
Motivation
                        Implementation    Why modularity?
                        Going Universal   Service Components
                              Summary

Why a Service Component Framework?


     Services: powerful primitives, unpractical programming:

           Lack of structure
           Dynamic



     Service Components:

           Structure the services
           A nice semantic model to reason about dynamism



     Why is there no such framework for an OSGi C++ port:

       1   Technical challenges
       2   It was just not done yet!



                        Simon Chemouil    Universal Declarative Services
Motivation
                       Implementation    Why modularity?
                       Going Universal   Service Components
                             Summary

Why Declarative Services?


      Many existing component frameworks for C++

          Just as there were some for Java before DS
          No modularity



      Simple and matured component model

          A few years of personal experience



      Works with POJOs (or POCOs!)

          Components do not depend on the framework
          Makes them testable and easily reusable!




                      Simon Chemouil     Universal Declarative Services
Motivation
                     Implementation    Why modularity?
                     Going Universal   Service Components
                           Summary

Does it make sense for C++?


     We use C++ for performance:

         Performance hit with component frameworks?



     We need extensibility and customization...

         Do we need modularity?



     Why use dierent architecture between Java and C++?

         What if we could talk about components, whatever the
         implementation language?




                     Simon Chemouil    Universal Declarative Services
Motivation
                       Implementation    Challenges in C++
                       Going Universal   Dening components
                             Summary

Getting started


      Native OSGi implementation:

          CppMicroServices is light, works with any shared library
          Inspired by PojoSR
          For C++!



      Bundles are called Modules:

          Native shared libraries: not archives.



      Moving to NativeOSGi later?

          Easy! Components are framework-agnostic!




                       Simon Chemouil    Universal Declarative Services
Motivation
                          Implementation    Challenges in C++
                          Going Universal   Dening components
                                Summary

Ingredients in Declarative Services


      Components are described in XML les in the bundle



      Service callbacks

          Dened in description
          Service arrival/departure
          Policy, Cardinality, Target



      Component callbacks

          Activation, modication, deactivation




                       Simon Chemouil       Universal Declarative Services
Motivation
                        Implementation    Challenges in C++
                        Going Universal   Dening components
                              Summary

Component Descriptions in C++



     XML descriptions. . .

           We have native shared libraries, not JARs!



     Instead, we register a    ComponentDescriptor                 instance to the
     ComponentManager         service.



     The   ComponentManager          service is provided by the core
     Ds4Cpp framework.




                       Simon Chemouil     Universal Declarative Services
Motivation
                              Implementation     Challenges in C++
                              Going Universal    Dening components
                                    Summary

Component Descriptions in C++

  Denition


  class ComponentDescriptor {
  public :
      const s t r i n g c o m p o n e n t I d ;
      const s t r i n g i m p l S h a r e d O b j e c t ;
      const v e c t o r  s t r i n g ∗ p r o v i d e d S e r v i c e s          ;
          v e c t o r C o m p o n e n t R e f e r e n c e ∗    references       ;
          const bool          immediate           ;
          const bool          autoEnable              ;
  }   ;




                              Simon Chemouil     Universal Declarative Services
Motivation
                       Implementation    Challenges in C++
                       Going Universal   Dening components
                             Summary

Component Descriptions in C++




     Let's see how it looks like in practice. . .




                       Simon Chemouil    Universal Declarative Services
Motivation
                   Implementation    Challenges in C++
                   Going Universal   Dening components
                         Summary

Extensible Hello World!




                   Simon Chemouil    Universal Declarative Services
Motivation
                             Implementation     Challenges in C++
                             Going Universal    Dening components
                                   Summary

Component Descriptions in C++
  Denition

     s t d : : v e c t o r ComponentReference ∗ r e f e r e n c e s = . . . ;
     r e f e r e n c e s −push_back (
         ComponentReference (  greetdemo : : G r e e t P r o v i d e r  , 
                 greetdemo : : G r e e t P r o v i d e r  ,
           s t d : : s t r i n g ( ) , ComponentReference : : DYNAMIC,
           ComponentReference : : MULTIPLE ,
           ComponentReference : : OPTIONAL_REF) ) ;

     s t d : : v e c t o r s t d : : s t r i n g  s e r v i c e s ;
     s e r v i c e s . push_back (  greetdemo : : GreetManager  ) ;

     C o m p o n e n t D e s c r i p t o r ∗ componentDesc =
                   new ds4cpp : : C o m p o n e n t D e s c r i p t o r (
                    greetdemo : : G r e e t M a n a g e r I m p l  ,  ,
                   s e r v i c e s , ∗ r e f e r e n c e s , true , true ) ;

                            Simon Chemouil      Universal Declarative Services
Motivation
                                  Implementation        Challenges in C++
                                  Going Universal       Dening components
                                        Summary

A Component in C++

  Denition

  c l a s s G r e e t M a n a g e r I m p l : p u b l i c GreetManager {
  public :
          G r e e t M a n a g e r I m p l ( ) ; v i r t u a l ~G r e e t M a n a g e r I m p l ( ) ;
          void activate () ;
          void a d d G r e e t P r o v i d e r ( G r e e t P r o v i d e r ∗) ;
          void removeGreetProvider ( G r e e t P r o v i d e r ∗) ;

         //    Service       methods .

         s t r i n g g e t D e f a u l t T a r g e t ( c o n s t s t r i n g ) c o n s t ;
         s t r i n g g e t G r e e t i n g ( c o n s t s t r i n g , c o n s t s t r i n g )
                 const ;
         l i s t s t r i n g  g e t A l l G r e e t i n g s ( c o n s t s t r i n g ) c o n s t ;
         l i s t s t r i n g  g e t A v a i l a b l e L a n g u a g e s ( ) c o n s t ;
  };


                                  Simon Chemouil        Universal Declarative Services
Motivation
                         Implementation    Challenges in C++
                         Going Universal   Dening components
                               Summary

Service Callbacks in C++ (1/2)


      No reection/introspection!

          There are some limited libraries (e.g Reex).



      C++ name mangling

          We can't guess the binary name



      Instead, we force a convention in the C++ component:

          setRefName, unsetRefName for single dependencies
          addRefName, removeRefName for multiple
          dependencies




                      Simon Chemouil       Universal Declarative Services
Motivation
                        Implementation    Challenges in C++
                        Going Universal   Dening components
                              Summary

Service Callbacks in C++ (2/2)

      Our tools: dlopen/dlsym/dlclose (and Windows equivalents)

          Against us: C++ name mangling



      Solutions?

          Reection libraries: too limited, not dynamic.
          C++11 attributes (≈ Java annotations): still largely
          unsupported
          Qt meta-objects? Not bad!

               Yet need a custom preprocessor
               Still not modular (work in progress)


      How about C wrappers?

          Dicult to write manually, but provide universal ABI!

                        Simon Chemouil    Universal Declarative Services
Motivation
                                 Implementation      Challenges in C++
                                 Going Universal     Dening components
                                       Summary

C Wrapper
  Denition

  e x t e r n C {
  DS_ABI_EXPORT GreetManagerImplWrapper ∗
            __greetdemo__GreetManagerImpl__create ( ) {
      r e t u r n new GreetManagerImplWrapper ;
  }
  DS_ABI_EXPORT void __greetdemo__GreetManagerImpl__activate (
            GreetManagerImplWrapper ∗ o b j e c t ) {
      o b j e c t − a c t i v a t e ( ) ;
  }
  DS_ABI_EXPORT void
            __greetdemo__GreetManagerImpl__add_greetdemo__GreetProvider (
            GreetManagerImplWrapper ∗ o b j e c t , : : us : : Base ∗ s e r v i c e ) {
      greetdemo : : G r e e t P r o v i d e r ∗ l s e r v i c e = dynamic_cast greetdemo : :
                G r e e t P r o v i d e r ∗ ( s e r v i c e ) ;
      o b j e c t −a d d G r e e t P r o v i d e r ( l s e r v i c e ) ;
  }
  DS_ABI_EXPORT void
            __greetdemo__GreetManagerImpl__remove_greetdemo__GreetProvider (
            GreetManagerImplWrapper ∗ o b j e c t , : : us : : Base ∗ s e r v i c e ) {
      greetdemo : : G r e e t P r o v i d e r ∗ l s e r v i c e = dynamic_cast greetdemo : :
                G r e e t P r o v i d e r ∗ ( s e r v i c e ) ;
      o b j e c t −r e m o v e G r e e t P r o v i d e r ( l s e r v i c e ) ;
  } } // e x t e r n C


                                 Simon Chemouil      Universal Declarative Services
Motivation
                        Implementation    Challenges in C++
                        Going Universal   Dening components
                              Summary

It works! But. . .


       The proof-of-concept is successful:

           We have components wired dynamically

                OSGi's patterns work nicely (yet a bit more tricky)
           We support the use cases we need

                Dynamic arrival, thread-safety planned but unnished, service
                removal to do.


       But no one would write that wrapper code!

           Are there solutions to help us here?




                        Simon Chemouil    Universal Declarative Services
Demo Time!
Motivation
                      Implementation    Simpler Component Denitions
                      Going Universal   What's next?
                            Summary

C++ is too complex!


     Automatically generating the wrappers?

         Where to get the description?

              Macros?
              Parsing C++?!


     Xtext

         Java tooling to dene DSLs and compilers
         Generates an Eclipse editor!
         Uses EMF as backend, so more can be built upon.




                     Simon Chemouil     Universal Declarative Services
Motivation
                              Implementation    Simpler Component Denitions
                              Going Universal   What's next?
                                    Summary

Back to GreetManagerImpl!


  Denition


  component g r e e t d e m o . G r e e t M a n a g e r I m p l     {
    provides {
          greetdemo . GreetManager
      }
      references {
        dynamic s e r v i c e        greetdemo . G r e e t P r o v i d e r       [0..n]
      }
  }




                             Simon Chemouil     Universal Declarative Services
Motivation
                               Implementation    Simpler Component Denitions
                               Going Universal   What's next?
                                     Summary

Dening multiple components


  Denition


  module DSDemo {
   name = DS G r e e t            Demo
    version = 1.0.0
    includes {
          greetdemo . E n g l i s h G r e e t P r o v i d e r
          greetdemo . F r e n c h G r e e t P r o v i d e r
          greetdemo . GreetManagerImpl
          greetdemo . C o n s o l e G r e e t e r
      }
  }




                              Simon Chemouil     Universal Declarative Services
Generating C++ code
Demo Time!
Motivation
                       Implementation    Simpler Component Denitions
                       Going Universal   What's next?
                             Summary

Improving our ADL



     The ADL we designed maps to Declarative Services'
     capabilities

          What about richer component models?



     Creating new target language back-ends

          Java/DS, Java/iPojo
          Making it extensible




                      Simon Chemouil     Universal Declarative Services
Motivation
                       Implementation    Simpler Component Denitions
                       Going Universal   What's next?
                             Summary

Bridging Java and C++



     Using Remote OSGi Services:

          An idea discussed in NativeOSGi.
          We expose C++ services where we can generate a Java
          interface

               Use JNI/JNA bindings or network.


     Basically, we bridge the two service registries!

          It does sound like CORBA




                      Simon Chemouil     Universal Declarative Services
Motivation
                        Implementation    Simpler Component Denitions
                        Going Universal   What's next?
                              Summary

Creating UI Tools

      Textual DSLs are nice...

          But component diagrams are nicer!



      Up-to-date component metadata is extremely useful:

          Forces high-level design (round-trips between architects and
          developers)
          Allows code generation/rapid project bootstrapping
          Static analysis (code conformance)
          Can be used for SDK documentation.



      Long term project!




                        Simon Chemouil    Universal Declarative Services
Motivation
                       Implementation    Conclusion
                       Going Universal
                             Summary

Declarative Services for C++


      We have been using Ds4Cpp for a few months!



      If you want to try it. . . you can! We just open sourced it
      (Apache Software License 2.0)


     https://github.com/Global-Vision-Systems/Ds4Cpp
                   (the demo is packaged with it)!




      We need testers and eyes to x my bad C++ :-)

          And remove the limitations (talk to me!)




                      Simon Chemouil     Universal Declarative Services
Motivation
                      Implementation    Conclusion
                      Going Universal
                            Summary

Universal Components Tooling



     The tooling has still some rough edges



     Enough for our current needs. . .

         Some clean-up required.



     We have a roadmap for the improvements.




                      Simon Chemouil    Universal Declarative Services
Motivation
                    Implementation    Conclusion
                    Going Universal
                          Summary

Universal Declarative Services



                    Questions?


                              Twitter:


                              @simach


       simon.chemouil@global-vision-systems.com



                   Simon Chemouil     Universal Declarative Services

More Related Content

Viewers also liked

XKE - Programming Paradigms & Constructs
XKE - Programming Paradigms & ConstructsXKE - Programming Paradigms & Constructs
XKE - Programming Paradigms & ConstructsNicolas Demengel
 
Polymorphism and Software Reuse
Polymorphism and Software ReusePolymorphism and Software Reuse
Polymorphism and Software Reuseadil raja
 
12 couplingand cohesion-student
12 couplingand cohesion-student12 couplingand cohesion-student
12 couplingand cohesion-studentrandhirlpu
 
Hashing and Hash Tables
Hashing and Hash TablesHashing and Hash Tables
Hashing and Hash Tablesadil raja
 
Iterator - a powerful but underappreciated design pattern
Iterator - a powerful but underappreciated design patternIterator - a powerful but underappreciated design pattern
Iterator - a powerful but underappreciated design patternNitin Bhide
 
C++: inheritance, composition, polymorphism
C++: inheritance, composition, polymorphismC++: inheritance, composition, polymorphism
C++: inheritance, composition, polymorphismJussi Pohjolainen
 
The Network Layer
The Network LayerThe Network Layer
The Network Layeradil raja
 
Coherence And Cohesion
Coherence And CohesionCoherence And Cohesion
Coherence And Cohesiontimberlakon
 
Object Oriented Programming Concepts
Object Oriented Programming ConceptsObject Oriented Programming Concepts
Object Oriented Programming Conceptsthinkphp
 

Viewers also liked (16)

XKE - Programming Paradigms & Constructs
XKE - Programming Paradigms & ConstructsXKE - Programming Paradigms & Constructs
XKE - Programming Paradigms & Constructs
 
C++ Inheritance
C++ InheritanceC++ Inheritance
C++ Inheritance
 
Polymorphism and Software Reuse
Polymorphism and Software ReusePolymorphism and Software Reuse
Polymorphism and Software Reuse
 
Syntax part 6
Syntax part 6Syntax part 6
Syntax part 6
 
12 couplingand cohesion-student
12 couplingand cohesion-student12 couplingand cohesion-student
12 couplingand cohesion-student
 
Polymorphism
PolymorphismPolymorphism
Polymorphism
 
Hashing and Hash Tables
Hashing and Hash TablesHashing and Hash Tables
Hashing and Hash Tables
 
Iterator - a powerful but underappreciated design pattern
Iterator - a powerful but underappreciated design patternIterator - a powerful but underappreciated design pattern
Iterator - a powerful but underappreciated design pattern
 
C++: inheritance, composition, polymorphism
C++: inheritance, composition, polymorphismC++: inheritance, composition, polymorphism
C++: inheritance, composition, polymorphism
 
WSO2 Complex Event Processor
WSO2 Complex Event ProcessorWSO2 Complex Event Processor
WSO2 Complex Event Processor
 
Cohesion and coherence
Cohesion and coherenceCohesion and coherence
Cohesion and coherence
 
Cohesion & Coupling
Cohesion & Coupling Cohesion & Coupling
Cohesion & Coupling
 
The Network Layer
The Network LayerThe Network Layer
The Network Layer
 
Lexical cohesion
Lexical cohesionLexical cohesion
Lexical cohesion
 
Coherence And Cohesion
Coherence And CohesionCoherence And Cohesion
Coherence And Cohesion
 
Object Oriented Programming Concepts
Object Oriented Programming ConceptsObject Oriented Programming Concepts
Object Oriented Programming Concepts
 

Similar to Universal Declarative Services

Universal Declarative Services - Simon Chemouil
Universal Declarative Services - Simon ChemouilUniversal Declarative Services - Simon Chemouil
Universal Declarative Services - Simon Chemouilmfrancis
 
From Monolith to Modules - breaking apart a one size fits all product into mo...
From Monolith to Modules - breaking apart a one size fits all product into mo...From Monolith to Modules - breaking apart a one size fits all product into mo...
From Monolith to Modules - breaking apart a one size fits all product into mo...Robert Munteanu
 
Continuous Everything
Continuous EverythingContinuous Everything
Continuous EverythingAndrea Tino
 
Accelerate your Application Delivery with DevOps and Microservices
Accelerate your Application Delivery with DevOps and MicroservicesAccelerate your Application Delivery with DevOps and Microservices
Accelerate your Application Delivery with DevOps and MicroservicesAmazon Web Services
 
OSGi DevCon 2009 Review
OSGi DevCon 2009 ReviewOSGi DevCon 2009 Review
OSGi DevCon 2009 Reviewnjbartlett
 
Agile Chennai 2021 | Achieving High DevOps Maturity through Platform Engineer...
Agile Chennai 2021 | Achieving High DevOps Maturity through Platform Engineer...Agile Chennai 2021 | Achieving High DevOps Maturity through Platform Engineer...
Agile Chennai 2021 | Achieving High DevOps Maturity through Platform Engineer...AgileNetwork
 
The Advantages of Functional Programming with Clojure
The Advantages of Functional Programming with ClojureThe Advantages of Functional Programming with Clojure
The Advantages of Functional Programming with ClojureUXDXConf
 
Agile & ALM tools
Agile & ALM toolsAgile & ALM tools
Agile & ALM toolsLarry Cai
 
The DevOps paradigm - the evolution of IT professionals and opensource toolkit
The DevOps paradigm - the evolution of IT professionals and opensource toolkitThe DevOps paradigm - the evolution of IT professionals and opensource toolkit
The DevOps paradigm - the evolution of IT professionals and opensource toolkitMarco Ferrigno
 
The DevOps Paradigm
The DevOps ParadigmThe DevOps Paradigm
The DevOps ParadigmNaLUG
 
Introduction to OSLC and Linked Data
Introduction to OSLC and Linked DataIntroduction to OSLC and Linked Data
Introduction to OSLC and Linked Dataopenservices
 
About the Zero Deviation Lifecycle
About the Zero Deviation LifecycleAbout the Zero Deviation Lifecycle
About the Zero Deviation LifecycleSteve Ross-Talbot
 
Cmdb intro 2012 v1
Cmdb intro 2012 v1Cmdb intro 2012 v1
Cmdb intro 2012 v1Pini Cohen
 
Advanced Techniques for Initiating the DevOps Journey
Advanced Techniques for Initiating the DevOps JourneyAdvanced Techniques for Initiating the DevOps Journey
Advanced Techniques for Initiating the DevOps JourneyCA Technologies
 
Case Study: Practical tools and strategies for tackling legacy practices and ...
Case Study: Practical tools and strategies for tackling legacy practices and ...Case Study: Practical tools and strategies for tackling legacy practices and ...
Case Study: Practical tools and strategies for tackling legacy practices and ...Alejandro S.
 
Unit 1 of c++ part 1 basic introduction
Unit 1 of c++ part 1 basic introductionUnit 1 of c++ part 1 basic introduction
Unit 1 of c++ part 1 basic introductionAKR Education
 
Architecture tests: Setting a common standard
Architecture tests: Setting a common standardArchitecture tests: Setting a common standard
Architecture tests: Setting a common standardPiotr Horzycki
 

Similar to Universal Declarative Services (20)

Universal Declarative Services - Simon Chemouil
Universal Declarative Services - Simon ChemouilUniversal Declarative Services - Simon Chemouil
Universal Declarative Services - Simon Chemouil
 
From Monolith to Modules - breaking apart a one size fits all product into mo...
From Monolith to Modules - breaking apart a one size fits all product into mo...From Monolith to Modules - breaking apart a one size fits all product into mo...
From Monolith to Modules - breaking apart a one size fits all product into mo...
 
Part 1
Part 1Part 1
Part 1
 
Continuous Everything
Continuous EverythingContinuous Everything
Continuous Everything
 
Accelerate your Application Delivery with DevOps and Microservices
Accelerate your Application Delivery with DevOps and MicroservicesAccelerate your Application Delivery with DevOps and Microservices
Accelerate your Application Delivery with DevOps and Microservices
 
OSGi DevCon 2009 Review
OSGi DevCon 2009 ReviewOSGi DevCon 2009 Review
OSGi DevCon 2009 Review
 
Agile Chennai 2021 | Achieving High DevOps Maturity through Platform Engineer...
Agile Chennai 2021 | Achieving High DevOps Maturity through Platform Engineer...Agile Chennai 2021 | Achieving High DevOps Maturity through Platform Engineer...
Agile Chennai 2021 | Achieving High DevOps Maturity through Platform Engineer...
 
The Advantages of Functional Programming with Clojure
The Advantages of Functional Programming with ClojureThe Advantages of Functional Programming with Clojure
The Advantages of Functional Programming with Clojure
 
Agile & ALM tools
Agile & ALM toolsAgile & ALM tools
Agile & ALM tools
 
The DevOps paradigm - the evolution of IT professionals and opensource toolkit
The DevOps paradigm - the evolution of IT professionals and opensource toolkitThe DevOps paradigm - the evolution of IT professionals and opensource toolkit
The DevOps paradigm - the evolution of IT professionals and opensource toolkit
 
The DevOps Paradigm
The DevOps ParadigmThe DevOps Paradigm
The DevOps Paradigm
 
ewili13_submission_14
ewili13_submission_14ewili13_submission_14
ewili13_submission_14
 
Introduction to OSLC and Linked Data
Introduction to OSLC and Linked DataIntroduction to OSLC and Linked Data
Introduction to OSLC and Linked Data
 
About the Zero Deviation Lifecycle
About the Zero Deviation LifecycleAbout the Zero Deviation Lifecycle
About the Zero Deviation Lifecycle
 
Cmdb intro 2012 v1
Cmdb intro 2012 v1Cmdb intro 2012 v1
Cmdb intro 2012 v1
 
Advanced Techniques for Initiating the DevOps Journey
Advanced Techniques for Initiating the DevOps JourneyAdvanced Techniques for Initiating the DevOps Journey
Advanced Techniques for Initiating the DevOps Journey
 
Case Study: Practical tools and strategies for tackling legacy practices and ...
Case Study: Practical tools and strategies for tackling legacy practices and ...Case Study: Practical tools and strategies for tackling legacy practices and ...
Case Study: Practical tools and strategies for tackling legacy practices and ...
 
Unit 1 of c++ part 1 basic introduction
Unit 1 of c++ part 1 basic introductionUnit 1 of c++ part 1 basic introduction
Unit 1 of c++ part 1 basic introduction
 
Architecture tests: Setting a common standard
Architecture tests: Setting a common standardArchitecture tests: Setting a common standard
Architecture tests: Setting a common standard
 
Typescript++1
Typescript++1Typescript++1
Typescript++1
 

Recently uploaded

AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesZilliz
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 

Recently uploaded (20)

AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector Databases
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 

Universal Declarative Services

  • 1. Motivation Implementation Going Universal Summary Universal Declarative Services A component framework for C++ and a model-driven solution to polyglot components Simon Chemouil 1 1 Global Vision Systems OSGi Community Event, 2012 Simon Chemouil Universal Declarative Services
  • 2. Motivation Implementation Going Universal Summary Who am I? Free Software enthusiast, functional programmer, interested in model-driven development, modularity, re-usability, maintainability. . . How to never have to write that piece of software again? Technical Architect at Global Vision Systems, Toulouse We create data visualization software for large industries (2D, 3D, tables, etc). We do both Java and C++ Java using OSGi (Felix, iPojo) for server and client side (Eclipse RCP and Android) C++ to keep a fast 3D engine-agnostic manipulation layer Simon Chemouil Universal Declarative Services
  • 3. Motivation Implementation Going Universal Summary Outline 1 Motivation The case for modularity Service Components and C++ 2 Implementing Declarative Services for C++ Challenges in C++ Dening components 3 Going Universal Simpler Component Denitions What's next? 4 Summary Conclusion Simon Chemouil Universal Declarative Services
  • 4. Motivation Implementation Why modularity? Going Universal Service Components Summary Native OSGi Did you miss Native-OSGi, Modular Software Development in a Native world by Alexander Broekhuis and Sascha Zelzer? Universal OSGi an RFP and a blog post by Peter Kriens in 2007. Apply OSGi techniques to native (C/C++) development. Simon Chemouil Universal Declarative Services
  • 5. Motivation Implementation Why modularity? Going Universal Service Components Summary An OSGi Architect Walks in a C++ Bar... Our C++ project going through re-architecture / refactoring Custom-made plugin system, limited. Plugins can't use each other C/C++ OSGi ports: Celix (Alexander), CppMicroServices (Sascha), SOF, CTK, nOSGi, . . . Yet no service component framework such as Declarative Services Simon Chemouil Universal Declarative Services
  • 6. Motivation Implementation Why modularity? Going Universal Service Components Summary Why a Service Component Framework? Services: powerful primitives, unpractical programming: Lack of structure Dynamic Service Components: Structure the services A nice semantic model to reason about dynamism Why is there no such framework for an OSGi C++ port: 1 Technical challenges 2 It was just not done yet! Simon Chemouil Universal Declarative Services
  • 7. Motivation Implementation Why modularity? Going Universal Service Components Summary Why Declarative Services? Many existing component frameworks for C++ Just as there were some for Java before DS No modularity Simple and matured component model A few years of personal experience Works with POJOs (or POCOs!) Components do not depend on the framework Makes them testable and easily reusable! Simon Chemouil Universal Declarative Services
  • 8. Motivation Implementation Why modularity? Going Universal Service Components Summary Does it make sense for C++? We use C++ for performance: Performance hit with component frameworks? We need extensibility and customization... Do we need modularity? Why use dierent architecture between Java and C++? What if we could talk about components, whatever the implementation language? Simon Chemouil Universal Declarative Services
  • 9. Motivation Implementation Challenges in C++ Going Universal Dening components Summary Getting started Native OSGi implementation: CppMicroServices is light, works with any shared library Inspired by PojoSR For C++! Bundles are called Modules: Native shared libraries: not archives. Moving to NativeOSGi later? Easy! Components are framework-agnostic! Simon Chemouil Universal Declarative Services
  • 10. Motivation Implementation Challenges in C++ Going Universal Dening components Summary Ingredients in Declarative Services Components are described in XML les in the bundle Service callbacks Dened in description Service arrival/departure Policy, Cardinality, Target Component callbacks Activation, modication, deactivation Simon Chemouil Universal Declarative Services
  • 11. Motivation Implementation Challenges in C++ Going Universal Dening components Summary Component Descriptions in C++ XML descriptions. . . We have native shared libraries, not JARs! Instead, we register a ComponentDescriptor instance to the ComponentManager service. The ComponentManager service is provided by the core Ds4Cpp framework. Simon Chemouil Universal Declarative Services
  • 12. Motivation Implementation Challenges in C++ Going Universal Dening components Summary Component Descriptions in C++ Denition class ComponentDescriptor { public : const s t r i n g c o m p o n e n t I d ; const s t r i n g i m p l S h a r e d O b j e c t ; const v e c t o r s t r i n g ∗ p r o v i d e d S e r v i c e s ; v e c t o r C o m p o n e n t R e f e r e n c e ∗ references ; const bool immediate ; const bool autoEnable ; } ; Simon Chemouil Universal Declarative Services
  • 13. Motivation Implementation Challenges in C++ Going Universal Dening components Summary Component Descriptions in C++ Let's see how it looks like in practice. . . Simon Chemouil Universal Declarative Services
  • 14. Motivation Implementation Challenges in C++ Going Universal Dening components Summary Extensible Hello World! Simon Chemouil Universal Declarative Services
  • 15. Motivation Implementation Challenges in C++ Going Universal Dening components Summary Component Descriptions in C++ Denition s t d : : v e c t o r ComponentReference ∗ r e f e r e n c e s = . . . ; r e f e r e n c e s −push_back ( ComponentReference ( greetdemo : : G r e e t P r o v i d e r , greetdemo : : G r e e t P r o v i d e r , s t d : : s t r i n g ( ) , ComponentReference : : DYNAMIC, ComponentReference : : MULTIPLE , ComponentReference : : OPTIONAL_REF) ) ; s t d : : v e c t o r s t d : : s t r i n g s e r v i c e s ; s e r v i c e s . push_back ( greetdemo : : GreetManager ) ; C o m p o n e n t D e s c r i p t o r ∗ componentDesc = new ds4cpp : : C o m p o n e n t D e s c r i p t o r ( greetdemo : : G r e e t M a n a g e r I m p l , , s e r v i c e s , ∗ r e f e r e n c e s , true , true ) ; Simon Chemouil Universal Declarative Services
  • 16. Motivation Implementation Challenges in C++ Going Universal Dening components Summary A Component in C++ Denition c l a s s G r e e t M a n a g e r I m p l : p u b l i c GreetManager { public : G r e e t M a n a g e r I m p l ( ) ; v i r t u a l ~G r e e t M a n a g e r I m p l ( ) ; void activate () ; void a d d G r e e t P r o v i d e r ( G r e e t P r o v i d e r ∗) ; void removeGreetProvider ( G r e e t P r o v i d e r ∗) ; // Service methods . s t r i n g g e t D e f a u l t T a r g e t ( c o n s t s t r i n g ) c o n s t ; s t r i n g g e t G r e e t i n g ( c o n s t s t r i n g , c o n s t s t r i n g ) const ; l i s t s t r i n g g e t A l l G r e e t i n g s ( c o n s t s t r i n g ) c o n s t ; l i s t s t r i n g g e t A v a i l a b l e L a n g u a g e s ( ) c o n s t ; }; Simon Chemouil Universal Declarative Services
  • 17. Motivation Implementation Challenges in C++ Going Universal Dening components Summary Service Callbacks in C++ (1/2) No reection/introspection! There are some limited libraries (e.g Reex). C++ name mangling We can't guess the binary name Instead, we force a convention in the C++ component: setRefName, unsetRefName for single dependencies addRefName, removeRefName for multiple dependencies Simon Chemouil Universal Declarative Services
  • 18. Motivation Implementation Challenges in C++ Going Universal Dening components Summary Service Callbacks in C++ (2/2) Our tools: dlopen/dlsym/dlclose (and Windows equivalents) Against us: C++ name mangling Solutions? Reection libraries: too limited, not dynamic. C++11 attributes (≈ Java annotations): still largely unsupported Qt meta-objects? Not bad! Yet need a custom preprocessor Still not modular (work in progress) How about C wrappers? Dicult to write manually, but provide universal ABI! Simon Chemouil Universal Declarative Services
  • 19. Motivation Implementation Challenges in C++ Going Universal Dening components Summary C Wrapper Denition e x t e r n C { DS_ABI_EXPORT GreetManagerImplWrapper ∗ __greetdemo__GreetManagerImpl__create ( ) { r e t u r n new GreetManagerImplWrapper ; } DS_ABI_EXPORT void __greetdemo__GreetManagerImpl__activate ( GreetManagerImplWrapper ∗ o b j e c t ) { o b j e c t − a c t i v a t e ( ) ; } DS_ABI_EXPORT void __greetdemo__GreetManagerImpl__add_greetdemo__GreetProvider ( GreetManagerImplWrapper ∗ o b j e c t , : : us : : Base ∗ s e r v i c e ) { greetdemo : : G r e e t P r o v i d e r ∗ l s e r v i c e = dynamic_cast greetdemo : : G r e e t P r o v i d e r ∗ ( s e r v i c e ) ; o b j e c t −a d d G r e e t P r o v i d e r ( l s e r v i c e ) ; } DS_ABI_EXPORT void __greetdemo__GreetManagerImpl__remove_greetdemo__GreetProvider ( GreetManagerImplWrapper ∗ o b j e c t , : : us : : Base ∗ s e r v i c e ) { greetdemo : : G r e e t P r o v i d e r ∗ l s e r v i c e = dynamic_cast greetdemo : : G r e e t P r o v i d e r ∗ ( s e r v i c e ) ; o b j e c t −r e m o v e G r e e t P r o v i d e r ( l s e r v i c e ) ; } } // e x t e r n C Simon Chemouil Universal Declarative Services
  • 20. Motivation Implementation Challenges in C++ Going Universal Dening components Summary It works! But. . . The proof-of-concept is successful: We have components wired dynamically OSGi's patterns work nicely (yet a bit more tricky) We support the use cases we need Dynamic arrival, thread-safety planned but unnished, service removal to do. But no one would write that wrapper code! Are there solutions to help us here? Simon Chemouil Universal Declarative Services
  • 22. Motivation Implementation Simpler Component Denitions Going Universal What's next? Summary C++ is too complex! Automatically generating the wrappers? Where to get the description? Macros? Parsing C++?! Xtext Java tooling to dene DSLs and compilers Generates an Eclipse editor! Uses EMF as backend, so more can be built upon. Simon Chemouil Universal Declarative Services
  • 23. Motivation Implementation Simpler Component Denitions Going Universal What's next? Summary Back to GreetManagerImpl! Denition component g r e e t d e m o . G r e e t M a n a g e r I m p l { provides { greetdemo . GreetManager } references { dynamic s e r v i c e greetdemo . G r e e t P r o v i d e r [0..n] } } Simon Chemouil Universal Declarative Services
  • 24. Motivation Implementation Simpler Component Denitions Going Universal What's next? Summary Dening multiple components Denition module DSDemo { name = DS G r e e t Demo version = 1.0.0 includes { greetdemo . E n g l i s h G r e e t P r o v i d e r greetdemo . F r e n c h G r e e t P r o v i d e r greetdemo . GreetManagerImpl greetdemo . C o n s o l e G r e e t e r } } Simon Chemouil Universal Declarative Services
  • 27. Motivation Implementation Simpler Component Denitions Going Universal What's next? Summary Improving our ADL The ADL we designed maps to Declarative Services' capabilities What about richer component models? Creating new target language back-ends Java/DS, Java/iPojo Making it extensible Simon Chemouil Universal Declarative Services
  • 28. Motivation Implementation Simpler Component Denitions Going Universal What's next? Summary Bridging Java and C++ Using Remote OSGi Services: An idea discussed in NativeOSGi. We expose C++ services where we can generate a Java interface Use JNI/JNA bindings or network. Basically, we bridge the two service registries! It does sound like CORBA Simon Chemouil Universal Declarative Services
  • 29. Motivation Implementation Simpler Component Denitions Going Universal What's next? Summary Creating UI Tools Textual DSLs are nice... But component diagrams are nicer! Up-to-date component metadata is extremely useful: Forces high-level design (round-trips between architects and developers) Allows code generation/rapid project bootstrapping Static analysis (code conformance) Can be used for SDK documentation. Long term project! Simon Chemouil Universal Declarative Services
  • 30. Motivation Implementation Conclusion Going Universal Summary Declarative Services for C++ We have been using Ds4Cpp for a few months! If you want to try it. . . you can! We just open sourced it (Apache Software License 2.0) https://github.com/Global-Vision-Systems/Ds4Cpp (the demo is packaged with it)! We need testers and eyes to x my bad C++ :-) And remove the limitations (talk to me!) Simon Chemouil Universal Declarative Services
  • 31. Motivation Implementation Conclusion Going Universal Summary Universal Components Tooling The tooling has still some rough edges Enough for our current needs. . . Some clean-up required. We have a roadmap for the improvements. Simon Chemouil Universal Declarative Services
  • 32. Motivation Implementation Conclusion Going Universal Summary Universal Declarative Services Questions? Twitter: @simach simon.chemouil@global-vision-systems.com Simon Chemouil Universal Declarative Services