Preview:
DESCRIPTION
Citation preview
- 1. EnterpriseCakeEnterpriseCake JamesWattsJamesWatts
james.watts@cakephp.org
- 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. Cake Development Corporation
- 4. Cake Development Corporation TheoryTheory
- 5. Cake Development Corporation WriteLessCodeWriteLessCode
AndWriteFewerQueriesAndWriteFewerQueries
- 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. Cake Development Corporation CakePHPCakePHP PromotesPromotes
LessCodeLessCode
RapidApplicationDevelopmentRapidApplicationDevelopment
- 8. Cake Development Corporation
ConventionOverConfigurationConventionOverConfiguration
- 9. Cake Development Corporation
Don'tWorkAroundCakePHPDon'tWorkAroundCakePHP
MakeFullUseOfFrameworkConventionsMakeFullUseOfFrameworkConventions
- 10. Cake Development Corporation
Don'tReinventWheelsDon'tReinventWheels
BeAwareOfTheBoredomFactor,AndTheDesireToHack!BeAwareOfTheBoredomFactor,AndTheDesireToHack!
- 11. Cake Development Corporation KeepItSimpleKeepItSimple
CodeIsSimpleUntilCodeIsSimpleUntil YouYou
MakeItComplicatedMakeItComplicated
- 12. Cake Development Corporation
Don'tRepeatRepeatYourselfDon'tRepeatRepeatYourself
TakeFullAdvantageOfComponents,BehaviorsAndHelpersTakeFullAdvantageOfComponents,BehaviorsAndHelpers
- 13. Cake Development Corporation DesignUp-FrontDesignUp-Front
FollowYourBusinessObjectives,NotYourTechnicalSolutionFollowYourBusinessObjectives,NotYourTechnicalSolution
- 14. Cake Development Corporation
TreatYourCodeAsProductTreatYourCodeAsProduct
WriteProductionReadyCodeAsIfItWereForSomeoneElseWriteProductionReadyCodeAsIfItWereForSomeoneElse
- 15. Cake Development Corporation
Command/QuerySeparationCommand/QuerySeparation
SeparateactionsthatchangestatefromthosewhichconsultstateSeparateactionsthatchangestatefromthosewhichconsultstate
- 16. Cake Development Corporation BuildSOLIDCodeBuildSOLIDCode
ApplyTheFirstFiveDesignPrinciplesToYourCodeApplyTheFirstFiveDesignPrinciplesToYourCode
- 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. Cake Development Corporation
GetAGRASPOfYourCodeGetAGRASPOfYourCode General Responsibility
AssignmentSoftwarePatternsGeneral Responsibility
AssignmentSoftwarePatterns
- 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. Cake Development Corporation Don'tBeSTUPID!Don'tBeSTUPID!
AvoidBadPracticesWhichWillWasteYourTimeLaterAvoidBadPracticesWhichWillWasteYourTimeLater
- 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. Cake Development Corporation
KeepThingsInContextKeepThingsInContext
TheLawOfDemeter,Don'tTalkToStrangersTheLawOfDemeter,Don'tTalkToStrangers
- 23. Cake Development Corporation DoesItScale?DoesItScale?
IgnoreThePerformanceBenchmarksIgnoreThePerformanceBenchmarks
- 24. Cake Development Corporation
Scalemeansmanythings...Scalemeansmanythings... >
Dataprocessing> Dataprocessing > Requestconcurrency>
Requestconcurrency > Cachingstrategy> Cachingstrategy >
Storageengine> Storageengine > Development effort>
Development effort > Maintenancecost> Maintenancecost
- 25. Cake Development Corporation
ThinkAboutYourDataThinkAboutYourData YourDatabaseSchema
IsYourAchillesHeelYourDatabaseSchema IsYourAchillesHeel
- 26. Cake Development Corporation
ThinkAheadWithYourDataThinkAheadWithYourData
AvoidStaleData,UseQueuing,CronTasksAnd Data
WarehousingAvoidStaleData,UseQueuing,CronTasksAnd Data
Warehousing
- 27. Cake Development Corporation AvoidTheHypeAvoidTheHype
Don'tFollowTheHerd,BeGuidedOnlyBy
ResultsDon'tFollowTheHerd,BeGuidedOnlyBy Results
- 28. Cake Development Corporation
RespectTheProfessionRespectTheProfession
TheCheaperAlternativeIsAlwaysMoreExpensiveLaterTheCheaperAlternativeIsAlwaysMoreExpensiveLater
- 29. Cake Development Corporation
ReduceTechnicalDebtReduceTechnicalDebt BeRealisticAboutCornersYou
Cut AndShortcutsYou TakeBeRealisticAboutCornersYou Cut
AndShortcutsYou Take
- 30. Cake Development Corporation
BudgetConstraintsAreRealBudgetConstraintsAreReal
ContemplateFutureDealingOfAccumulated
DebtContemplateFutureDealingOfAccumulated Debt
- 31. Cake Development Corporation VersionControlVersionControl
ThereIsThereIs NONO ExcuseToNotVersion
YourSourceCodeExcuseToNotVersion YourSourceCode
- 32. Cake Development Corporation Test,Test,TestTest,Test,Test
ReduceCoverageReduceCoverage BeforeBefore
YouAvoidTestingAnythingYouAvoidTestingAnything
- 33. Cake Development Corporation PracticePractice
- 34. Cake Development Corporation
CakeDCGitWorkflowCakeDCGitWorkflow
http://cakedc.com/git-workflowhttp://cakedc.com/git-workflow
- 35. Cake Development Corporation
GitDevelopmentStrategyGitDevelopmentStrategy
- 36. Cake Development Corporation Stability,Quality&
ConsistencyStability,Quality& Consistency
- 37. Cake Development Corporation Debug KitDebug Kit
https://github.com/cakephp/debug_kithttps://github.com/cakephp/debug_kit
- 38. Cake Development Corporation
CakeDCMigrationsCakeDCMigrations
https://github.com/CakeDC/migrationshttps://github.com/CakeDC/migrations
- 39. Cake Development Corporation CakeDependencyCakeDependency
https://github.com/jameswatts/cake-dependencyhttps://github.com/jameswatts/cake-dependency
- 40. Cake Development Corporation DIFeatures...DIFeatures...
> Registerclasses,objectsorcallbacks>
Registerclasses,objectsorcallbacks >
ConstructorandSetterinjection> ConstructorandSetterinjection
> Lazyloading> Lazyloading > Dependencyscopes>
Dependencyscopes > Observers> Observers
- 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. 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. Cake Development Corporation UsingObserversUsingObservers
Di::observe([ 'MyInterface', 'AbstractClass' ], [ 'setters' => [
'setFactory' => Di::load('Factory') ] ]);
- 44. Cake Development Corporation CakeToolkitCakeToolkit
https://github.com/jameswatts/cake-toolkithttps://github.com/jameswatts/cake-toolkit
- 45. Cake Development Corporation CTKFeatures...CTKFeatures...
> Object-orienteddesign> Object-orienteddesign >
Abstractionandencapsulation> Abstractionandencapsulation >
Separationofconcerns> Separationofconcerns >
Extensiblearchitecture> Extensiblearchitecture > Plug
andplay> Plug andplay > Legacysupport> Legacysupport
- 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. 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. 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. Cake Development Corporation
ReusingObjectsInLegacyViewsReusingObjectsInLegacyViews
- 50. Cake Development Corporation
CakeMarkupLanguageCakeMarkupLanguage
https://github.com/jameswatts/cake-markup-languagehttps://github.com/jameswatts/cake-markup-language
- 51. Cake Development Corporation
CakeMLFeatures...CakeMLFeatures... > Familiarsyntax>
Familiarsyntax > Readyfordesigners> Readyfordesigners >
Simpletemplating> Simpletemplating > Extensiblebydesign>
Extensiblebydesign > Plug andplay> Plug andplay >
Legacysupport> Legacysupport
- 52. Cake Development Corporation MarkupMarkup
- 53. Cake Development Corporation
ControlStructuresControlStructures
- 54. Cake Development Corporation
FrameworkFeaturesFrameworkFeatures
- 55. Cake Development Corporation ThanksThanks
- 56. Cake Development Corporation
CakePHP2ApplicationCookbookCakePHP2ApplicationCookbook
https://packtpub.com/web-development/cakephp-2-application-cookbookhttps://packtpub.com/web-development/cakephp-2-application-cookbook