SlideShare une entreprise Scribd logo
1  sur  49
Télécharger pour lire hors ligne
Automating Drupal
Development with Patterns
       David Rozas, Liao Hao and many others


  This work was partly supported by the Future and Emerging
  Technologies Programme (FP7-COSI-ICT) of the European
  Commission through the project QLectives (grant no.:231200).
A brief presentation of us...
David Rozas Domingo (drozas)

●   2+ years working with Drupal.

●   Recently joined CRESS (Centre for Research in Social
    Stimulation) at University of Surrey (UK).

●   Interest areas: free software, education and technology,
    distributed systems programming, CSCW, collaborative
    learning, socially intelligent information systems, …

●   +info: http://www.davidrozas.com
                         DrupalCamp Spain 2012
     20-10-2012                                            2
                            www.qlectives.eu
A brief presentation of us...
Liao Hao

●   1+ Years working with Drupal

●   Ph.D candidate in TIP Group(Theoretical Interdisciplinary
    Physics) of University of Fribourg, Switzerland




                         DrupalCamp Spain 2012
     20-10-2012                                          3
                            www.qlectives.eu
the others…

    Stefano Balietti (ETH)

    Xiao Rui 肖锐 (Uni Science & Tech. China)

    Dengcheng Yan 颜登程 (Uni Science & Tech. China)

    Matus Medo (Uni Fribourg)

    Zhou Yanbo 周艳波 (Uni Fribourg)

    Dirk Helbing (ETH)

    Vahe Tshitoyan (ETH)

    Vahan Hovhannisyan (ETH)

    Christoph Schwirzer (ETH)

    Christian Schulz (ETH)

    Sasa Tomic (ETH)

    Mark Jelasity (Uni Szeged)

    Kornél Csernai (Uni Szeged)

    Tamas Kojedzinszky (Uni Szeged)

    Nigel Gilbert (Uni Surrey)

    Alastair Gill (Uni Surrey)




                             DrupalCamp Spain 2012
20-10-2012                                           4
                                www.qlectives.eu
Outline
●
    The big picture: Qlectives and QScience
●
    Patterns:
    ●
        Patterns overview: components and Patterns
        files
    ●
        Differences between Patterns and other
        modules




                       DrupalCamp Spain 2012
20-10-2012                                           5
                          www.qlectives.eu
Outline
●
    Patterns:
    ●
        The Future?
    ●
        What can I do with Patterns?
    ●
        How can I do it?
    ●
        Future Work
●
    Demo
●
    Q&A


                           DrupalCamp Spain 2012
20-10-2012                                         6
                              www.qlectives.eu
The big picture: QLectives
●
    What is quality?

●
    If half a million people give a YouTube
    video the thumbs up, does that mean is
    good?

●
    Perhaps... but you would probably rather
    watch a recommendation from a friend

●
    Can we do it in a “P2P” way?
                   DrupalCamp Spain 2012
20-10-2012                                     7
                      www.qlectives.eu
The big picture: QLectives
●
    Take features of social networking to help
    groups of people share resources: from
    home videos to scientific papers

●
    Quality ratings in a distributed way




                    DrupalCamp Spain 2012
20-10-2012                                       8
                       www.qlectives.eu
The big picture: QLectives
Two application domains:

●
    QMedia: P2P media distribution fully
    decentralized

●
    QScience: distributed platform for
    scientists allowing them to locate or
    form new communities and quality
    reviewing mechanisms
                  DrupalCamp Spain 2012
20-10-2012                                  9
                     www.qlectives.eu
QScience: Science today
    From...




              Rembrandt, “A Scholar” (1631)

                    DrupalCamp Spain 2012
20-10-2012                                    11
                       www.qlectives.eu
QScience: Science today
To...




                                           Indexes of scientific
Trends discovery                               productivity


                   Communication

                   DrupalCamp Spain 2012
20-10-2012                                                 12
                      www.qlectives.eu
QScience: Science today




Community

                                      Networks


               Big Data


              DrupalCamp Spain 2012
20-10-2012                                       13
                 www.qlectives.eu
Can we have it all?

●
    Many software packages are available that fit
    one (or more) of those needs, but not all.

●
    QScience is an attempt to pull them all
    together in a modular fashion: a Drupal
    distribution

●
    EconoPhysics forum:
    ●
        http://www.unifr.ch/econophysics/ (old version)
    ●
        http://134.21.2.151/drupal-7.14/ (new Drupal version)

                               DrupalCamp Spain 2012
20-10-2012                                                      14
                                  www.qlectives.eu
QScience: contributing back
●
    Patterns: configuration management

●
    D2D (DrupalToDrupal): secure
    exchange of information between
    different Drupal instances (to be released
    soon)


●
    Living Science: Drupal based
    search and visualization tool            (to be
    released soon)
                     DrupalCamp Spain 2012
20-10-2012                                            15
                        www.qlectives.eu
QScience Patterns

●   What we want: reuse and share
    modules configuration

●   The main issue: configuration and
    data are mixed up in the DB



                  DrupalCamp Spain 2012
20-10-2012                                16
                     www.qlectives.eu
QScience Patterns




                  DrupalCamp Spain 2012
20-10-2012                                17
                     www.qlectives.eu
QScience Patterns

●   Patterns is built to bypass this bottleneck
    by managing and automating site
    configuration

●   Patterns' approach to solve it:

    ●   Components (“Software driver concept”)

    ●   Storage the configuration in files –
        decoupled architecture
                       DrupalCamp Spain 2012
20-10-2012                                        18
                          www.qlectives.eu
Patterns Components

                 Node Taxonomy             …       …




                 User



               Variables



                 …



                           DrupalCamp Spain 2012
20-10-2012                                             19
                              www.qlectives.eu
Patterns Components
●
    Each Drupal module can have a
    corresponding component, e.g. Blocks,
    Nodes, Taxonomy, Users, System settings.

●
    The component handles tasks directed at
    the module, acts much like a software
    driver.




                   DrupalCamp Spain 2012
20-10-2012                                     20
                      www.qlectives.eu
Patterns Components

●
    It has to define a set of hooks which are
    accessed by the Patterns core during the
    different phases: prepare, validate,
    callbacks, execution, cleanup...

●
    Actions are preprocessed and
    reformatted so that they can be the input
    of one or more Drupal forms.


                    DrupalCamp Spain 2012
20-10-2012                                      21
                       www.qlectives.eu
Patterns Overview




                  DrupalCamp Spain 2012
20-10-2012                                22
                     www.qlectives.eu
Patterns Files
●
    Store configuration in files

●
    There is not any dependency with any
    specific format: hook_patterns_parser():
    http://drupal.org/node/1545346

●
    Currently supported formats
    ●
      YAML: easy to read and write                     (human-readable
        data serialization format)
    ●
      XML: interoperability
    ●
      PHP arrays: performance
                               DrupalCamp Spain 2012
20-10-2012                                                               23
                                  www.qlectives.eu
Patterns Files: structure
●
    Divided in sections:

    ●
        Metadata: author, category,

    ●
        Sub-sections:
        ●
          Actions: create, modify, delete, include




                        DrupalCamp Spain 2012
20-10-2012                                           24
                           www.qlectives.eu
Patterns Files
  ●   Demo: taking a look to a couple of
      patterns examples in YAML




                      DrupalCamp Spain 2012
20-10-2012                                    25
                         www.qlectives.eu
So, what ¡s the difference
              between Patterns and...?

     ●   Distribution/Installation Profile:

         ●   Granularity: the configuration can be
             split into smaller definitions

         ●   Simplicity: easier to write YAML files
             than an installation profile

         ●   Can be used in existing sites

                          DrupalCamp Spain 2012
20-10-2012                                            26
                             www.qlectives.eu
So, what ¡s the difference
              between Patterns and...?

     ●   Features+Strongarm:

         ●   Paradigm: Features is 'use case
             oriented', Patterns is 'CM oriented'
             (Interesting blog post from Tom Friedhof about this
             at http://activelamp.com/blog/new-way-manage-
             configuration-your-site)




                             DrupalCamp Spain 2012
20-10-2012                                                         27
                                www.qlectives.eu
So, what ¡s the difference
              between Patterns and...?

     ●   Features+Strongarm:
             “Don’t get me wrong, I love the features module, but I have to
             admit that I’ve run into my share of issues using features module
             for configuration management and deployment. Fortunately
             others in the community have ran into these issues too and have
             released modules such as features override, features plumber,
             and Features Tools. Not to mention entire workflows have been
             created around how to use Features to manage configuration for
             deployment that don’t even come close to creating KIT compliant
             features. Features module is really being misused, it’s not
             being used to create features, it’s being used to manage
             configuration and deployment.”

                     Tom Friedhof (“A new way to manage configuration on your site”)


                                   DrupalCamp Spain 2012
20-10-2012                                                                             28
                                      www.qlectives.eu
So, what ¡s the difference
              between Patterns and...?

     ●   Features+Strongarm:

         ●   Storage: Features stores the
             configuration in Drupal modules,
             patterns stores it in files as D8 will
             (see D8 Config Management Initiative)




                             DrupalCamp Spain 2012
20-10-2012                                            29
                                www.qlectives.eu
So, what ¡s the difference
              between Patterns and...?

     ●   Features+Strongarm :

         ●   Implementation: Features uses module specific
             APIs (e.g: Views API), Patterns uses mostly FAPI
             (although can use specific ones as well).

             ●   The “trick” is drupal_form_submit()

             ●   Advantage: Validation for free!

             ●   Disadvantage: Performance

                               DrupalCamp Spain 2012
20-10-2012                                                      30
                                  www.qlectives.eu
The future...?




                DrupalCamp Spain 2012
20-10-2012                              31
                   www.qlectives.eu
The future...?




                DrupalCamp Spain 2012
30.03.2012                              32
                   www.qlectives.eu
The future...?
●   Configuration Management Initiative (D8):
    ●   http://groups.drupal.org/build-systems-change-management/cmi

    ●   http://drupal.org/community-initiatives/drupal-core#cmi

●   Can Patterns concepts be useful for it?. Proof
    of concept?




                               DrupalCamp Spain 2012
20-10-2012                                                             33
                                  www.qlectives.eu
The future...?

 Posted by laurencefass on October 5, 2012 at 12:45pm

 The CM management for Drupal 8 is being backported to D7 in the CM
 module, and (apparently) features is going to be re-written on top of it.
 From what I understand (so far) Patterns looks more suited to the
 configuration management use case and source control than
 Features (in its present form as it was not intended for CM).
 Patterns may already provide some of the solutions proposed
 Features/CM integration.
 […]

                                     http://groups.drupal.org/node/259013




                           DrupalCamp Spain 2012
20-10-2012                                                            34
                              www.qlectives.eu
Ok... so what can I do with
         Patterns for the moment?

    Module ported from D6 to D7:
    ●
        From spaghetti code to modular code
    ●
        Improved GUI
    ●
        Drush support
    ●
        Added automatic export API
    ●
        Parser Module
    ●
        Simple test battery
    ●
        More powerful syntax
    ●
        Include patterns
    ●
        Settings page
    ●
        Patterns D2D

                        DrupalCamp Spain 2012
20-10-2012                                      35
                           www.qlectives.eu
Ok... so what can I do with
         Patterns for the moment?

    Components already developed for:
    ●
        Content Types
    ●
        Fields
    ●
        Menus, Menu Items
    ●
        Blocks
    ●
        Content
    ●
        Users
    ●
        Vocabularies, Terms
    ●
        Pathauto
    ●
        System settings (eg.: enable modules)
    ●
        Permissions/Roles
    ●
        Color
    ●
        Toolbar and Shortcut




                              DrupalCamp Spain 2012
20-10-2012                                            36
                                 www.qlectives.eu
Ok... so what can I do with
          Patterns for the moment?

    First Release Candidate: 7.x-1.0-rc1 (Sept. 9th)


    Write or re-use patterns using the already
    developed components


    Share your patterns (set public patterns page)


    Make your module “Patterns Ready”




                      DrupalCamp Spain 2012
    20-10-2012                                         37
                         www.qlectives.eu
How to make a module
              “Patterns Ready”?

    You need to implement hook_patterns to
    declare which actions your module is able to
    handle:




                      DrupalCamp Spain 2012
    20-10-2012                                     38
                         www.qlectives.eu
Patterns Execution Flow




Source: https://github.com/QScience/patterns-flowcharts/blob/master/running-pattern-workflow.dia


                                    DrupalCamp Spain 2012
20-10-2012                                                                                 39
                                       www.qlectives.eu
How to make a module
              “Patterns Ready”?

    Hooks available to interact on each phase:
    ●
        hook_patterns_prepare($action, $tag, &$data)

    ●
        hook_patterns_validate($action, $tag, &$data)

    ●
        hook_patterns_callbacks($action, $tag, &$data)

    ●
        hook_patterns_build($action, $form_id, &$data, &$action_state)

    ●
        hook_patterns_params($action, $form_id, &$data &$action_state)

    ●
        hook_patterns_cleanup($action, $tag, &$data)



                               DrupalCamp Spain 2012
    20-10-2012                                                           40
                                  www.qlectives.eu
How to make the settings
           exportable?


    You need to declare in hook_patterns() a
    function that will gather the data


    Write that function: can be more or less
    complex depending on the component




                    DrupalCamp Spain 2012
20-10-2012                                     41
                       www.qlectives.eu
How to make the settings
          exportable?




             DrupalCamp Spain 2012
20-10-2012                           42
                www.qlectives.eu
Future Work

    Improve the automatic extraction of
    configuration (pattern files): WIP

    ●
        Issues with some core components (e.g.:
        block)

    ●
        The extracted patterns may require minor
        corrections



                      DrupalCamp Spain 2012
20-10-2012                                         43
                         www.qlectives.eu
Future Work

    Write components for QScience custom
    modules


    Write components for the most important
    contrib modules:
     ●
       Views
     ●
       Rules
     ●
       OG
     ●
       Context
     ●
       ...
                   DrupalCamp Spain 2012
20-10-2012                                    44
                      www.qlectives.eu
Future Work

    Documentation (D7):
    ●
      Almost 30 pages already published at
      Drupal.org:
      http://drupal.org/node/1464118

    ●
        Patterns guide: “Step by Step tour on the
        code”: WIP, to be released very soon

    ●
        Screencasts, more tutorials, etc.


                       DrupalCamp Spain 2012
20-10-2012                                          45
                          www.qlectives.eu
Ideas

    E.g.:Collect Statistics about “the most
    popular patterns”...
    ●
      Possible to do it in a P2P way?/
    ●
      Drupal2Drupal module?


    Thanks for your
    ideas/suggestions/patches!


    Patterns group at:
    http://groups.drupal.org/patterns
                     DrupalCamp Spain 2012
20-10-2012                                    46
                        www.qlectives.eu
Time for the demo!




                  DrupalCamp Spain 2012
20-10-2012                                47
                     www.qlectives.eu
Links

    Qlectives:

    ●
        Main site: http://www.qlectives.eu/

    ●
        Deliverable 4.2.3:
        http://www.qlectives.eu/wiki/images/9/91/Qd4-2-3.pdf

    ●
        Econophysics Forum:
        http://www.unifr.ch/econophysics/




                             DrupalCamp Spain 2012
20-10-2012                                                 48
                                www.qlectives.eu
Links

    Patterns:

    ●
        Main Page: http://drupal.org/project/patterns

    ●
        Documentation: http://drupal.org/node/346509

    ●
        Group: http://groups.drupal.org/patterns


    Configuration Management Initiative:
    ●
        http://groups.drupal.org/build-systems-change-management/cmi

    ●
        http://drupal.org/community-initiatives/drupal-core#cmi

                               DrupalCamp Spain 2012
20-10-2012                                                             49
                                  www.qlectives.eu
Thanks!
                                         謝謝
             ¡Gracias!
                 DrupalCamp Spain 2012
20-10-2012                                50
                    www.qlectives.eu

Contenu connexe

Similaire à Automating Drupal Development with Patterns

Similaire à Automating Drupal Development with Patterns (20)

Drupal 7: More than a simple CMS
Drupal 7: More than a simple CMSDrupal 7: More than a simple CMS
Drupal 7: More than a simple CMS
 
ESUP-Portail: A Global Approach of Digital Services for Higher Education in F...
ESUP-Portail: A Global Approach of Digital Services for Higher Education in F...ESUP-Portail: A Global Approach of Digital Services for Higher Education in F...
ESUP-Portail: A Global Approach of Digital Services for Higher Education in F...
 
Choosing Drupal as your Content Management Framework
Choosing Drupal as your Content Management FrameworkChoosing Drupal as your Content Management Framework
Choosing Drupal as your Content Management Framework
 
Drupal
DrupalDrupal
Drupal
 
LITA Preconference: Getting Started with Drupal (handout)
LITA Preconference: Getting Started with Drupal (handout)LITA Preconference: Getting Started with Drupal (handout)
LITA Preconference: Getting Started with Drupal (handout)
 
OCCIware, a formal framework for Everything as a Service. OW2con'15, November...
OCCIware, a formal framework for Everything as a Service. OW2con'15, November...OCCIware, a formal framework for Everything as a Service. OW2con'15, November...
OCCIware, a formal framework for Everything as a Service. OW2con'15, November...
 
OCCIware, a formal framework for Everything as a Service. OW2con'15, November...
OCCIware, a formal framework for Everything as a Service. OW2con'15, November...OCCIware, a formal framework for Everything as a Service. OW2con'15, November...
OCCIware, a formal framework for Everything as a Service. OW2con'15, November...
 
devops@cineca
devops@cinecadevops@cineca
devops@cineca
 
The State of Drupal in Higher Education
The State of Drupal in Higher EducationThe State of Drupal in Higher Education
The State of Drupal in Higher Education
 
OCCIware & Linked Data prototype OW2Con@POSS
OCCIware & Linked Data prototype OW2Con@POSSOCCIware & Linked Data prototype OW2Con@POSS
OCCIware & Linked Data prototype OW2Con@POSS
 
DrupalCon Chicago 2011 ReportBack (11/03/30 - G. Bedford)
DrupalCon Chicago 2011 ReportBack (11/03/30 - G. Bedford)DrupalCon Chicago 2011 ReportBack (11/03/30 - G. Bedford)
DrupalCon Chicago 2011 ReportBack (11/03/30 - G. Bedford)
 
What is Drupal Ladder?
What is Drupal Ladder?What is Drupal Ladder?
What is Drupal Ladder?
 
[HKDUG] #20151017 - BarCamp 2015 - Drupal 8 is Coming! Are You Ready?
[HKDUG] #20151017 - BarCamp 2015 - Drupal 8 is Coming! Are You Ready?[HKDUG] #20151017 - BarCamp 2015 - Drupal 8 is Coming! Are You Ready?
[HKDUG] #20151017 - BarCamp 2015 - Drupal 8 is Coming! Are You Ready?
 
Basic Views
Basic ViewsBasic Views
Basic Views
 
LOD2 Webinar: UnifiedViews
LOD2 Webinar: UnifiedViewsLOD2 Webinar: UnifiedViews
LOD2 Webinar: UnifiedViews
 
Extending DCAM for Metadata Provenance
Extending DCAM for Metadata ProvenanceExtending DCAM for Metadata Provenance
Extending DCAM for Metadata Provenance
 
Drupal for beginners - Global Training Days - Cebu 2016
Drupal for beginners - Global Training Days - Cebu 2016Drupal for beginners - Global Training Days - Cebu 2016
Drupal for beginners - Global Training Days - Cebu 2016
 
What we're doing with DITA at NXP
What we're doing with DITA at NXPWhat we're doing with DITA at NXP
What we're doing with DITA at NXP
 
Drupal 7 - More than a Simple CMS
Drupal 7 - More than a Simple CMSDrupal 7 - More than a Simple CMS
Drupal 7 - More than a Simple CMS
 
Continuous Intelligence: Keeping your AI Application in Production
Continuous Intelligence: Keeping your AI Application in ProductionContinuous Intelligence: Keeping your AI Application in Production
Continuous Intelligence: Keeping your AI Application in Production
 

Plus de David Rozas

Plus de David Rozas (20)

When Ostrom Meets Blockchain: Exploring the Potentials of Blockchain for Com...
 When Ostrom Meets Blockchain: Exploring the Potentials of Blockchain for Com... When Ostrom Meets Blockchain: Exploring the Potentials of Blockchain for Com...
When Ostrom Meets Blockchain: Exploring the Potentials of Blockchain for Com...
 
When Ostrom Meets Blockchain: Exploring the Potentials of Blockchain for Comm...
When Ostrom Meets Blockchain: Exploring the Potentials of Blockchain for Comm...When Ostrom Meets Blockchain: Exploring the Potentials of Blockchain for Comm...
When Ostrom Meets Blockchain: Exploring the Potentials of Blockchain for Comm...
 
Cuando Ostrom se encuentra con blockchain: explorando las potencialidades de ...
Cuando Ostrom se encuentra con blockchain: explorando las potencialidades de ...Cuando Ostrom se encuentra con blockchain: explorando las potencialidades de ...
Cuando Ostrom se encuentra con blockchain: explorando las potencialidades de ...
 
When Ostrom Meets Blockchain: Exploring the Potentials of Blockchain for Comm...
When Ostrom Meets Blockchain: Exploring the Potentials of Blockchain for Comm...When Ostrom Meets Blockchain: Exploring the Potentials of Blockchain for Comm...
When Ostrom Meets Blockchain: Exploring the Potentials of Blockchain for Comm...
 
Ostrom’s crypto-principles? Towards a commons-based approach for the use of B...
Ostrom’s crypto-principles? Towards a commons-based approach for the use of B...Ostrom’s crypto-principles? Towards a commons-based approach for the use of B...
Ostrom’s crypto-principles? Towards a commons-based approach for the use of B...
 
Self-organisation in Commons-Based Peer Production. Drupal: “the drop is alwa...
Self-organisation in Commons-Based Peer Production. Drupal: “the drop is alwa...Self-organisation in Commons-Based Peer Production. Drupal: “the drop is alwa...
Self-organisation in Commons-Based Peer Production. Drupal: “the drop is alwa...
 
Self-organisation in Commons-Based Peer Production. Drupal: “the drop is alwa...
Self-organisation in Commons-Based Peer Production. Drupal: “the drop is alwa...Self-organisation in Commons-Based Peer Production. Drupal: “the drop is alwa...
Self-organisation in Commons-Based Peer Production. Drupal: “the drop is alwa...
 
Drupal: the drop is always moving. Autogestión y gobernanza de infraestructur...
Drupal: the drop is always moving. Autogestión y gobernanza de infraestructur...Drupal: the drop is always moving. Autogestión y gobernanza de infraestructur...
Drupal: the drop is always moving. Autogestión y gobernanza de infraestructur...
 
Drupal: "come for the software, stay for the community". Conociendo la comunidad
Drupal: "come for the software, stay for the community". Conociendo la comunidadDrupal: "come for the software, stay for the community". Conociendo la comunidad
Drupal: "come for the software, stay for the community". Conociendo la comunidad
 
Talk is silver, code is gold? Contribution beyond source code in Free/Libre O...
Talk is silver, code is gold? Contribution beyond source code in Free/Libre O...Talk is silver, code is gold? Contribution beyond source code in Free/Libre O...
Talk is silver, code is gold? Contribution beyond source code in Free/Libre O...
 
Quantitative Methods II (#SOC2031). Seminar #11: Secondary analysis. Big data...
Quantitative Methods II (#SOC2031). Seminar #11: Secondary analysis. Big data...Quantitative Methods II (#SOC2031). Seminar #11: Secondary analysis. Big data...
Quantitative Methods II (#SOC2031). Seminar #11: Secondary analysis. Big data...
 
Talk is silver, code is gold? Contribution beyond source code in Free/Libre O...
Talk is silver, code is gold? Contribution beyond source code in Free/Libre O...Talk is silver, code is gold? Contribution beyond source code in Free/Libre O...
Talk is silver, code is gold? Contribution beyond source code in Free/Libre O...
 
Talk is silver, code is gold? Contribution beyond source code in Free/Libre O...
Talk is silver, code is gold? Contribution beyond source code in Free/Libre O...Talk is silver, code is gold? Contribution beyond source code in Free/Libre O...
Talk is silver, code is gold? Contribution beyond source code in Free/Libre O...
 
Lightning talk - Affective labour and the notion of contribution in FLOSS com...
Lightning talk - Affective labour and the notion of contribution in FLOSS com...Lightning talk - Affective labour and the notion of contribution in FLOSS com...
Lightning talk - Affective labour and the notion of contribution in FLOSS com...
 
Directori català de l’economia col·laborativa
Directori català de l’economia col·laborativaDirectori català de l’economia col·laborativa
Directori català de l’economia col·laborativa
 
Survey Research (SOC2029). Seminar 10: non-response and missing data
Survey Research (SOC2029). Seminar 10: non-response and missing dataSurvey Research (SOC2029). Seminar 10: non-response and missing data
Survey Research (SOC2029). Seminar 10: non-response and missing data
 
Survey Research (SOC2029). Seminar 9: designing a self-completion questionnaire
Survey Research (SOC2029). Seminar 9: designing a self-completion questionnaireSurvey Research (SOC2029). Seminar 9: designing a self-completion questionnaire
Survey Research (SOC2029). Seminar 9: designing a self-completion questionnaire
 
Survey Research (SOC2029). Seminar 8: formulating a research question
Survey Research (SOC2029). Seminar 8: formulating a research questionSurvey Research (SOC2029). Seminar 8: formulating a research question
Survey Research (SOC2029). Seminar 8: formulating a research question
 
Survey Research (SOC2029). Seminar 7: ethics in survey research
Survey Research (SOC2029). Seminar 7: ethics in survey researchSurvey Research (SOC2029). Seminar 7: ethics in survey research
Survey Research (SOC2029). Seminar 7: ethics in survey research
 
Survey Research (SOC2029). Seminar 6: questionnaire design (II)
Survey Research (SOC2029). Seminar 6: questionnaire design (II) Survey Research (SOC2029). Seminar 6: questionnaire design (II)
Survey Research (SOC2029). Seminar 6: questionnaire design (II)
 

Dernier

CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Dernier (20)

What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 

Automating Drupal Development with Patterns

  • 1. Automating Drupal Development with Patterns David Rozas, Liao Hao and many others This work was partly supported by the Future and Emerging Technologies Programme (FP7-COSI-ICT) of the European Commission through the project QLectives (grant no.:231200).
  • 2. A brief presentation of us... David Rozas Domingo (drozas) ● 2+ years working with Drupal. ● Recently joined CRESS (Centre for Research in Social Stimulation) at University of Surrey (UK). ● Interest areas: free software, education and technology, distributed systems programming, CSCW, collaborative learning, socially intelligent information systems, … ● +info: http://www.davidrozas.com DrupalCamp Spain 2012 20-10-2012 2 www.qlectives.eu
  • 3. A brief presentation of us... Liao Hao ● 1+ Years working with Drupal ● Ph.D candidate in TIP Group(Theoretical Interdisciplinary Physics) of University of Fribourg, Switzerland DrupalCamp Spain 2012 20-10-2012 3 www.qlectives.eu
  • 4. the others…  Stefano Balietti (ETH)  Xiao Rui 肖锐 (Uni Science & Tech. China)  Dengcheng Yan 颜登程 (Uni Science & Tech. China)  Matus Medo (Uni Fribourg)  Zhou Yanbo 周艳波 (Uni Fribourg)  Dirk Helbing (ETH)  Vahe Tshitoyan (ETH)  Vahan Hovhannisyan (ETH)  Christoph Schwirzer (ETH)  Christian Schulz (ETH)  Sasa Tomic (ETH)  Mark Jelasity (Uni Szeged)  Kornél Csernai (Uni Szeged)  Tamas Kojedzinszky (Uni Szeged)  Nigel Gilbert (Uni Surrey)  Alastair Gill (Uni Surrey) DrupalCamp Spain 2012 20-10-2012 4 www.qlectives.eu
  • 5. Outline ● The big picture: Qlectives and QScience ● Patterns: ● Patterns overview: components and Patterns files ● Differences between Patterns and other modules DrupalCamp Spain 2012 20-10-2012 5 www.qlectives.eu
  • 6. Outline ● Patterns: ● The Future? ● What can I do with Patterns? ● How can I do it? ● Future Work ● Demo ● Q&A DrupalCamp Spain 2012 20-10-2012 6 www.qlectives.eu
  • 7. The big picture: QLectives ● What is quality? ● If half a million people give a YouTube video the thumbs up, does that mean is good? ● Perhaps... but you would probably rather watch a recommendation from a friend ● Can we do it in a “P2P” way? DrupalCamp Spain 2012 20-10-2012 7 www.qlectives.eu
  • 8. The big picture: QLectives ● Take features of social networking to help groups of people share resources: from home videos to scientific papers ● Quality ratings in a distributed way DrupalCamp Spain 2012 20-10-2012 8 www.qlectives.eu
  • 9. The big picture: QLectives Two application domains: ● QMedia: P2P media distribution fully decentralized ● QScience: distributed platform for scientists allowing them to locate or form new communities and quality reviewing mechanisms DrupalCamp Spain 2012 20-10-2012 9 www.qlectives.eu
  • 10. QScience: Science today From... Rembrandt, “A Scholar” (1631) DrupalCamp Spain 2012 20-10-2012 11 www.qlectives.eu
  • 11. QScience: Science today To... Indexes of scientific Trends discovery productivity Communication DrupalCamp Spain 2012 20-10-2012 12 www.qlectives.eu
  • 12. QScience: Science today Community Networks Big Data DrupalCamp Spain 2012 20-10-2012 13 www.qlectives.eu
  • 13. Can we have it all? ● Many software packages are available that fit one (or more) of those needs, but not all. ● QScience is an attempt to pull them all together in a modular fashion: a Drupal distribution ● EconoPhysics forum: ● http://www.unifr.ch/econophysics/ (old version) ● http://134.21.2.151/drupal-7.14/ (new Drupal version) DrupalCamp Spain 2012 20-10-2012 14 www.qlectives.eu
  • 14. QScience: contributing back ● Patterns: configuration management ● D2D (DrupalToDrupal): secure exchange of information between different Drupal instances (to be released soon) ● Living Science: Drupal based search and visualization tool (to be released soon) DrupalCamp Spain 2012 20-10-2012 15 www.qlectives.eu
  • 15. QScience Patterns ● What we want: reuse and share modules configuration ● The main issue: configuration and data are mixed up in the DB DrupalCamp Spain 2012 20-10-2012 16 www.qlectives.eu
  • 16. QScience Patterns DrupalCamp Spain 2012 20-10-2012 17 www.qlectives.eu
  • 17. QScience Patterns ● Patterns is built to bypass this bottleneck by managing and automating site configuration ● Patterns' approach to solve it: ● Components (“Software driver concept”) ● Storage the configuration in files – decoupled architecture DrupalCamp Spain 2012 20-10-2012 18 www.qlectives.eu
  • 18. Patterns Components Node Taxonomy … … User Variables … DrupalCamp Spain 2012 20-10-2012 19 www.qlectives.eu
  • 19. Patterns Components ● Each Drupal module can have a corresponding component, e.g. Blocks, Nodes, Taxonomy, Users, System settings. ● The component handles tasks directed at the module, acts much like a software driver. DrupalCamp Spain 2012 20-10-2012 20 www.qlectives.eu
  • 20. Patterns Components ● It has to define a set of hooks which are accessed by the Patterns core during the different phases: prepare, validate, callbacks, execution, cleanup... ● Actions are preprocessed and reformatted so that they can be the input of one or more Drupal forms. DrupalCamp Spain 2012 20-10-2012 21 www.qlectives.eu
  • 21. Patterns Overview DrupalCamp Spain 2012 20-10-2012 22 www.qlectives.eu
  • 22. Patterns Files ● Store configuration in files ● There is not any dependency with any specific format: hook_patterns_parser(): http://drupal.org/node/1545346 ● Currently supported formats ● YAML: easy to read and write (human-readable data serialization format) ● XML: interoperability ● PHP arrays: performance DrupalCamp Spain 2012 20-10-2012 23 www.qlectives.eu
  • 23. Patterns Files: structure ● Divided in sections: ● Metadata: author, category, ● Sub-sections: ● Actions: create, modify, delete, include DrupalCamp Spain 2012 20-10-2012 24 www.qlectives.eu
  • 24. Patterns Files ● Demo: taking a look to a couple of patterns examples in YAML DrupalCamp Spain 2012 20-10-2012 25 www.qlectives.eu
  • 25. So, what ¡s the difference between Patterns and...? ● Distribution/Installation Profile: ● Granularity: the configuration can be split into smaller definitions ● Simplicity: easier to write YAML files than an installation profile ● Can be used in existing sites DrupalCamp Spain 2012 20-10-2012 26 www.qlectives.eu
  • 26. So, what ¡s the difference between Patterns and...? ● Features+Strongarm: ● Paradigm: Features is 'use case oriented', Patterns is 'CM oriented' (Interesting blog post from Tom Friedhof about this at http://activelamp.com/blog/new-way-manage- configuration-your-site) DrupalCamp Spain 2012 20-10-2012 27 www.qlectives.eu
  • 27. So, what ¡s the difference between Patterns and...? ● Features+Strongarm: “Don’t get me wrong, I love the features module, but I have to admit that I’ve run into my share of issues using features module for configuration management and deployment. Fortunately others in the community have ran into these issues too and have released modules such as features override, features plumber, and Features Tools. Not to mention entire workflows have been created around how to use Features to manage configuration for deployment that don’t even come close to creating KIT compliant features. Features module is really being misused, it’s not being used to create features, it’s being used to manage configuration and deployment.” Tom Friedhof (“A new way to manage configuration on your site”) DrupalCamp Spain 2012 20-10-2012 28 www.qlectives.eu
  • 28. So, what ¡s the difference between Patterns and...? ● Features+Strongarm: ● Storage: Features stores the configuration in Drupal modules, patterns stores it in files as D8 will (see D8 Config Management Initiative) DrupalCamp Spain 2012 20-10-2012 29 www.qlectives.eu
  • 29. So, what ¡s the difference between Patterns and...? ● Features+Strongarm : ● Implementation: Features uses module specific APIs (e.g: Views API), Patterns uses mostly FAPI (although can use specific ones as well). ● The “trick” is drupal_form_submit() ● Advantage: Validation for free! ● Disadvantage: Performance DrupalCamp Spain 2012 20-10-2012 30 www.qlectives.eu
  • 30. The future...? DrupalCamp Spain 2012 20-10-2012 31 www.qlectives.eu
  • 31. The future...? DrupalCamp Spain 2012 30.03.2012 32 www.qlectives.eu
  • 32. The future...? ● Configuration Management Initiative (D8): ● http://groups.drupal.org/build-systems-change-management/cmi ● http://drupal.org/community-initiatives/drupal-core#cmi ● Can Patterns concepts be useful for it?. Proof of concept? DrupalCamp Spain 2012 20-10-2012 33 www.qlectives.eu
  • 33. The future...? Posted by laurencefass on October 5, 2012 at 12:45pm The CM management for Drupal 8 is being backported to D7 in the CM module, and (apparently) features is going to be re-written on top of it. From what I understand (so far) Patterns looks more suited to the configuration management use case and source control than Features (in its present form as it was not intended for CM). Patterns may already provide some of the solutions proposed Features/CM integration. […] http://groups.drupal.org/node/259013 DrupalCamp Spain 2012 20-10-2012 34 www.qlectives.eu
  • 34. Ok... so what can I do with Patterns for the moment?  Module ported from D6 to D7: ● From spaghetti code to modular code ● Improved GUI ● Drush support ● Added automatic export API ● Parser Module ● Simple test battery ● More powerful syntax ● Include patterns ● Settings page ● Patterns D2D DrupalCamp Spain 2012 20-10-2012 35 www.qlectives.eu
  • 35. Ok... so what can I do with Patterns for the moment?  Components already developed for: ● Content Types ● Fields ● Menus, Menu Items ● Blocks ● Content ● Users ● Vocabularies, Terms ● Pathauto ● System settings (eg.: enable modules) ● Permissions/Roles ● Color ● Toolbar and Shortcut DrupalCamp Spain 2012 20-10-2012 36 www.qlectives.eu
  • 36. Ok... so what can I do with Patterns for the moment?  First Release Candidate: 7.x-1.0-rc1 (Sept. 9th)  Write or re-use patterns using the already developed components  Share your patterns (set public patterns page)  Make your module “Patterns Ready” DrupalCamp Spain 2012 20-10-2012 37 www.qlectives.eu
  • 37. How to make a module “Patterns Ready”?  You need to implement hook_patterns to declare which actions your module is able to handle: DrupalCamp Spain 2012 20-10-2012 38 www.qlectives.eu
  • 38. Patterns Execution Flow Source: https://github.com/QScience/patterns-flowcharts/blob/master/running-pattern-workflow.dia DrupalCamp Spain 2012 20-10-2012 39 www.qlectives.eu
  • 39. How to make a module “Patterns Ready”?  Hooks available to interact on each phase: ● hook_patterns_prepare($action, $tag, &$data) ● hook_patterns_validate($action, $tag, &$data) ● hook_patterns_callbacks($action, $tag, &$data) ● hook_patterns_build($action, $form_id, &$data, &$action_state) ● hook_patterns_params($action, $form_id, &$data &$action_state) ● hook_patterns_cleanup($action, $tag, &$data) DrupalCamp Spain 2012 20-10-2012 40 www.qlectives.eu
  • 40. How to make the settings exportable?  You need to declare in hook_patterns() a function that will gather the data  Write that function: can be more or less complex depending on the component DrupalCamp Spain 2012 20-10-2012 41 www.qlectives.eu
  • 41. How to make the settings exportable? DrupalCamp Spain 2012 20-10-2012 42 www.qlectives.eu
  • 42. Future Work  Improve the automatic extraction of configuration (pattern files): WIP ● Issues with some core components (e.g.: block) ● The extracted patterns may require minor corrections DrupalCamp Spain 2012 20-10-2012 43 www.qlectives.eu
  • 43. Future Work  Write components for QScience custom modules  Write components for the most important contrib modules: ● Views ● Rules ● OG ● Context ● ... DrupalCamp Spain 2012 20-10-2012 44 www.qlectives.eu
  • 44. Future Work  Documentation (D7): ● Almost 30 pages already published at Drupal.org: http://drupal.org/node/1464118 ● Patterns guide: “Step by Step tour on the code”: WIP, to be released very soon ● Screencasts, more tutorials, etc. DrupalCamp Spain 2012 20-10-2012 45 www.qlectives.eu
  • 45. Ideas  E.g.:Collect Statistics about “the most popular patterns”... ● Possible to do it in a P2P way?/ ● Drupal2Drupal module?  Thanks for your ideas/suggestions/patches!  Patterns group at: http://groups.drupal.org/patterns DrupalCamp Spain 2012 20-10-2012 46 www.qlectives.eu
  • 46. Time for the demo! DrupalCamp Spain 2012 20-10-2012 47 www.qlectives.eu
  • 47. Links  Qlectives: ● Main site: http://www.qlectives.eu/ ● Deliverable 4.2.3: http://www.qlectives.eu/wiki/images/9/91/Qd4-2-3.pdf ● Econophysics Forum: http://www.unifr.ch/econophysics/ DrupalCamp Spain 2012 20-10-2012 48 www.qlectives.eu
  • 48. Links  Patterns: ● Main Page: http://drupal.org/project/patterns ● Documentation: http://drupal.org/node/346509 ● Group: http://groups.drupal.org/patterns  Configuration Management Initiative: ● http://groups.drupal.org/build-systems-change-management/cmi ● http://drupal.org/community-initiatives/drupal-core#cmi DrupalCamp Spain 2012 20-10-2012 49 www.qlectives.eu
  • 49. Thanks! 謝謝 ¡Gracias! DrupalCamp Spain 2012 20-10-2012 50 www.qlectives.eu