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

Open Source Development Trends - VHTI13

Thijs Feryn
December 13, 2013

Open Source Development Trends - VHTI13

Open Source Development Trends talk at VIVES/KATHO VHTI

Thijs Feryn

December 13, 2013
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. EvoluTon  of  programming  languages ✓C ✓C++ ✓C# ✓ObjecTve  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. HTML5  features ✓Canvas  drawing ✓Movie  support ✓Offline  data ✓Document  ediTng

    ✓Drag  &  drop ✓GeolocaTon ✓File  manipulaTon ✓New  intuiTve  tags  &  elements
  13. GET  /  HTTP/1.1 Host:  mydomain.com User-­‐Agent:  Mozilla/5.0  (Macintosh;  Intel  Mac

     OS  X   10.8;  rv:20.0)  Gecko/20100101  Firefox/20.0 Accept:  text/html,application/xhtml+xml,application/ xml;q=0.9,*/*;q=0.8 Accept-­‐Language:  nl,en;q=0.7,fr-­‐be;q=0.3 Accept-­‐Encoding:  gzip,  deflate Cookie:   52aaaa602e4730981271b4385bdb39c7=8ff0e3dd7f1ec82d1e83 f000e467e500;   __utma=206997569.1837407744.1366871232.1366871232.136 6871232.1;  __utmb=206997569.1.10.1366871232;   __utmc=206997569;   __utmz=206997569.1366871232.1.1.utmcsr=(direct)| utmccn=(direct)|utmcmd=(none) Connection:  keep-­‐alive
  14. HTTP/1.1  200  OK Date:  Thu,  25  Apr  2013  06:27:20  GMT

    Server:  Apache/1.3.42  (Unix)  PHP/5.2.17   mod_log_bytes/1.2  mod_bwlimited/1.4   mod_auth_passthrough/1.8  FrontPage/5.0.2.2635   mod_ssl/2.8.31  OpenSSL/0.9.7a X-­‐Powered-­‐By:  PHP/5.2.17 P3P:  CP="NOI  ADM  DEV  PSAi  COM  NAV  OUR  OTRo  STP  IND   DEM" Expires:  Mon,  1  Jan  2001  00:00:00  GMT Last-­‐Modified:  Thu,  25  Apr  2013  06:27:21  GMT Cache-­‐Control:  no-­‐store,  no-­‐cache,  must-­‐revalidate,   post-­‐check=0,  pre-­‐check=0 Pragma:  no-­‐cache Keep-­‐Alive:  timeout=15,  max=93 Connection:  Keep-­‐Alive Transfer-­‐Encoding:  chunked Content-­‐Type:  text/html;  charset=utf-­‐8
  15. 400 403 404 405 408 Bad  request Forbidden Not  found

    Method  not  allowed Request  7meout
  16. 405 406 407 408 409 Method  Not  Allowed Not  Acceptable

    Proxy  Authen7ca7on   Required Request  Timeout Conflict
  17. 410 411 412 413 414 Gone Length  Required Precondi7on  Failed

    Request  En7ty  Too  Large Request-­‐URI  Too  Long
  18. 500 501 502 503 504 505 Internal  server  error Not

     implemented Bad  gateway Service  unavailable Gateway  7meout HTTP  Version  Not   Supported
  19. Accept Accept-­‐Charset Accept-­‐Encoding Accept-­‐language Authorization Cache-­‐control Connection Cookie Content-­‐length Date

    text/plain u^8 gzip,  deflate en,nl;q=0.7,fr-­‐be;q=0.3 Basic  QWxhZGRpbjpvcGVuIHNlc2FtZQ== no-­‐cache close bla=ja;  foo=bar 1024 Tue,  15  Nov  1994  08:12:31  GMT
  20. Host If-­‐None-­‐Match Pragma Proxy-­‐Authorization Referer Upgrade User-­‐Agent Via www.fronteers.nl "737060cd8c284d8af7ad3082f209582d"

    no-­‐cache Basic   QWxhZGRpbjpvcGVuIHNl c2FtZQ== hip://www.combell.com Mozilla/5.0   websocket 1.0  fred,  1.1  example.com  (Apache/1.1)
  21. Age Allow Cache-­‐control Connection Content-­‐Encoding Content-­‐Language Content-­‐Length Content-­‐Type Date 12

    GET,HEAD max-­‐age=3600 close gzip nl 1024 text/html;  charset=u^-­‐8 Tue,  15  Nov  1994  08:12:31  GMT
  22. ETag Expires Last-­‐Modified Location Pragma Server Set-­‐Cookie Transfer-­‐Encoding Vary 737060cd8c284d8af7ad3082f209582d

    Thu,  01  Dec  1994  16:00:00  GMT Thu,  01  Dec  1994  16:00:00  GMT hip://www.combell.com no-­‐cache My  magic  server bla=abc;  session=12345 chuncked Accept-­‐encoding
  23. GET  /  HTTP/1.1 Host:  www.cvoleerstad.be User-­‐Agent:  Mozilla/5.0  (Macintosh;  Intel  Mac

     OS  X   10.8;  rv:20.0)  Gecko/20100101  Firefox/20.0 Accept:  text/html,application/xhtml+xml,application/ xml;q=0.9,*/*;q=0.8 Accept-­‐Language:  nl,en;q=0.7,fr-­‐be;q=0.3 Accept-­‐Encoding:  gzip,  deflate Cookie:   52aaaa602e4730981271b4385bdb39c7=8ff0e3dd7f1ec82d1e83 f000e467e500;   __utma=206997569.1837407744.1366871232.1366871232.136 6871232.1;  __utmb=206997569.1.10.1366871232;   __utmc=206997569;   __utmz=206997569.1366871232.1.1.utmcsr=(direct)| utmccn=(direct)|utmcmd=(none) Connection:  keep-­‐alive
  24. HTTP/1.1  200  OK Date:  Thu,  25  Apr  2013  06:27:20  GMT

    Server:  Apache/1.3.42  (Unix)  PHP/5.2.17   mod_log_bytes/1.2  mod_bwlimited/1.4   mod_auth_passthrough/1.8  FrontPage/5.0.2.2635   mod_ssl/2.8.31  OpenSSL/0.9.7a X-­‐Powered-­‐By:  PHP/5.2.17 P3P:  CP="NOI  ADM  DEV  PSAi  COM  NAV  OUR  OTRo  STP  IND   DEM" Expires:  Mon,  1  Jan  2001  00:00:00  GMT Last-­‐Modified:  Thu,  25  Apr  2013  06:27:21  GMT Cache-­‐Control:  no-­‐store,  no-­‐cache,  must-­‐revalidate,   post-­‐check=0,  pre-­‐check=0 Pragma:  no-­‐cache Keep-­‐Alive:  timeout=15,  max=93 Connection:  Keep-­‐Alive Transfer-­‐Encoding:  chunked Content-­‐Type:  text/html;  charset=utf-­‐8
  25. Max-­‐Age S-­‐maxage Public Private No-­‐cache No-­‐store Must-­‐revalidate Proxy-­‐revalidate TTL  for

     browsers  in  seconds TTL  for  proxies  in  seconds Proxies  &  browsers  can  cache Only  browsers  can  cache Revalidate  before  dropping  from  cache Don’t  cache  at  all Browser  revalidate  before  serving  from   cache   Proxy  revalidate  before  serving  from   cache  
  26. WSDL  =  HTTP  GET RPC  call  =  HTTP  POST Not

     cacheable No  HTTP  vocabuliary  re-­‐use Complex  markup SOAP
  27. ✓A  URL  idenTfies  a  resource.   ✓Resources  have  a  hierarchy,

     so  you  know  that   something  with  addiTonal  slashes  is  a  subordinate   resource ✓Verbs  are  used  to  perform  operaTons  on   resources ✓The  operaTon  is  implicit  and  not  part  of  the  URL ✓A  hypermedia  format  is  used  to  represent  the   data ✓Link  relaTons  are  used  to  navigate  a  service Quo7ng   David  Zülke  @dzuelke
  28. 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!
  29. Popular  GitHub  projects ✓Twicer  Bootstrap ✓Homebrew ✓Ruby  On  Rails ✓HTML5

     Boilerplate ✓Jquery ✓Node.js ✓Phonegap ✓Backbone.js ✓Linux  Kernel ✓Symfony2  Framework ✓Django  Framework ✓Zend  Framework  2 ✓Git
  30. Manage  dependencies ✓Ruby:  Gem ✓Python:  Pip ✓Perl:  CPAN ✓PHP:  PEAR,

     PECL  &  Composer ✓.NET:  NuGet ✓Linux:  yum,  apt-­‐get ✓Javascript:  npm,  bower
  31. “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”  
  32. ✓Async,  non-­‐blocking,  event-­‐driven ✓Javascript  based ✓Callbacks ✓Data  intensive ✓CK10  problem

    ✓Not  for  websites ✓Real-­‐Tme  communicaTon ✓Websockets ✓Hipsters Node.js
  33. 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/');
  34. Agile ✓Persons  >  processes ✓Usability  >  documentaTon ✓Late  requirement  changes

    ✓Fast  changes ✓Prototype  ~  producTon ✓ConTnuous  delivery ✓Short  cycles ✓Quick  releases
  35. ✓Fear of change ✓Risky deployment ✓It work on my machine

    ✓Siloisation http://www.jedi.be/blog/2010/02/12/ what-is-this-devops-thing-anyway
  36. That sweet spot between "operating system" or platform stack and

    the application layer http://www.krisbuytaert.be/blog/what-devops
  37. The systematic process of building, deploying, managing, and using an

    application or group of applications http://www.krisbuytaert.be/blog/what-devops
  38. 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,
  39. 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