Click here to load reader

Taking backwards compatibility seriously

  • View
    52

  • Download
    0

Embed Size (px)

Text of Taking backwards compatibility seriously

Backwards Compatibilitytaking it seriouslyWhat is it?Not breaking thingsfrom version to versionMaintaining methodsmethod v1 still works with method v2Keeping consistencydesign, database schema, markup, etcBasic examplesPHPfunction do_thi_thing() { }version 1.0function do_this_thing() { }version 2.0Fatal errorundefined function: do_thi_thing()function do_thi_thing() { return do_this_thing(); }Solution:CSS / HTML.entry { background: #f0f0f0 }

.entry { background: #f0f0f0 }

No more #f0f0f0Oops

Solution:Filenamesrequire_once includes/class-authors.php;class-authors.phprequire_once includes/class-authors.php;class-vendors.phpFatal errorfile not foundMetadataget_post_meta( $post_id, city_name, true );

value: New YorkMetadataget_post_meta( $post_id, city, true );

value:function pw_filter_old_meta( $check, $object_id, $meta_key, $single ) {if( 'city_name' === $meta_key ) {$check = get_post_meta( $object_id, 'city', $single );}return $check;}add_filter( 'get_post_metadata', 'pw_filter_old_meta', 10, 4 );Solution:Solution:get_post_meta( $post_id, city, true );

value: New York

get_post_meta( $post_id, city_name, true );

value: New YorkSo many moreHow easy is it?Why worry about it?Whats the benefit?Does it slow you down?Case StudyEDD Signed URLslongest outstanding issue for EDD, 12/19/2012

2.3 released 3 days ago - howd we do?Old Methodhttp://edd/index.php?download_key={key}&email={email}&file=file}&price_id={price}&download_id={id}&expire={expire}

http://edd/index.php?download_key=7211cce2df06b572890934752a4c0896&email=pippin%40pippinsplugins.com&file=1&price_id=1&download_id=514&expire=MTQyNDE2NzcyOQ%3D%3DNew Methodhttp://edd/index.php?eddfile={file}&ttl={expre}&token={token}

http://edd/index.php?eddfile=2231%3A514%3A0&ttl=1424167604&token=4d0a86fb8f8be40cf9927222076a5cedPotential Breakagelets consider the possibilities40,000+ active sitesbasic assumptions:40,000+ active sitesbasic assumptions:50 customers per site40,000+ active sitesbasic assumptions:50 customers per site1 sale per customer / 1 download link per customer40,000+ active sitesbasic assumptions:50 customers per site1 sale per customer / 1 download link per customer50*40,000 = 2,000,000 broken download links40,000+ active sitesbasic assumptions:50 customers per site1 sale per customer / 1 download link per customer50*40,000 = 2,000,000 broken download links..40,000+ active sitesbasic assumptions:50 customers per site1 sale per customer / 1 download link per customer50*40,000 = 2,000,000 broken download links..probably vastly under exaggerationChallenge acceptedprogramming is all about challengesMake it a goalMentalitygreat development is more about how it is thought out than how it is done

your attitude and dedication will go further than your knowledge of syntaxI willThanksPippin Williamsonpippinsplugins.com - @pippinsplugins

Search related