Code reuse and sharing across multiple sites (Flash talk)
May 2013 — WordPress.com VIP Intensive WorkshopCode reuse and sharing acrossmultiple sitesGabriel Koen, PMC
What this talk is about✤ PMC operates✤ 5 public web sites on WordPress.com VIP✤ 9 or so public web sites hosted elsewhere✤ 4 private APIs, 2 using WordPress, 2 not✤ So how does all our code work together?
What about sites or apps thataren’t onVIP?✤ Forget about it.✤ Each one is a unique snowﬂake.✤ Single-purpose that other APIs don’t fulﬁll, or is a mostly static site.✤ They don’t use shared code.✤ Done.
Logic treeMore than ~2 functions?themepluginfunctions.phpUsed more than once?globalpluginrefactorWait — when I builtthis I wasn’t thinking itwould be usedanywhere else.Always think one step ahead.Not two.I don’tknow what Iwant to be...
Site vs Global✤ It’s an ideal, it doesn’t always work✤ Previously, we copy and pasted a lot✤ We’re not perfect✤ Code duplication is not always bad✤ Sometimes sites do similar things, but differently
A particular slide catching your eye?
Clipping is a handy way to collect important slides you want to go back to later.