do this, don't do that: a primer on sitecore development

Post on 17-Feb-2017

73 Views

Category:

Software

2 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Do This, Don’t Do That: A Primer on Sitecore DevelopmentPresented by:Ben Hoelting andDave Youngerman

Do This, Don’t Do That: A Primer on Sitecore Development

BenHoeltingIn truth, he’s just a big kid. He loves designing systems that solve real world problems. There is nothing more satisfying than seeing something you helped develop being used by the end users. Ben is also involved in the technology community and runs the South Colorado .NET user group. He also enjoys speaking at tech groups and events around the country.

Ben Hoelting@benhnetb.hoelting@aspenware.com

Do This, Don’t Do That: A Primer on Sitecore Development

DaveYoungerman

Dave Youngerman@DavidYoungermand.youngerman@aspenware.com

Originally from Ohio, Dave was a biologist before he discovered building software was his calling and never looked back. When not creating software, Dave likes to spend time with his wife, two boys, and way too many pets. He also enjoys skiing, running, scuba diving, and fishing.

Do This, Don’t Do That: A Primer on Sitecore Development

Agenda• Accessing Sitecore Data• Using Config System• Dev Ops - DEMO• Indexing• Cache Management• Unit Testing Sitecore - DEMO

Accessing Sitecore Data

Do This, Don’t Do That: A Primer on Sitecore Development

Accessing Sitecore Data• Sitecore templates contain the fields needed to

display data.• There are two ways to access fields on a template

• By Name• By ID

Do This, Don’t Do That: A Primer on Sitecore Development

The Wrong Way

• What happens if someone renames the field to “Blurb”?

Do This, Don’t Do That: A Primer on Sitecore Development

The Right Way

Next steps/Resources/Questions

9

What to do• Take a look at Glass Mapper and decide if it is right for you• If not create structs, constants or classes with the ids to your templates and fields

Resources available• http://glass.lu/• Use Habitat as an Example. • http://habitat.sitecore.net

Using the Config System

Do This, Don’t Do That: A Primer on Sitecore Development

Using the Config System• Sitecore has a very robust configuration

system• Use showconfig.aspx to view configs• App_config Folder• App_config\Include Folder

Do This, Don’t Do That: A Primer on Sitecore Development

Using the Config System Cont.• Patching Sitecore configs

Next steps/Resources/Questions

13

What to do• Refactor any web.config changes to patches• Use Slow Cheetah to create transforms for different environments

Resources available• http://tinyurl.com/j9armlv• Use Habitat as an Example. • http://habitat.sitecore.net

Dev Ops

Do This, Don’t Do That: A Primer on Sitecore Development

Dev Ops• Deployment of any system that is based

on metadata is difficult• 3rd party tools are needed

• Unicorn• Team Development for Sitecore (TDS)• MSBuild• Octopus

Dev OpsDemo

Next steps/Resources/Questions

17

What to do• Decide between Unicorn or Team Development for Sitecore (TDS)• Create build configurations for each environment and configure them with your build server

Resources available• http://www.teamdevelopmentforsitecore.com• https://github.com/kamsar/Unicorn

Indexing Tips

Do This, Don’t Do That: A Primer on Sitecore Development

Indexing• Index update strategies

• You can use multiple strategies (max of 3) to keep your indexes up to date.

• Strategies are:• RebuildAfterFullPublish• OnPublishEndAsync• IntervalAsynchronous• Synchronous• RemoteBuild• TimeIndexRefresh• Manual

IndexingLucene vs Solr

Do This, Don’t Do That: A Primer on Sitecore Development

Indexing - Lucene• Lucene is configured by default for content

searching.• Stick with Lucene when...

• You don't have to index a large number of items.

• You don't need multiple content delivery servers.

Do This, Don’t Do That: A Primer on Sitecore Development

Indexing - Solr• Solr is more robust, so use it when...

• You need to index large numbers of items (50,000 and up).

• Search is your site's primary interface.• You use multiple content delivery servers, or

you plan to in the future.

Next Steps/Resources/Questions

23

What to do• Review Sitecore Documentation on Lucene vs Solr.• Determine your data and scaling requirements.

Resources available• http://tinyurl.com/gtb9bcj

CacheManagement

Do This, Don’t Do That: A Primer on Sitecore Development

Cache Types• Different Caching Options

HTML/Web Cache

Item Cache

Data Cache

Prefetch Cache

Database

Do This, Don’t Do That: A Primer on Sitecore Development

Cache Definitions• Prefetch Cache

• Item Information prefilled on App startup• You configure what items are Prefetched

• Data Cache• Cache of Item Information.• Pretty much a flat text representation of an item

• Item Cache• Cache an entire Item object

• HTML/Web Cache• Cache the HTML output of a rendering

Next steps/Resources/Questions

27

What to do• Run performance tests against your site to identify bottlenecks where caching can be applied.• Review Sitecore cache documentation.

Resources available• http://tinyurl.com/h7oerhy

Unit TestingSitecore

Do This, Don’t Do That: A Primer on Sitecore Development

Unit Testing Sitecore• Do use Sitecore.FakeDb to mock Sitecore

dependencies• FakeDb allows you to create and manipulate Sitecore

content in memory.• Enables unit testing for areas that are not unit testable from

first look (e.g. static classes, content tree, etc.)

Do This, Don’t Do That: A Primer on Sitecore Development

Unit Testing Sitecore Cont.• Do use Sitecore.FakeDb.Autofixture to create

fake data rather than creating your own.

Do This, Don’t Do That: A Primer on Sitecore Development

Unit Testing Sitecore Cont.• Add the following classes to your solution:

Unit TestingSitecore Demo

Next steps/Resources/Questions

33

What to do• Read the Sitecore.FakeDb GitHub Wiki and start mocking Sitecore dependencies.• Use Autofixture to prepopulate your Sitecore mocks.• Review Sitecore.Habitat's unit tests.

Resources available• http://tinyurl.com/z5jn4sa

Tools for Modern Web Development34

Sitecore Development

Don’t Forget About Performance

Unit Testing Helps Keep Your Sanity

Developer Productivity Is Key

If you do the right things up front, developers can be highly productive with Sitecore. Setup Dev ops,

coding standards and best practice frameworks

to increase developer effectiveness and

efficiency.

Sitecore is relatively heavy. That’s because it

delivers so much functionality. It also

provides ways to tweak the system to deliver

great performance. For example: Caching and

Indexing.

One best practice that will help system statbility

is unit testing. Unit testing has been a

challenge for Sitecore developers in the past. Today, Sitecore FakeDB

makes unit testing Sitecore a reality.

Do This, Don’t Do That: A Primer on Sitecore Development

Resources:• http://www.sitecore.com• http://habitat.sitecore.net• Cache Info: http://tinyurl.com/gn325mc• Solr or Lucene: http://tinyurl.com/zcu3ex6• Sitecore.FakeDb: http://tinyurl.com/hzu9dn5

FOR DISCUSSION PURPOSES ONLY. Sitecore Confidential and Proprietary. © 2016 Sitecore Corporation A/S. All

rights reserved. Sitecore® and Own the Experience® are registered

trademarks of Sitecore Corporation A/S. All other brand and product names are the property of their

respective owners.

top related