introduction to new technologies in drupal 8

30
NEW TECHNOLOGIES IN DRUPAL 8 / Camilla Krag Jensen @naxoc

Upload: naxoc

Post on 30-Nov-2014

808 views

Category:

Technology


4 download

DESCRIPTION

Symfony, Twig, Backbone, Guzzle. What are these things? A lot of new libraries and technologies have been added to Drupal 8. This session will go through the new libraries and provide a brief introduction to them by looking at some history, and the effects of including them in Drupal. This will be a high-level introduction - not a deep technical walkthrough. It is suitable for everyone, regardless of skill level, who is interested in the building blocks of Drupal 8.

TRANSCRIPT

Page 1: Introduction to new technologies in drupal 8

NEW TECHNOLOGIES INDRUPAL 8

/ Camilla Krag Jensen @naxoc

Page 2: Introduction to new technologies in drupal 8

WHO?Camilla Krag Jensen. @naxoc

I have been doing Drupal for 5 years.

You guys?

I work at

Page 3: Introduction to new technologies in drupal 8

WHAT IS GOING ON IN THIS TALK?What is an external library?

Some history through Drupal releases.

For most of the new libraries - a short description.

Page 4: Introduction to new technologies in drupal 8

AN EXTERNAL LIBRARYCode that lives somewhere else than on d.o. and is maintainedby people that are not nescessarily drupal people.

Can be used by other projects and benefit from collaborationfrom a lot of people.

In D8 - anything that lives in /vendor or /assets/vendor.

Page 5: Introduction to new technologies in drupal 8

DRUPAL 4.7RELEASED IN MAY 2006

There were no external libraries apart from a forked version ofThe Incutio XML-RPC Library

We knew how to do things best ourselves

Page 6: Introduction to new technologies in drupal 8

AS FOR JAVASCRIPT: THERE WAS VERY LITTLE» find . -name "*.js" ./misc/autocomplete.js./misc/collapse.js./misc/drupal.js./misc/progress.js./misc/textarea.js./misc/update.js./misc/upload.js

Page 7: Introduction to new technologies in drupal 8

DRUPAL 5RELEASED IN JANUARY 2007

2 external libraries were added to Drupal.

One was really important - the other one not so much.

Page 8: Introduction to new technologies in drupal 8

JQUERY!

Write less, do more.

Javascript tools with a really active community.

Everybody agreed that it was a great idea to get it in core, sofrom the proposal to when it was committed was less than 2months.

Issue: Pave the way for integration of jQuery into core

Page 9: Introduction to new technologies in drupal 8

MORE JAVASCRIPT

The external library "Farbtastic" was added.

The total of Javascript files that shipped with Drupal was 11. 2of them external

Page 10: Introduction to new technologies in drupal 8

DRUPAL 6RELEASED IN FEBRUARY 2008

No new external libraries were added.

Page 11: Introduction to new technologies in drupal 8

MORE (DRUPAL) JAVASCRIPT IS SHOWING UPThere is a total of 23 JS files.

Still only 2 of them are external libraries.

Page 12: Introduction to new technologies in drupal 8

DRUPAL 7RELEASED IN JANUARY 2011

Now things start happening.

The PHP library Archive tar by Vincent Blavet was added

There is a total of 85 JS files. A whopping 37 of them areexternal libraries. They are almost all jQuery libraries.

Most prominent is probably jQuery UI. It is a collection of UIcomponents like a datepicker, accordions and so on.

Page 13: Introduction to new technologies in drupal 8

BUT WHAT ABOUT SIMPLETEST?Well, we only used the concept - not the library.

The impact was immensely positive, but it was still stuff we rolledourselves.

Page 14: Introduction to new technologies in drupal 8

DRUPAL 8RELEASED SOME TIME IN THIS DECADE

Now the fun starts!

We have 193 Javascript files. Of them 87 are external.

Page 15: Introduction to new technologies in drupal 8

JAVASCRIPT STATSJS-files Drupal-specific External Percent externalDrupal 4.7 7 0 0%Drupal 5 11 2 18%Drupal 6 23 2 9%Drupal 7 85 37 44%Drupal 8 193 87 45%

Page 16: Introduction to new technologies in drupal 8

PHP LIBRARIES

Page 17: Introduction to new technologies in drupal 8

SYMFONY2

Symfony2 is a lot of loosely coupled components.

It offers us a lot we didn't need to invent ourselves.

The first piece of Symfony2 was put in core in October 2011.Issue: Add Symfony2 HttpFoundation library to core

Page 18: Introduction to new technologies in drupal 8

COMPOSER

Issue: Use Composer for updating Symfony components

Page 19: Introduction to new technologies in drupal 8

COMPOSERDependency manager

Inspired by package managers for other programminglanguages like Ruby and Node.

Only used in core for managing external dependencies.

A library declares its dependencies in a composer.js file.

Page 20: Introduction to new technologies in drupal 8

PHPUNITWhew.

A mature testing framework that works well for testing OOPclasses.

Testing is much lighter loadwise with PHPUnit.

Has a mocking framework.

Cannot replace our version of simpletest but still is a gamechanger.

Issue: Start using PHPUnit for unit tests

Page 21: Introduction to new technologies in drupal 8

ASSETICA Symfony component.

A way for Drupal to find stuff like your CSS or JS.

A way to include libraries.

There are 'filters' so that you can use LESS, SCSS, Coffeescript,etc. and have Assetic compile/massage your files.

Plays nice with Twig.Issue: Add Assetic component to core

Page 22: Introduction to new technologies in drupal 8

GUZZLEA much needed upgrade of the way Drupal does HTTPrequests.

Useful for creating/using web services and a lot of other things.

Guzzle "just" wraps cURL.

Maintainers were very helpful in accommodating Drupal's useof the library.

Issue: Adopt Guzzle library to replace drupal_http_request()

Page 23: Introduction to new technologies in drupal 8

DOCTRINE COMMONA bit like Symfony - a bunch of libraries like DB abstractionlayers etc.

We have incorporated the "common" library.

We use it for parsing annotations plugin definitions.Issue: Add the Doctrine Common PHP library

Page 24: Introduction to new technologies in drupal 8

CKEDITORThis one I think many people know already.

Not having a WYSIWYG has been a serious lack in Drupal - aswell as a feature ;-)

It took a while to make a decision. Initially Aloha editor lookedlike it was going in.

Issue: Add CKEditor JS library to core

Page 25: Introduction to new technologies in drupal 8

Editing text now looks like this straight out of the box.

Page 26: Introduction to new technologies in drupal 8

TWIGSome guy is going to talk about that later this weekend while

swearing profusely.

Page 27: Introduction to new technologies in drupal 8

JAVASCRIPT LIBRARIES

Page 28: Introduction to new technologies in drupal 8

BACKBONE.JS AND UNDERSCORE.JSBackbone depends on Underscore.

Underscore is a set of low-level utilities for manipulatingarrays and objects.

Backbone is an MVC - Model - View - Controller solution forjavascript.

Gives a lot of freedom in building web apps.

In core so far - it is used on contextual links and in the toolbar.Issue: Add Backbone.js and Underscore.js to core

Page 29: Introduction to new technologies in drupal 8

MODERNIZRA library that helps detecting older browsers that lackcapabilities.

Most websites use it, or something like it, today already.

Also makes it possible for other libraries to check for browsersupport.

Issue: Add Modernizr to core

Page 30: Introduction to new technologies in drupal 8

QUESTIONS?