Open source development trends - CVO Leerstad 2013

Open source development trends - CVO Leerstad 2013

Slides for my CVO Leerstad 2013 talk about open source development trends

Ca901ddcea38854b9783781c91fc87c9?s=128

Thijs Feryn

April 25, 2013
Tweet

Transcript

  1. 34.

    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. donderdag 25 april 13
  2. 40.

    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; } } donderdag 25 april 13
  3. 41.

    $client = new MyWebServiceClient(); // Later in your code, and

    possibly in multiple places print $client->getData(); donderdag 25 april 13
  4. 42.

    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>'; } } donderdag 25 april 13
  5. 43.

    $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(); donderdag 25 april 13
  6. 45.

    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'); donderdag 25 april 13
  7. 47.

    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(); donderdag 25 april 13
  8. 49.

    class Book { ! public function __construct() { ! !

    $registry = RegistrySingleton::getInstance(); ! ! $this->_database = $registry->database; ! ! // or ! ! global $databaseConnection; ! ! $this->_database = $database; ! } } $book = new Book(); donderdag 25 april 13
  9. 50.

    class Book { ! private $_databaseConnection; ! public function __construct()

    { } ! public function setDatabaseConnection($databaseConnection) { ! ! $this->_databaseConnection = $databaseConnection; ! } } $book = new Book(); $book->setDatabase($databaseConnection); donderdag 25 april 13
  10. 60.

    GET$/$HTTP/1.1 Host:$www.cvoleerstad.be User8Agent:$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 Accept8Language:$nl,en;q=0.7,fr8be;q=0.3 Accept8Encoding:$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:$keep8alive donderdag 25 april 13
  11. 61.

    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 X8Powered8By:$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

    Last8Modified:$Thu,$25$Apr$2013$06:27:21$GMT Cache8Control:$no8store,$no8cache,$must8revalidate,$ post8check=0,$pre8check=0 Pragma:$no8cache Keep8Alive:$timeout=15,$max=93 Connection:$Keep8Alive Transfer8Encoding:$chunked Content8Type:$text/html;$charset=utf88 donderdag 25 april 13
  12. 77.

    500 501 502 503 504 505 Internal9server9error Not9implemented Bad9gateway Service9unavailable

    Gateway97meout HTTP9Version9Not9 Supported donderdag 25 april 13
  13. 79.

    Accept Accept3Charset Accept3Encoding Accept3language Authorization Cache3control Connection Cookie Content3length Date

    text/plain u^8 gzip,9deflate en,nl;q=0.7,fr3be;q=0.3 Basic9QWxhZGRpbjpvcGVuIHNlc2FtZQ== no3cache close bla=ja;9foo=bar 1024 Tue,9159Nov91994908:12:319GMT donderdag 25 april 13
  14. 80.

    Host If3None3Match Pragma Proxy3Authorization Referer Upgrade User3Agent Via www.fronteers.nl "737060cd8c284d8af7ad3082f209582d"

    no3cache Basic9 QWxhZGRpbjpvcGVuIHNl c2FtZQ== h=p://www.combell.com Mozilla/5.09 websocket 1.09fred,91.19example.com9(Apache/1.1) donderdag 25 april 13
  15. 82.

    Age Allow Cache3control Connection Content3Encoding Content3Language Content3Length Content3Type Date 12

    GET,HEAD max3age=3600 close gzip nl 1024 text/html;9charset=u^38 Tue,9159Nov91994908:12:319GMT donderdag 25 april 13
  16. 83.

    ETag Expires Last3Modified Location Pragma Server Set3Cookie Transfer3Encoding Vary 737060cd8c284d8af7ad3082f209582d

    Thu,9019Dec91994916:00:009GMT Thu,9019Dec91994916:00:009GMT hkp://www.combell.com no3cache My9magic9server bla=abc;9session=12345 chuncked Accept3encoding donderdag 25 april 13
  17. 84.

    GET$/$HTTP/1.1 Host:$www.cvoleerstad.be User8Agent:$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 Accept8Language:$nl,en;q=0.7,fr8be;q=0.3 Accept8Encoding:$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:$keep8alive donderdag 25 april 13
  18. 85.

    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 X8Powered8By:$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

    Last8Modified:$Thu,$25$Apr$2013$06:27:21$GMT Cache8Control:$no8store,$no8cache,$must8revalidate,$ post8check=0,$pre8check=0 Pragma:$no8cache Keep8Alive:$timeout=15,$max=93 Connection:$Keep8Alive Transfer8Encoding:$chunked Content8Type:$text/html;$charset=utf88 donderdag 25 april 13
  19. 90.

    Max9Age S9maxage Public Private No9cache No9store Must9revalidate Proxy9revalidate TTL9for9browsers9in9seconds TTL9for9proxies9in9seconds

    Proxies9&9browsers9can9cache Only9browsers9can9cache Revalidate9before9dropping9from9cache Don’t9cache9at9all Browser9revalidate9before9serving9from9 cache9 Proxy9revalidate9before9serving9from9 cache9 donderdag 25 april 13
  20. 93.
  21. 107.

    GET$/products/1234$HTTP/1.1 Host:$example.com Accept:$application/vnd.com.example+xml$ HTTP/1.1$200$OK Content8Type:$application/vnd.com.example+xml;$charset=utf88 Allow:$GET,$PUT,$DELETE <?$xml$version="1.0"$encoding="utf88"$?> <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> $ Thx9 David! donderdag 25 april 13
  22. 158.

    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/'); donderdag 25 april 13
  23. 169.

    ✓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 donderdag 25 april 13
  24. 171.

    That sweet spot between "operating system" or platform stack and

    the application layer http://www.krisbuytaert.be/blog/what-devops donderdag 25 april 13
  25. 173.

    The systematic process of building, deploying, managing, and using an

    application or group of applications http://www.krisbuytaert.be/blog/what-devops donderdag 25 april 13
  26. 177.

    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, $$$$subscribe$=>$Package['httpd'], donderdag 25 april 13
  27. 179.

    Vagrant::Config.run$do$|config| $$config.vm.box$=$"lucid32" $$config.vm.box_url$=$"http://files.vagrantup.com/lucid32.box" $$config.vm.customize$[ $$$$$$$$"modifyvm",$:id, $$$$$$$$"88name",$"Varnish$Training", $$$$$$$$"88memory",$"512" $$] $$config.vm.network$:hostonly,$"12.12.12.6" $$config.vm.share_folder$"v8data",$"/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 donderdag 25 april 13