Presentation on theme: "Team Development Best Practices for Kentico CMS"— Presentation transcript:
1 Team Development Best Practices for Kentico CMS Brian McKeiver, BizStream, Co-Owner & Kentico MVP
2 Goals Work efficiently as a group Make your life easier as a Kentico DeveloperHone your craft, make your customers happier
3 CowboyGoal 1vs.TeamMost developers go through a period of being a cowboy, they sling code like a colt 45, shoot first, ask questions later, they feel like heroes. But working in a team can accomplish much more .
4 You don’t have to burn the place down Goal 2You don’t have to burn the place downNo Stepping on Toes, Big on Automation, Worry about the important stuff, don’t sweat the small stuff, have recover-ability
5 Gladwell’s 10,000-Hour Rule Goal 3 Outliers: The Story of Success is a non-fiction book written by Malcolm Gladwell Be a Craftsman!
6 When you see this…Let’s talk about this over a beer
7 Here We Go: First Time Setup Tools of the TradeLocal WorkstationVisual Studio 2010+SQL Server Management Studio 2008+Source ControlKenticoCMS_7_0.exeGoal: Install Kentico locallyWhat do you need to work as a group ?
8 Reasons to Install Locally DocumentationAPI CHMKentico Installation Manager (KIM)Import ToolkitApp Pool Recycles are controlledWhen building Kentico objects you frequently need to look up the API or Web Part properties.KIM makes hotfixing and updates easierToolkit is very useful for updating data from spreadsheets
9 Source Control with Kentico Code ConsiderationsOne branch or many ?Depends on team size and goalsDatabase ConsiderationsLeverage built in version control, check-in & check-outWhy external SQL versioning products may not workWe tend to recommend one branch of codeVirtual Files are new in 7.0 and can help with Database objects
10 Your exceptions are yours and yours alone Running Local CodeDebug with VS2012HTTP Trace via FiddlerYour exceptions are yours and yours aloneNo danger of breaking the buildDebug, Trace, Logging are all developers best friends
11 Shared Development Database Key idea for Team DevelopmentKentico CMS SQL DBDev 1Developers run locally for CODE but share the Kentico DBShould we consider Collision – Free approach ?Dev 2
12 Shared Development Instance Running full copy of your site in TESTKentico CMSShared DevMake changes to settings and objects that are database only on the Shared Dev mysite.devserver.comEx – Document Types, Custom TablesDev 1Dev 2
13 QA / Test Server Code QA / Test can see changes faster QA 1 Kentico CMS SQL DBDev 1Pro – QA sees changes faster, easier to deployCon – risk of Dev breaking QA, How can we fix that?Dev 2
15 Grow Your Craft Jedi Master Jedi Knight There is no Try, only Do -Yoda PadawanYounglingIm going to show next how to help just not you but your whole team grow their craft
16 Naming Standards Matter Prefix characters for project nameFollowed by fully spelled out, descriptive nameDisplay NamesUpper Case with spaces to delimit wordsPrefixing with a special character is recommended because the project specific or custom object names will roll to the top of the Kentico selectors.Object Code NamesNo Spaces, no special characters, Upper camel case100% Relying on the automatic naming is not recommendedUse the word “Custom” in Views / Stored ProcsUse System Tables GUI in SiteManager to create them
17 Making it work: Custom Code Locations 2 Strategies~/App_Code/<Custom Code>project code as sub folder~/CMSModules/<Custom Code>~/CMSWebParts/<Custom Code>or~/App_Code/_framework/<Custom Code>~/_framework/<Custom Code>/CMSModules~/_framework/<Custom Code>/CMSWebPartsOption 1 – import / export fully supports (deploy easier)Option 2 – upgrade safe 100% you know where all of your code is that is customA little bit of personal choice hereFloats to top
18 Making it work: Site Settings Kentico Site Settings for Team DevCheck in - check out (Object Lock)Object VersioningBlog Post
19 Object Locking & Versioning Available for:CSS StylesheetsTemplatesPage LayoutsPage TemplatesTransformationsWeb part ContainersWeb part Layouts* templates does not currently support storing on disk
20 Workflow for Content Tree Use it always!Gives you recover-ability!
21 “Undo Checkout” is NOT your Friend Warning 1“Undo Checkout” is NOT your FriendYou will lose your or someone else’s changesGlobal Admins can always do this, on any object in the system, BUT DON’T FALL FOR IT
22 Warning 2You will not be able to see Web Part settings if another developer has a Page Template checked out or if it is checked in.
23 Tip: See All Checked Out Objects My Desk tab to the rescue!Allows you to see all of your checked out objects in one shot
24 Virtual Objects with Kentico Check out to File SystemCan still use Kentico UI or External Source ControlApply Changes to move back to DBEnable on CMSSiteManager -> Administration -> System -> Virtual Objects
25 Virtual Objects: What it does Use any IDE / Source Control client you want while editing externally in the file system.
26 Virtual Objects: How it Saves You Kentico Cache and Object Locking2 Devs land on the same checked in page template at same timeOne checks out the template, the second goes to get coffeeOne is working, second comes back and checks outTwo checked out copies because working at localhostBut you are using source control so when commits happen your repo should see a merge situation and help you manage the collision correctly and not lose any changes.Commit frequently, clear cache
27 Virtual Objects Gotchas Object Sync Message, respect it.
28 Deployment Mode with Kentico When the deployment mode is OFFlocation of virtual objects depends on the Source control options.When the deployment mode is ONvirtual objects are moved from the database to the file system on your disk. Target folder is ~/CMSVirtualFiles.Don’t have to use with Source Control options. I’m not a fan of using this. When the deployment mode is ON, the source control options for object types that useVirtualPathProvider are disabled.
29 Continuous Integration (CI) Lots of Options:JenkinsTeam Foundation ServerTeam City
30 Automatic build and deploy capabilities Value of CITechnical Value:Saves TimeAutomatic build and deploy capabilitiesExercise / hone your craftsmanshipAdds responsibility to check ins / commitsGives you metrics on code baseReduction Staging errorsAnalysis & reporting on the health of the code base
31 Reduces overhead across overall development process Value of CI 2Business Value:Reduces RiskReduces overhead across overall development processProvides better Quality AssuranceRaises project visibilityWhen a development team integrates their work frequently == less of a gap between the current state of the application and the state of the application as the developer has it. And so the scope for assumptions is reduced.Notice trend
32 How to use CI with Kentico Automatic pollingBuild every X minsHooksBuild when events are triggeredMost common hook is: when a commit occursMost CI systems can spawn a Selenium TestAutomated /Recorded HTTP requestBehind the scenes we are really using MSBuild to call the csc.exe (csharp compiler) as if you were hitting the Build button in Visual Studio
33 What to watch out for in upgrade / hotfix Files will be overwritten if you do not segment your customizations
34 Don’t Rely on the System Transforms What if someone re-installs a Module ?POOFCloning is your Friend
35 Deployment OptionsWah Wah it’s too hard because it’s got a SQL Database /cry
36 Import / Export (multiple) You can choose to export multiple objects at once. This method is useful for deploying objects, aka a module, or set of Page Templates, however to be honest it is not the most robust mechanism. Not so much documents.
37 Import / Export (single) Almost every object is export-ableLook for the small grey dropdown arrow to expand the menu
38 Import / Export Gotchas Update DocumentsLinked DocumentsLicense IssuesWTF ?Tip, if you get a red error message during import that says Invalid Web Site or Invalid license that means you need to make the main URL of the site in CMSSiteManager the exact URL that you are importing at, and NOT the site domain alias.
39 Content Stage One click deployment, YES Please! Sign me up. Tip: Don’t get rid of ItemGUID, ItemModifiedWhenTip: You can control what gets staged or not from the task level by implementing DocumentEvents.LogChange.Before event handler or ObjectEvents.LogChange.Before
41 Web Farm Sync Sync everything everywhere Good for initial step in project lifecycle as far as developers goAlso great for uptime and reliability in Production Environments
42 Deployment Setting: Macro Security A note about Connection Strings and Macro SecurityEver seen this on your page ?|(user)mcbeev|(hash)f2c eea6f50f961a af24e51cf154f75b f810dc0"Use the appSetting key:<add key="CMSHashStringSalt" value="e68b9ad6-a e3e-ece73f03dd02" />Defaults to connectionstring appSetting Key, and that is bad because as you move from DEV to QA to LIVE you will have different connection strings
43 Team Dev: A Few Other Best Practices Keep Zone IDs and Web Part Control IDs as short as possible. Use Web Part Titles insteadAvoid Ad-hoc Templates, other devs won’t know about them
44 Working with the Marketing People Yes even Content Admins have a right to play in the CMSSeparate environments for DEV and Content Admins helpsUse Content Staging to keep in Sync
45 Team Development is supported better than ever in Kentico 7.0! Wrapping It UpTeam Development is supportedbetter than ever in Kentico 7.0!Assimilate as a Team.Resistance is Futile.Team Development FTW.You’ve LearnedWork efficiently as a groupMake your life easier as a Kentico DeveloperHone your craft, make your customers happier