Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
EnterpriseCakeEnterpriseCake
JamesWattsJamesWatts
james.watts@cakephp.org
Cake Development Corporation
whoamiwhoami
/ JamesWatts/ JamesWatts (@_JAMESWATTS_)(@_JAMESWATTS_)
/ InvolvedinOpenSourcesi...
Cake Development Corporation
Cake Development Corporation
TheoryTheory
Cake Development Corporation
WriteLessCodeWriteLessCode
AndWriteFewerQueriesAndWriteFewerQueries
Cake Development Corporation
Writinglesscodemeans...Writinglesscodemeans...
> Reducinglegacytomaintain> Reducinglegacytoma...
Cake Development Corporation
CakePHPCakePHP PromotesPromotes LessCodeLessCode
RapidApplicationDevelopmentRapidApplicationD...
Cake Development Corporation
ConventionOverConfigurationConventionOverConfiguration
Cake Development Corporation
Don'tWorkAroundCakePHPDon'tWorkAroundCakePHP
MakeFullUseOfFrameworkConventionsMakeFullUseOfFr...
Cake Development Corporation
Don'tReinventWheelsDon'tReinventWheels
BeAwareOfTheBoredomFactor,AndTheDesireToHack!BeAwareOf...
Cake Development Corporation
KeepItSimpleKeepItSimple
CodeIsSimpleUntilCodeIsSimpleUntil YouYou MakeItComplicatedMakeItCom...
Cake Development Corporation
Don'tRepeatRepeatYourselfDon'tRepeatRepeatYourself
TakeFullAdvantageOfComponents,BehaviorsAnd...
Cake Development Corporation
DesignUp-FrontDesignUp-Front
FollowYourBusinessObjectives,NotYourTechnicalSolutionFollowYourB...
Cake Development Corporation
TreatYourCodeAsProductTreatYourCodeAsProduct
WriteProductionReadyCodeAsIfItWereForSomeoneElse...
Cake Development Corporation
Command/QuerySeparationCommand/QuerySeparation
Separateactionsthatchangestatefromthosewhichco...
Cake Development Corporation
BuildSOLIDCodeBuildSOLIDCode
ApplyThe“FirstFive”DesignPrinciplesToYourCodeApplyThe“FirstFive”...
Cake Development Corporation
S.O.L.I.DS.O.L.I.D
> SingleResponsibilityPrincipal> SingleResponsibilityPrincipal
> Open/Clos...
Cake Development Corporation
GetAGRASPOfYourCodeGetAGRASPOfYourCode
General Responsibility AssignmentSoftwarePatternsGener...
Cake Development Corporation
G.R.A.S.PG.R.A.S.P
> ControllerPattern> ControllerPattern
> CreatorPattern> CreatorPattern
> ...
Cake Development Corporation
Don'tBeSTUPID!Don'tBeSTUPID!
AvoidBadPracticesWhichWillWasteYourTimeLaterAvoidBadPracticesWhi...
Cake Development Corporation
S.T.U.P.I.DS.T.U.P.I.D
> Singleton> Singleton
> Tight Coupling> Tight Coupling
> Untestabilit...
Cake Development Corporation
KeepThingsInContextKeepThingsInContext
TheLawOfDemeter,Don'tTalkToStrangersTheLawOfDemeter,Do...
Cake Development Corporation
DoesItScale?DoesItScale?
IgnoreThePerformanceBenchmarksIgnoreThePerformanceBenchmarks
Cake Development Corporation
Scalemeansmanythings...Scalemeansmanythings...
> Dataprocessing> Dataprocessing
> Requestconc...
Cake Development Corporation
ThinkAboutYourDataThinkAboutYourData
YourDatabaseSchema IsYourAchillesHeelYourDatabaseSchema ...
Cake Development Corporation
ThinkAheadWithYourDataThinkAheadWithYourData
AvoidStaleData,UseQueuing,CronTasksAnd Data Ware...
Cake Development Corporation
AvoidTheHypeAvoidTheHype
Don'tFollowTheHerd,BeGuidedOnlyBy ResultsDon'tFollowTheHerd,BeGuided...
Cake Development Corporation
RespectTheProfessionRespectTheProfession
TheCheaperAlternativeIsAlwaysMoreExpensiveLaterTheCh...
Cake Development Corporation
ReduceTechnicalDebtReduceTechnicalDebt
BeRealisticAboutCornersYou Cut AndShortcutsYou TakeBeR...
Cake Development Corporation
BudgetConstraintsAreRealBudgetConstraintsAreReal
ContemplateFutureDealingOfAccumulated DebtCo...
Cake Development Corporation
VersionControlVersionControl
ThereIsThereIs NONO ExcuseToNotVersion YourSourceCodeExcuseToNot...
Cake Development Corporation
Test,Test,TestTest,Test,Test
ReduceCoverageReduceCoverage BeforeBefore YouAvoidTestingAnythin...
Cake Development Corporation
PracticePractice
Cake Development Corporation
CakeDCGitWorkflowCakeDCGitWorkflow
http://cakedc.com/git-workflowhttp://cakedc.com/git-workfl...
Cake Development Corporation
GitDevelopmentStrategyGitDevelopmentStrategy
Cake Development Corporation
Stability,Quality& ConsistencyStability,Quality& Consistency
Cake Development Corporation
Debug KitDebug Kit
https://github.com/cakephp/debug_kithttps://github.com/cakephp/debug_kit
Cake Development Corporation
CakeDCMigrationsCakeDCMigrations
https://github.com/CakeDC/migrationshttps://github.com/CakeD...
Cake Development Corporation
CakeDependencyCakeDependency
https://github.com/jameswatts/cake-dependencyhttps://github.com/...
Cake Development Corporation
DIFeatures...DIFeatures...
> Registerclasses,objectsorcallbacks> Registerclasses,objectsorcal...
Cake Development Corporation
Registera ServiceRegistera Service
Di::add('Foo', [
'className' => 'Example',
'classPath' => ...
Cake Development Corporation
ConstructorAndSetterInjectionConstructorAndSetterInjection
Di::add('Foo', [
'className' => 'E...
Cake Development Corporation
UsingObserversUsingObservers
Di::observe([
'MyInterface',
'AbstractClass'
], [
'setters' => [...
Cake Development Corporation
CakeToolkitCakeToolkit
https://github.com/jameswatts/cake-toolkithttps://github.com/jameswatt...
Cake Development Corporation
CTKFeatures...CTKFeatures...
> Object-orienteddesign> Object-orienteddesign
> Abstractionande...
Cake Development Corporation
Object-Oriented ViewsObject-Oriented Views
class IndexView extends CtkView {
public $factorie...
Cake Development Corporation
ViewExtensibilityViewExtensibility
class IndexView extends CtkView {
public $factories = ['Ct...
Cake Development Corporation
AttachingEventsAttachingEvents
// create a HTML button
$button = $this->Html->Button([
'value...
Cake Development Corporation
ReusingObjectsInLegacyViewsReusingObjectsInLegacyViews
<div id=”example”>
<?php
echo $this->F...
Cake Development Corporation
CakeMarkupLanguageCakeMarkupLanguage
https://github.com/jameswatts/cake-markup-languagehttps:...
Cake Development Corporation
CakeMLFeatures...CakeMLFeatures...
> Familiarsyntax> Familiarsyntax
> Readyfordesigners> Read...
Cake Development Corporation
MarkupMarkup
<div id="example">
<cake:out value="Hello World" />
</div>
<div id="%{foo}">
<ca...
Cake Development Corporation
ControlStructuresControlStructures
<php:if expr="!empty(%{foo})">
<cake:out value="%{foo}" />...
Cake Development Corporation
FrameworkFeaturesFrameworkFeatures
<cake:link value="#{Blog}" url="['controller' => 'Posts']"...
Cake Development Corporation
ThanksThanks
Cake Development Corporation
CakePHP2ApplicationCookbookCakePHP2ApplicationCookbook
https://packtpub.com/web-development/c...
You’ve finished this document.
Download and read it offline.
Upcoming SlideShare
Communicative Language Teaching
Next
Upcoming SlideShare
Communicative Language Teaching
Next
Download to read offline and view in fullscreen.

Share

Enterprise Cake

Download to read offline

Related Books

Free with a 30 day trial from Scribd

See all

Related Audiobooks

Free with a 30 day trial from Scribd

See all

Enterprise Cake

  1. 1. EnterpriseCakeEnterpriseCake JamesWattsJamesWatts james.watts@cakephp.org
  2. 2. Cake Development Corporation whoamiwhoami / JamesWatts/ JamesWatts (@_JAMESWATTS_)(@_JAMESWATTS_) / InvolvedinOpenSourcesince2008/ InvolvedinOpenSourcesince2008 / Using PHPforthelast 10years/ Using PHPforthelast 10years / Corememberof CakePHP/ Corememberof CakePHP / Organizerof CakeFest/ Organizerof CakeFest / Teamleadat CakeDC/ Teamleadat CakeDC / Authorof XHTTP andDocMLspecs/ Authorof XHTTP andDocMLspecs / CakePHP2 ApplicationCookbook/ CakePHP2 ApplicationCookbook
  3. 3. Cake Development Corporation
  4. 4. Cake Development Corporation TheoryTheory
  5. 5. Cake Development Corporation WriteLessCodeWriteLessCode AndWriteFewerQueriesAndWriteFewerQueries
  6. 6. Cake Development Corporation Writinglesscodemeans...Writinglesscodemeans... > Reducinglegacytomaintain> Reducinglegacytomaintain > Introducingfeweredgecases> Introducingfeweredgecases > Lessopportunityforhumanerror> Lessopportunityforhumanerror > Fasterdevelopment efforts> Fasterdevelopment efforts > Lesscodetotest andcover> Lesscodetotest andcover > Enjoyment factorincreases!> Enjoyment factorincreases!
  7. 7. Cake Development Corporation CakePHPCakePHP PromotesPromotes LessCodeLessCode RapidApplicationDevelopmentRapidApplicationDevelopment
  8. 8. Cake Development Corporation ConventionOverConfigurationConventionOverConfiguration
  9. 9. Cake Development Corporation Don'tWorkAroundCakePHPDon'tWorkAroundCakePHP MakeFullUseOfFrameworkConventionsMakeFullUseOfFrameworkConventions
  10. 10. Cake Development Corporation Don'tReinventWheelsDon'tReinventWheels BeAwareOfTheBoredomFactor,AndTheDesireToHack!BeAwareOfTheBoredomFactor,AndTheDesireToHack!
  11. 11. Cake Development Corporation KeepItSimpleKeepItSimple CodeIsSimpleUntilCodeIsSimpleUntil YouYou MakeItComplicatedMakeItComplicated
  12. 12. Cake Development Corporation Don'tRepeatRepeatYourselfDon'tRepeatRepeatYourself TakeFullAdvantageOfComponents,BehaviorsAndHelpersTakeFullAdvantageOfComponents,BehaviorsAndHelpers
  13. 13. Cake Development Corporation DesignUp-FrontDesignUp-Front FollowYourBusinessObjectives,NotYourTechnicalSolutionFollowYourBusinessObjectives,NotYourTechnicalSolution
  14. 14. Cake Development Corporation TreatYourCodeAsProductTreatYourCodeAsProduct WriteProductionReadyCodeAsIfItWereForSomeoneElseWriteProductionReadyCodeAsIfItWereForSomeoneElse
  15. 15. Cake Development Corporation Command/QuerySeparationCommand/QuerySeparation SeparateactionsthatchangestatefromthosewhichconsultstateSeparateactionsthatchangestatefromthosewhichconsultstate
  16. 16. Cake Development Corporation BuildSOLIDCodeBuildSOLIDCode ApplyThe“FirstFive”DesignPrinciplesToYourCodeApplyThe“FirstFive”DesignPrinciplesToYourCode
  17. 17. Cake Development Corporation S.O.L.I.DS.O.L.I.D > SingleResponsibilityPrincipal> SingleResponsibilityPrincipal > Open/ClosedPrincipal> Open/ClosedPrincipal > LiskovSubstitutionPrinciple> LiskovSubstitutionPrinciple > InterfaceSegregationPrinciple> InterfaceSegregationPrinciple > DependencyInversionPrinciple> DependencyInversionPrinciple
  18. 18. Cake Development Corporation GetAGRASPOfYourCodeGetAGRASPOfYourCode General Responsibility AssignmentSoftwarePatternsGeneral Responsibility AssignmentSoftwarePatterns
  19. 19. Cake Development Corporation G.R.A.S.PG.R.A.S.P > ControllerPattern> ControllerPattern > CreatorPattern> CreatorPattern > HighCohesion> HighCohesion > Indirection Pattern> Indirection Pattern > ExpertPrincipal> ExpertPrincipal > LowCoupling> LowCoupling > Polymorphism> Polymorphism > ProtectedVariations> ProtectedVariations > PureFabrication> PureFabrication
  20. 20. Cake Development Corporation Don'tBeSTUPID!Don'tBeSTUPID! AvoidBadPracticesWhichWillWasteYourTimeLaterAvoidBadPracticesWhichWillWasteYourTimeLater
  21. 21. Cake Development Corporation S.T.U.P.I.DS.T.U.P.I.D > Singleton> Singleton > Tight Coupling> Tight Coupling > Untestability> Untestability > PrematureOptimization> PrematureOptimization > IndescriptiveNaming> IndescriptiveNaming > Duplication> Duplication
  22. 22. Cake Development Corporation KeepThingsInContextKeepThingsInContext TheLawOfDemeter,Don'tTalkToStrangersTheLawOfDemeter,Don'tTalkToStrangers
  23. 23. Cake Development Corporation DoesItScale?DoesItScale? IgnoreThePerformanceBenchmarksIgnoreThePerformanceBenchmarks
  24. 24. Cake Development Corporation Scalemeansmanythings...Scalemeansmanythings... > Dataprocessing> Dataprocessing > Requestconcurrency> Requestconcurrency > Cachingstrategy> Cachingstrategy > Storageengine> Storageengine > Development effort> Development effort > Maintenancecost> Maintenancecost
  25. 25. Cake Development Corporation ThinkAboutYourDataThinkAboutYourData YourDatabaseSchema IsYourAchillesHeelYourDatabaseSchema IsYourAchillesHeel
  26. 26. Cake Development Corporation ThinkAheadWithYourDataThinkAheadWithYourData AvoidStaleData,UseQueuing,CronTasksAnd Data WarehousingAvoidStaleData,UseQueuing,CronTasksAnd Data Warehousing
  27. 27. Cake Development Corporation AvoidTheHypeAvoidTheHype Don'tFollowTheHerd,BeGuidedOnlyBy ResultsDon'tFollowTheHerd,BeGuidedOnlyBy Results
  28. 28. Cake Development Corporation RespectTheProfessionRespectTheProfession TheCheaperAlternativeIsAlwaysMoreExpensiveLaterTheCheaperAlternativeIsAlwaysMoreExpensiveLater
  29. 29. Cake Development Corporation ReduceTechnicalDebtReduceTechnicalDebt BeRealisticAboutCornersYou Cut AndShortcutsYou TakeBeRealisticAboutCornersYou Cut AndShortcutsYou Take
  30. 30. Cake Development Corporation BudgetConstraintsAreRealBudgetConstraintsAreReal ContemplateFutureDealingOfAccumulated DebtContemplateFutureDealingOfAccumulated Debt
  31. 31. Cake Development Corporation VersionControlVersionControl ThereIsThereIs NONO ExcuseToNotVersion YourSourceCodeExcuseToNotVersion YourSourceCode
  32. 32. Cake Development Corporation Test,Test,TestTest,Test,Test ReduceCoverageReduceCoverage BeforeBefore YouAvoidTestingAnythingYouAvoidTestingAnything
  33. 33. Cake Development Corporation PracticePractice
  34. 34. Cake Development Corporation CakeDCGitWorkflowCakeDCGitWorkflow http://cakedc.com/git-workflowhttp://cakedc.com/git-workflow
  35. 35. Cake Development Corporation GitDevelopmentStrategyGitDevelopmentStrategy
  36. 36. Cake Development Corporation Stability,Quality& ConsistencyStability,Quality& Consistency
  37. 37. Cake Development Corporation Debug KitDebug Kit https://github.com/cakephp/debug_kithttps://github.com/cakephp/debug_kit
  38. 38. Cake Development Corporation CakeDCMigrationsCakeDCMigrations https://github.com/CakeDC/migrationshttps://github.com/CakeDC/migrations
  39. 39. Cake Development Corporation CakeDependencyCakeDependency https://github.com/jameswatts/cake-dependencyhttps://github.com/jameswatts/cake-dependency
  40. 40. Cake Development Corporation DIFeatures...DIFeatures... > Registerclasses,objectsorcallbacks> Registerclasses,objectsorcallbacks > ConstructorandSetterinjection> ConstructorandSetterinjection > Lazyloading> Lazyloading > Dependencyscopes> Dependencyscopes > Observers> Observers
  41. 41. Cake Development Corporation Registera ServiceRegistera Service Di::add('Foo', [ 'className' => 'Example', 'classPath' => 'Plugin.Path' ]); Di::add('Foo', $object); Di::add('Foo', function() use ($something) { // return service instance });
  42. 42. Cake Development Corporation ConstructorAndSetterInjectionConstructorAndSetterInjection Di::add('Foo', [ 'className' => 'Example', 'classPath' => 'Plugin.Path', 'params' => [ 'bar' => Di::load('Bar') ] ]); Di::add('Foo', [ 'className' => 'Example', 'classPath' => 'Plugin.Path', 'setters' => [ 'setBar' => [ 'bar' => Di::load('Bar') ] ] ]);
  43. 43. Cake Development Corporation UsingObserversUsingObservers Di::observe([ 'MyInterface', 'AbstractClass' ], [ 'setters' => [ 'setFactory' => Di::load('Factory') ] ]);
  44. 44. Cake Development Corporation CakeToolkitCakeToolkit https://github.com/jameswatts/cake-toolkithttps://github.com/jameswatts/cake-toolkit
  45. 45. Cake Development Corporation CTKFeatures...CTKFeatures... > Object-orienteddesign> Object-orienteddesign > Abstractionandencapsulation> Abstractionandencapsulation > Separationofconcerns> Separationofconcerns > Extensiblearchitecture> Extensiblearchitecture > Plug andplay> Plug andplay > Legacysupport> Legacysupport
  46. 46. Cake Development Corporation Object-Oriented ViewsObject-Oriented Views class IndexView extends CtkView { public $factories = ['Ctk.Html', 'Ctk.Js']; public function build() { // create a HTML div $div = $this->Html->Div(); // create a HTML button $button = $this->Html->Button([ 'value' => __('Click Me') ]); // add the button to the div $div->add($button); // add the div to the view $this->add($div); } }
  47. 47. Cake Development Corporation ViewExtensibilityViewExtensibility class IndexView extends CtkView { public $factories = ['Ctk.Html', 'Ctk.Js']; public function build() { $div = $this->Html->Div(); $div->add($this->buildButton()); $this->add($div); } public function buildButton($value) { return $this->Html->Button([ 'value' => __($value) ]); } }
  48. 48. Cake Development Corporation AttachingEventsAttachingEvents // create a HTML button $button = $this->Html->Button([ 'value' => __('Click Me') ]); // bind an event to the button $button->bind('click', $this->Js->Alert([ 'text' => __('Hello World') ]));
  49. 49. Cake Development Corporation ReusingObjectsInLegacyViewsReusingObjectsInLegacyViews <div id=”example”> <?php echo $this->Factory->Html->Span([ 'text' => __('Hello World') ]); ?> </div>
  50. 50. Cake Development Corporation CakeMarkupLanguageCakeMarkupLanguage https://github.com/jameswatts/cake-markup-languagehttps://github.com/jameswatts/cake-markup-language
  51. 51. Cake Development Corporation CakeMLFeatures...CakeMLFeatures... > Familiarsyntax> Familiarsyntax > Readyfordesigners> Readyfordesigners > Simpletemplating> Simpletemplating > Extensiblebydesign> Extensiblebydesign > Plug andplay> Plug andplay > Legacysupport> Legacysupport
  52. 52. Cake Development Corporation MarkupMarkup <div id="example"> <cake:out value="Hello World" /> </div> <div id="%{foo}"> <cake:out value="#{Hola Mundo}" /> </div> <cake:out value="%{foo}" default="Nothing here" />
  53. 53. Cake Development Corporation ControlStructuresControlStructures <php:if expr="!empty(%{foo})"> <cake:out value="%{foo}" /> <php:else /> <cake:out value="Oops, no value" /> </php:if> <php:foreach var="products" default="No products found"> <cake:out value="%{COUNT}. %{KEY} = %{VALUE}" /> </php:foreach>
  54. 54. Cake Development Corporation FrameworkFeaturesFrameworkFeatures <cake:link value="#{Blog}" url="['controller' => 'Posts']" /> <cake:form model="Post" options="['action' => 'add']"> <cake:input field="Post.title" /> </cake:form> <cake:helper name="Foo" call="run" args="['bar', 123]" /> <cake:element name="sidebar" options="['foo' => %{bar}]" />
  55. 55. Cake Development Corporation ThanksThanks
  56. 56. Cake Development Corporation CakePHP2ApplicationCookbookCakePHP2ApplicationCookbook https://packtpub.com/web-development/cakephp-2-application-cookbookhttps://packtpub.com/web-development/cakephp-2-application-cookbook
  • rupsena

    Apr. 25, 2016
  • thetwinnhtway2013

    Jul. 4, 2015
  • surajtambare

    Feb. 14, 2015
  • hrxone

    Nov. 12, 2014
  • diovanemonteiro

    Oct. 11, 2014
  • manuelmarquezortiz

    Aug. 27, 2014
  • MaziyaNobuhleB

    Aug. 27, 2014
  • r3ds3v3n

    Aug. 26, 2014
  • cag12345

    Aug. 25, 2014
  • zoghal

    Aug. 25, 2014
  • squalltua1

    Aug. 25, 2014
  • pauledenburg

    Aug. 25, 2014
  • zhaffmy

    Aug. 24, 2014
  • CoolQoo

    Aug. 24, 2014
  • vitorpc

    Aug. 24, 2014
  • lucasff1

    Aug. 24, 2014

Views

Total views

4,301

On Slideshare

0

From embeds

0

Number of embeds

377

Actions

Downloads

63

Shares

0

Comments

0

Likes

16

×