Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Open Source Development Trends - Erasmus Hogeschool 2014

Open Source Development Trends - Erasmus Hogeschool 2014

Slides for my Open Source Development Trends talk at Erasmus Hogeschool Brussels 2014.

Thijs Feryn

March 21, 2014
Tweet

More Decks by Thijs Feryn

Other Decks in Technology

Transcript

  1. Modern  web  developer Code Infrastructure Agile  processes Quality  assurance Frontend

     vs   backend Project   management Build  &  release  cycles Performance  &  scalability Security Flexibility
  2. EvoluDon  of  programming  languages ✓C ✓C++ ✓C# ✓Objective C ✓Perl

    ✓VB(A) ✓Java ✓Javascript ✓PHP ✓Ruby ✓Python ✓Node.js
  3. Microsoft has changed as a company and is becoming more

    open in the way that we work with and collaborate with others in the industry, in how we listen to customers, and in our approach to the cloud. We contribute to and partner with open source communities and promote interoperability to make it easier and less costly for customers to develop and manage mixed IT environments. We actively participate in the standards setting process and support established and emerging standards in our products. In the cloud, we support key standards that provide the building blocks for open, interoperable cloud services, and we support developer choice of programming languages. We support data portability and believe customers own and control their data, no matter where it resides.
  4. interface ServiceClient { function getData(); } ! class MyWebServiceClient implements

    ServiceClient { private $data; function MyWebServiceClient() { $client = new SoapClient("some.wsdl"); $this->data = $client->getDataFunction(); } function getData() { return $this->data; } }
  5. $client = new MyWebServiceClient(); // Later in your code, and

    possibly in multiple places print $client->getData();
  6. abstract class ServiceClientDecorator implements ServiceClient { protected $serviceClient; public function

    __construct(ServiceClient $serviceClient) { $this->serviceClient = $serviceClient; } } ! class HtmlEntitiesDecorator extends ServiceClientDecorator { public function getData() { return htmlentities($this->serviceClient->getData()); } } ! class ParagraphDecorator extends ServiceClientDecorator { public function getData() { return '<p>'.$this->serviceClient->getData().'</p>'; } }
  7. $client = new MyWebServiceClient(); // Add our decorators $client =

    new HtmlEntititesDecorator($client); $client = new ParagraphDecorator($client); ! // Later in your code, and possibly in multiple places print $client->getData();
  8. class DatabaseFactory { // The factory function takes as an

    argument the // name of the class to produce public static function getInstance($driver) { // Attempt to include the the file containing the class // (not necessary if you use a custom autoloader) if(include_once(dirname(__FILE__).'/drivers/database_'. $driver.'.php')) { // Build the name of the class, instantiate, and return $driver_class = 'Database_'.$driver; return new $driver_class; } else { throw new Exception('Database driver not found'); } } } ! // To use, call the factory's static method: $db = DatabaseFactory::getInstance('MySQL');
  9. class Database { // A static property to hold the

    single instance of the class private static $instance; ! // The constructor is private so that outside code cannot instantiate private function __construct() { } ! // All code that needs to get and instance of the class should call // this function like so: $db = Database::getInstance(); public function getInstance() { // If there is no instance, create one if (!isset(self::$instance)) { $c = __CLASS__; self::$instance = new $c; } return self::$instance; } // Block the clone method private function __clone() {} } ! // To use, call the static method to get the only instance $db = Database::getInstance();
  10. class Book ! {! ! public function __construct() ! {!

    ! ! $registry = RegistrySingleton::getInstance();! ! ! $this->_database = $registry->database;! ! ! // or! ! ! global $databaseConnection;! ! ! $this->_database = $database;! ! }! }! ! $book = new Book();
  11. class Book ! { ! ! private $_databaseConnection;! ! public

    function __construct() { }! ! public function setDatabaseConnection($databaseConnection) {! ! ! $this->_databaseConnection = $databaseConnection;! ! }! ! }! ! $book = new Book();! $book->setDatabase($databaseConnection);
  12. ✓Canvas drawing ✓Movie support ✓Offline data ✓Document editing ✓Drag &

    drop ✓Geolocation ✓File manipulation ✓New intuitive tags & elements
  13. GET  /  HTTP/1.1   Host:  www.erasmushogeschool.be   User-­‐Agent:  Mozilla/5.0  (Macintosh;

     Intel  Mac  OS  X   10.9;  rv:27.0)  Gecko/20100101  Firefox/27.0   Accept:  text/html,application/xhtml+xml,application/ xml;q=0.9,*/*;q=0.8   Accept-­‐Language:  en,nl;q=0.7,fr-­‐be;q=0.3   Accept-­‐Encoding:  gzip,  deflate   Cookie:   SESScb94af3218bddf8a6a8a156d8d1cb02a=64a18f65470ea229 b5ad23a83566ab45;  has_js=1;   __utma=26413801.1654633732.1395239322.1395239322.1395 239322.1;  __utmb=26413801.1.10.1395239322;   __utmc=26413801;   __utmz=26413801.1395239322.1.1.utmcsr=(direct)| utmccn=(direct)|utmcmd=(none)   Connection:  keep-­‐alive   Cache-­‐Control:  max-­‐age=0   !
  14. HTTP/1.1  200  OK   Date:  Wed,  19  Mar  2014  14:28:31

     GMT   Server:  Apache/2.2.16  (Debian)  PHP/5.3.3-­‐7+squeeze15   with  Suhosin-­‐Patch   X-­‐Powered-­‐By:  PHP/5.3.3-­‐7+squeeze15   Last-­‐Modified:  Wed,  19  Mar  2014  11:00:54  GMT   Etag:  "9eb48667197c0cd1817601c4bff5738c"   Expires:  Sun,  19  Nov  1978  05:00:00  GMT   Cache-­‐Control:  must-­‐revalidate   Content-­‐Encoding:  gzip   Keep-­‐Alive:  timeout=15,  max=91   Connection:  Keep-­‐Alive   Transfer-­‐Encoding:  chunked   Content-­‐Type:  text/html;  charset=utf-­‐8   !
  15. 200: OK 201: Created 202: Accepted 203: Non-Authoritative 
 Information

    204: No content 205: Reset content 206: Partial content
  16. 301: Moved permanently 302: Found 303: See other 304: Not

    modified 305: Use proxy 306: Unused 307: Temporary redirect
  17. 400: Bad request 401: Unauthorized 402: Payment required 403: Forbidden

    404: Not found 405: Method not allowed 406: Not acceptable 407: Proxy authentication required 408: Request timeout
  18. 409: Conflict 410: Gone 411: Length required 412: Precondition failed

    413: Request enitity too large 414: Request URI too long 415: Unsupported media type 416: Request range not satisfiable 417: Expectation failed
  19. 500: Internal server error 501: Not implemented 502: Bad gateway

    503: Service unavailable 504: Gateway timeout 505: HTTP version not supported
  20. ✓Accept ✓Accept-Charset ✓Accept-Encoding ✓Accept- language ✓Authorization ✓Cache-control ✓Connection ✓Cookie ✓Content-length

    ✓Date ✓Host ✓If-None-Match ✓Pragma ✓Proxy- Authorization ✓Referer ✓Upgrade ✓User-Agent ✓Via
  21. ✓Age ✓Allow ✓Cache-control ✓Connection ✓Content- Encoding ✓Content- Language ✓Content-Length ✓Content-Type

    ✓Date ✓ETag ✓Expires ✓Last-Modified ✓Location ✓Pragma ✓Server ✓Set-Cookie ✓Transfer- Encoding ✓Vary
  22. GET  /  HTTP/1.1   Host:  www.erasmushogeschool.be   User-­‐Agent:  Mozilla/5.0  (Macintosh;

     Intel  Mac  OS  X   10.9;  rv:27.0)  Gecko/20100101  Firefox/27.0   Accept:  text/html,application/xhtml+xml,application/ xml;q=0.9,*/*;q=0.8   Accept-­‐Language:  en,nl;q=0.7,fr-­‐be;q=0.3   Accept-­‐Encoding:  gzip,  deflate   Cookie:   SESScb94af3218bddf8a6a8a156d8d1cb02a=64a18f65470ea229 b5ad23a83566ab45;  has_js=1;   __utma=26413801.1654633732.1395239322.1395239322.1395 239322.1;  __utmb=26413801.1.10.1395239322;   __utmc=26413801;   __utmz=26413801.1395239322.1.1.utmcsr=(direct)| utmccn=(direct)|utmcmd=(none)   Connection:  keep-­‐alive   Cache-­‐Control:  max-­‐age=0   !
  23. HTTP/1.1  200  OK   Date:  Wed,  19  Mar  2014  14:28:31

     GMT   Server:  Apache/2.2.16  (Debian)  PHP/5.3.3-­‐7+squeeze15   with  Suhosin-­‐Patch   X-­‐Powered-­‐By:  PHP/5.3.3-­‐7+squeeze15   Last-­‐Modified:  Wed,  19  Mar  2014  11:00:54  GMT   Etag:  "9eb48667197c0cd1817601c4bff5738c"   Expires:  Sun,  19  Nov  1978  05:00:00  GMT   Cache-­‐Control:  must-­‐revalidate   Content-­‐Encoding:  gzip   Keep-­‐Alive:  timeout=15,  max=91   Connection:  Keep-­‐Alive   Transfer-­‐Encoding:  chunked   Content-­‐Type:  text/html;  charset=utf-­‐8   !
  24. Max-Age: TTL for browsers in seconds S-maxage: TTL for proxies

    in seconds Public: Proxies & browsers can cache Private: Only browsers can cache No-cache: Revalidate before dropping from cache No-store: don’t cache at all Must-revalidate: Browser revalidate before serving from cache Proxy-revalidate: Browser revalidate before serving from cache
  25. SOAP ✓WSDL = HTTP GET ✓RPC call = HTTP POST

    ✓Not cacheable ✓No HTTP vocabuliary re-use ✓Complex markup
  26. Quoting David Zülke ✓A URL identifies a resource. ✓Resources have

    a hierarchy, so you know that something with additional slashes is a subordinate resource ✓Verbs are used to perform operations on resources ✓The operation is implicit and not part of the URL ✓A hypermedia format is used to represent the data ✓Link relations are used to navigate a service
  27. GET  /products/1234  HTTP/1.1   Host:  example.com   Accept:  application/vnd.com.example+xml  

    HTTP/1.1  200  OK   Content-­‐Type:  application/vnd.com.example+xml;  charset=utf-­‐8   Allow:  GET,  PUT,  DELETE   <?  xml  version="1.0"  encoding="utf-­‐8"  ?>   <product  xmlns="urn:com.example.products"  xmlns:atom="http:// w3.org/2005/Atom">      <id>1234</id>      <name  xml:lang="en">My  product</name>      <name  xml:lang="nl">Mijn  product</name>   <price  currency="EUR">5</price>   <price  currency="USD">6.5</price>   <atom:link  rel="payment"  type="application/vnd.com.example +xml"  href="http://example.com/products/1234/payment"   </product>     Thx   David!
  28. ✓Twitter Bootstrap ✓Homebrew ✓Ruby On Rails ✓HTML5 Boilerplate ✓Jquery ✓Node.js

    ✓Phonegap ✓Backbone.js ✓Linux Kernel ✓Symfony2 Frame work ✓Django Framework ✓Zend Framework 2 ✓Git Popular GitHub projects
  29. Package managers ✓Ruby: Gem ✓Python: Pip ✓Perl: CPAN ✓PHP: PEAR,

    PECL & Composer ✓.NET: NuGet ✓Linux: yum, apt-get ✓Javascript: npm, bower
  30. “I wish I had enough money to run Oracle instead

    of Postgres." ! “Why do you want to do that?" ! “I dont, I just wish I had enough money to”
  31. ✓Async, non-blocking, event-driven ✓Javascript based ✓Callbacks ✓Data intensive ✓CK10 problem

    ✓Not for websites ✓Real-time communication ✓Websockets ✓Hipsters
  32. var http = require('http'); http.createServer(function (req, res) { res.writeHead(200, {'Content-Type':

    'text/plain'}); res.end('Hello World\n'); }).listen(1337, '127.0.0.1'); console.log('Server running at http:// 127.0.0.1:1337/');
  33. ✓People > processes ✓Usability > documentation ✓Late requirement changes ✓Fast

    changes ✓Prototype ~ production ✓Continuous delivery ✓Short cycles ✓Quick releases
  34. class  apache  (      $default_mods  =  true,    

     $service_enable  =  true,      $serveradmin    =  'root@localhost',      $sendfile          =  false,      $purge_vdir      =  true   )  {      include  apache::params   !    package  {  'httpd':          ensure  =>  installed,          name      =>  $apache::params::apache_name,      }   !    #  true/false  is  sufficient  for  both  ensure  and  enable      validate_bool($service_enable)   !    service  {  'httpd':          ensure        =>  $service_enable,          name            =>  $apache::params::apache_name,          enable        =>  $service_enable,  
  35. !    file  {  'httpd_vdir':          ensure

       =>  directory,          path        =>  $apache::params::vdir,          recurse  =>  true,          purge      =>  $purge_vdir,          notify    =>  Service['httpd'],          require  =>  Package['httpd'],      }   !    if  $apache::params::conf_dir  and  $apache::params::conf_file   {          #  Template  uses:          #  -­‐  $apache::params::user          #  -­‐  $apache::params::group          #  -­‐  $apache::params::conf_dir          #  -­‐  $serveradmin          file  {  "${apache::params::conf_dir}/$ {apache::params::conf_file}":              ensure    =>  present,              content  =>  template("apache/$ {apache::params::conf_file}.erb"),  
  36. Vagrant::Config.run  do  |config|      config.vm.box  =  "lucid32"    

     config.vm.box_url  =  "http://files.vagrantup.com/lucid32.box"      config.vm.customize  [                  "modifyvm",  :id,                  "-­‐-­‐name",  "Varnish  Training",                  "-­‐-­‐memory",  "512"      ]      config.vm.network  :hostonly,  "12.12.12.6"      config.vm.share_folder  "v-­‐data",  "/home/data",  "./"      config.vm.provision  :chef_solo  do  |chef|          chef.cookbooks_path  =  "./tools/chef/cookbooks"          chef.json  =  {              :varnish  =>  {                          :vcl_dir  =>  "/home/data",                                                  :version  =>  "3.0",                          :listen_port  =>  "80",                          :storage  =>  "malloc",                          :storage_size  =>  "256m",                      },              :apache  =>  {                          :listen_ports  =>  ["8080"]       }                                 }          chef.add_recipe("vim")          chef.add_recipe("apache2")          chef.add_recipe("apache2::mod_php5")                  chef.add_recipe("varnish::apt_repo")          chef.add_recipe("varnish::default")      end   end