SlideShare une entreprise Scribd logo
1  sur  27
Télécharger pour lire hors ligne
Adobe Experience Manager
AEM Developer Meetup
Utrecht, September 3rd 2015
@GabrielWalt, Product Manager
Development Best Practices
Adobe Experience Manager
Best Practices…
Best practices are useful reference points, but they must come with a warning
label : The more you rely on external intelligence, the less you will value an
internal idea.
And this is the age of the idea.
― Gyan Nagpal
Adobe Experience Manager
Best Practices…
Practices that lead to more efficiency
• Less project effort
• Less operational effort
• Less maintenance effort
Automotive assembly line, ca. 1920
Adobe Experience Manager
Separation of Concerns
Java Developer
– Java/OSGi
– Business logic
Front-end Developer
– HTML
– CSS/JS
Adobe Experience Manager
Design

HTML/CSS
Component
Business

Logic
Inefficient
Static HTML being

handed over…
Front-end Developer
– HTML
– CSS/JS
Java Developer
– Java/OSGi
– Business logic
Separation of Concerns
Adobe Experience Manager
Design

HTML/CSS
Component
Business

Logic
Front-end Developer
– HTML
– CSS/JS
Java Developer
– Java/OSGi
– Business logic
Efficient
APIs to OSGi bundles
Separation of Concerns
Adobe Experience Manager
§1 – Separating concerns
http://docs.adobe.com/content/docs/en/aem/6-1/develop/sightly.html
Adobe Experience Manager
<a href="${properties.link}" data-sly-test="${properties.jcr:title}">

${properties.jcr:title}

</a>
Sightly Template Language
• Code-less language, forcing strict separation of concerns
• Powerful extension points with the Use-API
• Automatic contextual HTML escaping and XSS protection
• Automatically removes HTML attributes if value is empty
• Reuses HTML blocks for statements
• On-par performance and scalability with JSP
Adobe Experience Manager
Initializes a helper object.

<div data-sly-use.logic="logic.js">${logic.hi}</div>
Output:

<div>Hello World</div>








Use Statement
Adobe Experience Manager
<!-- template.html -->

<div data-sly-use.logic="logic.js">${logic.hi}</div>

/* logic.js */

use(function () {

return {

hi: "Hello World"

};

});
Server-side JavaScript logic
Adobe Experience Manager
<!-- template.html -->

<div data-sly-use.logic="com.myorg.foo.Logic">${logic.hi}</div>
/* Logic.java in OSGi bundle */

package com.myorg.foo;

import javax.annotation.PostConstruct;

import org.apache.sling.api.resource.Resource;

import org.apache.sling.models.annotations.Model;
@Model(adaptables = Resource.class)

public class Logic {

private String hi;
@PostConstruct

protected void init() {

hi = "Hello World";

}
public String getHi() {

return hi;

}

}
Javalogic
AdaptablewithSlingModels
The Use-API accepts classes that are
adaptable from Resource or Request.
Adobe Experience Manager
Model logic

This logic is not tied to a template and is potentially reusable among components.

It should aim to form a stable API that changes little, even in case of a full redesign.
➔ Java located in OSGi bundle
View logic

This logic is specific to the templates and is likely to change if the design changes.

It is thus a good practice to locate it in the content repository, next to the template.
➔ JavaScript located in component 

If components are to be maintained by front-end devs (typically with Brackets).
➔ Java located in component

If performance is critical (e.g. when many requests are not cached by the dispatcher).
What kind of Use-API?
Adobe Experience Manager
Start simple: first, no code!
OSGi (Model)
Resource
API
Page
API
Content Repository
Component (View)Content Structure
sling:
resourceType
Resource Template
– Sling plays the role of the controller
and resolves the sling:resourceType,
deciding which component will
render the accessed resource.
– The component plays the role of the
view and it’s Sightly template builds
the corresponding markup.
– The Resource and Page APIs play the
role of the model, which are available
from the template as variables.
Adobe Experience Manager
Add logic only where needed
– Model Logic is
needed only if the
logic to access the
data is different to
what existing APIs
provide.
– View Logic is
needed only when
the template needs
additional data
preparation.
OSGi (Model)
Resource
API
Page
API
Model Logic
Content Repository
Component (View)Content Structure
sling:
resourceType data-sly-use
Resource Template View Logic
Adobe Experience Manager
§2 – Enabling the Java Developer
• Getting started

The AEM Project Archetype
• Working efficiently

The AEM Developer Tools
Adobe Experience Manager
AEM Project Archetype
Adobe Experience Manager
Adobe Experience Manager
AEM Project Archetype
https://github.com/Adobe-Marketing-Cloud/aem-project-archetype
Creates a new project with latest best practices prepared
• Separate project structure for bundles, apps, content and tests.
• Sightly components super-typed in apps with corresponding client-libraries.
• OSGi config folder, asset d&d, device emulator, dictionary structure.
• Bundle examples for Sling Models, Servlets, Filters and Schedulers.
• Unit tests, integration tests, and client-side Hobbes tests with dev mode.
Adobe Experience Manager
AEM Developer Tools
Adobe Experience Manager
AEM Developer Tools
https://docs.adobe.com/docs/en/dev-tools/aem-eclipse.html
Gets new Java developers quickly efficient with AEM
• Simple bootstrap of AEM projects via a specific Project Creation Wizard.
• Easy synchronization for both content and OSGI bundles.
• Seamless integration with AEM instances through Eclipse Server Connector.
• Debugging support with code hot-swaping capabiliby.
• JCR properties edition.
Adobe Experience Manager
AEM Developer Tools Sync
Revision Control
(git, svn, etc.)
File System
Content
Repository
Work on file system + transparent sync & content editing
sync
manual pull
Brackets / Eclipse
IDE
auto push
IDE works on

the File System
Adobe Experience Manager
§3 – Enabling the Front-End Dev
• Efficiently converting designs to web

Brackets and the Extract extension
• Working efficiently on AEM projects

Brackets and the AEM extension
Adobe Experience Manager
Brackets
Adobe Experience Manager
Adobe Experience Manager
Brackets
https://docs.adobe.com/docs/en/dev-tools/aem-brackets.html
Brackets and the Extract extension
• Photoshop file support to extract information from a PSD file.
• Code hints from the PSD, to easily reuse this extracted information in the code.
• CSS preprocessor support, like LESS and SCSS.
• And hundreds of additional extensions that cover more specific needs.
Adobe Experience Manager
Brackets
https://docs.adobe.com/docs/en/dev-tools/aem-brackets.html
Brackets and the AEM extension
• Automated synchronization of changed files to the AEM development instance.
• Manual bidirectional synchronization of files and folders.
• Full content-package synchronization of the project.
• Sightly code completion for expressions and data-sly-* block statements.
Adobe Experience Manager
Additional words of wisdom
• Milage may vary, cultivate critical thinking.
• Don’t mix concerns, stick to the language of the file extension.
• Resist complexity, over-architecting is just moving the problem.
• Keep it simple, it’s just a web server.
Adobe Experience Manager
Thank you!
Developer tools:
– Project Archetype

https://github.com/Adobe-Marketing-Cloud/aem-project-archetype
– AEM Eclipse Extension

https://docs.adobe.com/docs/en/dev-tools/aem-eclipse.html
– AEM Brackets Extension

https://docs.adobe.com/docs/en/dev-tools/aem-brackets.html
– Sightly Template Language

http://www.slideshare.net/GabrielWalt/component-development
– Sightly REPL Tool

https://github.com/Adobe-Marketing-Cloud/aem-sightly-repl
– Sightly TodoMVC Example

https://github.com/Adobe-Marketing-Cloud/aem-sightly-sample-todomvc
AEM Best Practices for Component Development

Contenu connexe

Tendances

AEM and Sling
AEM and SlingAEM and Sling
AEM and SlingLo Ki
 
Modernizing Adobe Experience Manager (AEM)
Modernizing Adobe Experience Manager (AEM)Modernizing Adobe Experience Manager (AEM)
Modernizing Adobe Experience Manager (AEM)Gabriel Walt
 
Angular - Chapter 4 - Data and Event Handling
 Angular - Chapter 4 - Data and Event Handling Angular - Chapter 4 - Data and Event Handling
Angular - Chapter 4 - Data and Event HandlingWebStackAcademy
 
Integration patterns in AEM 6
Integration patterns in AEM 6Integration patterns in AEM 6
Integration patterns in AEM 6Yuval Ararat
 
Understanding Sling Models in AEM
Understanding Sling Models in AEMUnderstanding Sling Models in AEM
Understanding Sling Models in AEMAccunity Software
 
Sling models by Justin Edelson
Sling models by Justin Edelson Sling models by Justin Edelson
Sling models by Justin Edelson AEM HUB
 
Angular - Chapter 1 - Introduction
 Angular - Chapter 1 - Introduction Angular - Chapter 1 - Introduction
Angular - Chapter 1 - IntroductionWebStackAcademy
 
HTL(Sightly) - All you need to know
HTL(Sightly) - All you need to knowHTL(Sightly) - All you need to know
HTL(Sightly) - All you need to knowPrabhdeep Singh
 
JCR, Sling or AEM? Which API should I use and when?
JCR, Sling or AEM? Which API should I use and when?JCR, Sling or AEM? Which API should I use and when?
JCR, Sling or AEM? Which API should I use and when?connectwebex
 
Aem dispatcher – tips & tricks
Aem dispatcher – tips & tricksAem dispatcher – tips & tricks
Aem dispatcher – tips & tricksAshokkumar T A
 
Angular interview questions
Angular interview questionsAngular interview questions
Angular interview questionsGoa App
 
AEM & Single Page Applications (SPAs) 101
AEM & Single Page Applications (SPAs) 101AEM & Single Page Applications (SPAs) 101
AEM & Single Page Applications (SPAs) 101Adobe
 
Angular - Chapter 7 - HTTP Services
Angular - Chapter 7 - HTTP ServicesAngular - Chapter 7 - HTTP Services
Angular - Chapter 7 - HTTP ServicesWebStackAcademy
 
Web Worker, Service Worker and Worklets
Web Worker, Service Worker and WorkletsWeb Worker, Service Worker and Worklets
Web Worker, Service Worker and WorkletsKeshav Gupta
 
Introduction to angular with a simple but complete project
Introduction to angular with a simple but complete projectIntroduction to angular with a simple but complete project
Introduction to angular with a simple but complete projectJadson Santos
 

Tendances (20)

AEM and Sling
AEM and SlingAEM and Sling
AEM and Sling
 
Modernizing Adobe Experience Manager (AEM)
Modernizing Adobe Experience Manager (AEM)Modernizing Adobe Experience Manager (AEM)
Modernizing Adobe Experience Manager (AEM)
 
Angular - Chapter 4 - Data and Event Handling
 Angular - Chapter 4 - Data and Event Handling Angular - Chapter 4 - Data and Event Handling
Angular - Chapter 4 - Data and Event Handling
 
Integration patterns in AEM 6
Integration patterns in AEM 6Integration patterns in AEM 6
Integration patterns in AEM 6
 
Understanding Sling Models in AEM
Understanding Sling Models in AEMUnderstanding Sling Models in AEM
Understanding Sling Models in AEM
 
Sling models by Justin Edelson
Sling models by Justin Edelson Sling models by Justin Edelson
Sling models by Justin Edelson
 
Angular Directives
Angular DirectivesAngular Directives
Angular Directives
 
Angular - Chapter 1 - Introduction
 Angular - Chapter 1 - Introduction Angular - Chapter 1 - Introduction
Angular - Chapter 1 - Introduction
 
HTL(Sightly) - All you need to know
HTL(Sightly) - All you need to knowHTL(Sightly) - All you need to know
HTL(Sightly) - All you need to know
 
Angular Data Binding
Angular Data BindingAngular Data Binding
Angular Data Binding
 
JCR, Sling or AEM? Which API should I use and when?
JCR, Sling or AEM? Which API should I use and when?JCR, Sling or AEM? Which API should I use and when?
JCR, Sling or AEM? Which API should I use and when?
 
Aem dispatcher – tips & tricks
Aem dispatcher – tips & tricksAem dispatcher – tips & tricks
Aem dispatcher – tips & tricks
 
Angular
AngularAngular
Angular
 
Angular interview questions
Angular interview questionsAngular interview questions
Angular interview questions
 
AEM & Single Page Applications (SPAs) 101
AEM & Single Page Applications (SPAs) 101AEM & Single Page Applications (SPAs) 101
AEM & Single Page Applications (SPAs) 101
 
Learn react-js
Learn react-jsLearn react-js
Learn react-js
 
Angular - Chapter 7 - HTTP Services
Angular - Chapter 7 - HTTP ServicesAngular - Chapter 7 - HTTP Services
Angular - Chapter 7 - HTTP Services
 
Web Worker, Service Worker and Worklets
Web Worker, Service Worker and WorkletsWeb Worker, Service Worker and Worklets
Web Worker, Service Worker and Worklets
 
Introduction to angular with a simple but complete project
Introduction to angular with a simple but complete projectIntroduction to angular with a simple but complete project
Introduction to angular with a simple but complete project
 
React-JS.pptx
React-JS.pptxReact-JS.pptx
React-JS.pptx
 

Similaire à AEM Best Practices for Component Development

Implementing a Symfony Based CMS in a Publishing Company
Implementing a Symfony Based CMS in a Publishing CompanyImplementing a Symfony Based CMS in a Publishing Company
Implementing a Symfony Based CMS in a Publishing CompanyMarcos Labad
 
Google app development
Google app developmentGoogle app development
Google app developmentAurel Medvegy
 
Google app developers
Google app developersGoogle app developers
Google app developersAurel Medvegy
 
Web software development
Web software developmentWeb software development
Web software developmentAurel Medvegy
 
Google app developer
Google app developerGoogle app developer
Google app developerAurel Medvegy
 
Google apps development
Google apps developmentGoogle apps development
Google apps developmentAurel Medvegy
 
Google apps reseller
Google apps resellerGoogle apps reseller
Google apps resellerAurel Medvegy
 
Cloud service provider
Cloud service providerCloud service provider
Cloud service providerAurel Medvegy
 
Google app engine developer
Google app engine developerGoogle app engine developer
Google app engine developerAurel Medvegy
 
Cloud computing providers
Cloud computing providersCloud computing providers
Cloud computing providersAurel Medvegy
 

Similaire à AEM Best Practices for Component Development (20)

Implementing a Symfony Based CMS in a Publishing Company
Implementing a Symfony Based CMS in a Publishing CompanyImplementing a Symfony Based CMS in a Publishing Company
Implementing a Symfony Based CMS in a Publishing Company
 
Google app development
Google app developmentGoogle app development
Google app development
 
Google app developers
Google app developersGoogle app developers
Google app developers
 
Google development
Google developmentGoogle development
Google development
 
Google app
Google appGoogle app
Google app
 
Web software development
Web software developmentWeb software development
Web software development
 
Google app developer
Google app developerGoogle app developer
Google app developer
 
Google web tools
Google web toolsGoogle web tools
Google web tools
 
Google apps development
Google apps developmentGoogle apps development
Google apps development
 
Google app pricing
Google app pricingGoogle app pricing
Google app pricing
 
Create google apps
Create google appsCreate google apps
Create google apps
 
Google apps reseller
Google apps resellerGoogle apps reseller
Google apps reseller
 
Cloud service provider
Cloud service providerCloud service provider
Cloud service provider
 
Google apps
Google appsGoogle apps
Google apps
 
Google websites
Google websitesGoogle websites
Google websites
 
App engine domain
App engine domainApp engine domain
App engine domain
 
Google appengine
Google appengineGoogle appengine
Google appengine
 
Google app engine developer
Google app engine developerGoogle app engine developer
Google app engine developer
 
Cloud computing providers
Cloud computing providersCloud computing providers
Cloud computing providers
 
Google app software
Google app softwareGoogle app software
Google app software
 

Plus de Gabriel Walt

Managing Omnichannel Experiences with Adobe Experience Manager (AEM)
Managing Omnichannel Experiences with Adobe Experience Manager (AEM)Managing Omnichannel Experiences with Adobe Experience Manager (AEM)
Managing Omnichannel Experiences with Adobe Experience Manager (AEM)Gabriel Walt
 
CQ Provisionning & Authoring
CQ Provisionning & AuthoringCQ Provisionning & Authoring
CQ Provisionning & AuthoringGabriel Walt
 
Web, Mobile, App and Back!
Web, Mobile, App and Back!Web, Mobile, App and Back!
Web, Mobile, App and Back!Gabriel Walt
 
Optimizing HTML5 Sites with CQ5/WEM
Optimizing HTML5 Sites with CQ5/WEMOptimizing HTML5 Sites with CQ5/WEM
Optimizing HTML5 Sites with CQ5/WEMGabriel Walt
 
Three WEM Dev Tricks
Three WEM Dev TricksThree WEM Dev Tricks
Three WEM Dev TricksGabriel Walt
 
Web Apps atop a Content Repository
Web Apps atop a Content RepositoryWeb Apps atop a Content Repository
Web Apps atop a Content RepositoryGabriel Walt
 

Plus de Gabriel Walt (9)

Managing Omnichannel Experiences with Adobe Experience Manager (AEM)
Managing Omnichannel Experiences with Adobe Experience Manager (AEM)Managing Omnichannel Experiences with Adobe Experience Manager (AEM)
Managing Omnichannel Experiences with Adobe Experience Manager (AEM)
 
CQ Provisionning & Authoring
CQ Provisionning & AuthoringCQ Provisionning & Authoring
CQ Provisionning & Authoring
 
Web, Mobile, App and Back!
Web, Mobile, App and Back!Web, Mobile, App and Back!
Web, Mobile, App and Back!
 
Drive dam
Drive damDrive dam
Drive dam
 
Optimizing HTML5 Sites with CQ5/WEM
Optimizing HTML5 Sites with CQ5/WEMOptimizing HTML5 Sites with CQ5/WEM
Optimizing HTML5 Sites with CQ5/WEM
 
CQ 5.4 Deep-Dive
CQ 5.4 Deep-DiveCQ 5.4 Deep-Dive
CQ 5.4 Deep-Dive
 
Crx 2.2 Deep-Dive
Crx 2.2 Deep-DiveCrx 2.2 Deep-Dive
Crx 2.2 Deep-Dive
 
Three WEM Dev Tricks
Three WEM Dev TricksThree WEM Dev Tricks
Three WEM Dev Tricks
 
Web Apps atop a Content Repository
Web Apps atop a Content RepositoryWeb Apps atop a Content Repository
Web Apps atop a Content Repository
 

Dernier

call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in sowetomasabamasaba
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...masabamasaba
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyviewmasabamasaba
 
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With SimplicityWSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With SimplicityWSO2
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnAmarnathKambale
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplatePresentation.STUDIO
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park masabamasaba
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...SelfMade bd
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastPapp Krisztián
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...Shane Coughlan
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionOnePlan Solutions
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is insideshinachiaurasa2
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...masabamasaba
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfkalichargn70th171
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2
 

Dernier (20)

call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With SimplicityWSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
 
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?
 

AEM Best Practices for Component Development

  • 1. Adobe Experience Manager AEM Developer Meetup Utrecht, September 3rd 2015 @GabrielWalt, Product Manager Development Best Practices
  • 2. Adobe Experience Manager Best Practices… Best practices are useful reference points, but they must come with a warning label : The more you rely on external intelligence, the less you will value an internal idea. And this is the age of the idea. ― Gyan Nagpal
  • 3. Adobe Experience Manager Best Practices… Practices that lead to more efficiency • Less project effort • Less operational effort • Less maintenance effort Automotive assembly line, ca. 1920
  • 4. Adobe Experience Manager Separation of Concerns Java Developer – Java/OSGi – Business logic Front-end Developer – HTML – CSS/JS
  • 5. Adobe Experience Manager Design
 HTML/CSS Component Business
 Logic Inefficient Static HTML being
 handed over… Front-end Developer – HTML – CSS/JS Java Developer – Java/OSGi – Business logic Separation of Concerns
  • 6. Adobe Experience Manager Design
 HTML/CSS Component Business
 Logic Front-end Developer – HTML – CSS/JS Java Developer – Java/OSGi – Business logic Efficient APIs to OSGi bundles Separation of Concerns
  • 7. Adobe Experience Manager §1 – Separating concerns http://docs.adobe.com/content/docs/en/aem/6-1/develop/sightly.html
  • 8. Adobe Experience Manager <a href="${properties.link}" data-sly-test="${properties.jcr:title}">
 ${properties.jcr:title}
 </a> Sightly Template Language • Code-less language, forcing strict separation of concerns • Powerful extension points with the Use-API • Automatic contextual HTML escaping and XSS protection • Automatically removes HTML attributes if value is empty • Reuses HTML blocks for statements • On-par performance and scalability with JSP
  • 9. Adobe Experience Manager Initializes a helper object.
 <div data-sly-use.logic="logic.js">${logic.hi}</div> Output:
 <div>Hello World</div> 
 
 
 
 Use Statement
  • 10. Adobe Experience Manager <!-- template.html -->
 <div data-sly-use.logic="logic.js">${logic.hi}</div>
 /* logic.js */
 use(function () {
 return {
 hi: "Hello World"
 };
 }); Server-side JavaScript logic
  • 11. Adobe Experience Manager <!-- template.html -->
 <div data-sly-use.logic="com.myorg.foo.Logic">${logic.hi}</div> /* Logic.java in OSGi bundle */
 package com.myorg.foo;
 import javax.annotation.PostConstruct;
 import org.apache.sling.api.resource.Resource;
 import org.apache.sling.models.annotations.Model; @Model(adaptables = Resource.class)
 public class Logic {
 private String hi; @PostConstruct
 protected void init() {
 hi = "Hello World";
 } public String getHi() {
 return hi;
 }
 } Javalogic AdaptablewithSlingModels The Use-API accepts classes that are adaptable from Resource or Request.
  • 12. Adobe Experience Manager Model logic
 This logic is not tied to a template and is potentially reusable among components.
 It should aim to form a stable API that changes little, even in case of a full redesign. ➔ Java located in OSGi bundle View logic
 This logic is specific to the templates and is likely to change if the design changes.
 It is thus a good practice to locate it in the content repository, next to the template. ➔ JavaScript located in component 
 If components are to be maintained by front-end devs (typically with Brackets). ➔ Java located in component
 If performance is critical (e.g. when many requests are not cached by the dispatcher). What kind of Use-API?
  • 13. Adobe Experience Manager Start simple: first, no code! OSGi (Model) Resource API Page API Content Repository Component (View)Content Structure sling: resourceType Resource Template – Sling plays the role of the controller and resolves the sling:resourceType, deciding which component will render the accessed resource. – The component plays the role of the view and it’s Sightly template builds the corresponding markup. – The Resource and Page APIs play the role of the model, which are available from the template as variables.
  • 14. Adobe Experience Manager Add logic only where needed – Model Logic is needed only if the logic to access the data is different to what existing APIs provide. – View Logic is needed only when the template needs additional data preparation. OSGi (Model) Resource API Page API Model Logic Content Repository Component (View)Content Structure sling: resourceType data-sly-use Resource Template View Logic
  • 15. Adobe Experience Manager §2 – Enabling the Java Developer • Getting started
 The AEM Project Archetype • Working efficiently
 The AEM Developer Tools
  • 16. Adobe Experience Manager AEM Project Archetype Adobe Experience Manager
  • 17. Adobe Experience Manager AEM Project Archetype https://github.com/Adobe-Marketing-Cloud/aem-project-archetype Creates a new project with latest best practices prepared • Separate project structure for bundles, apps, content and tests. • Sightly components super-typed in apps with corresponding client-libraries. • OSGi config folder, asset d&d, device emulator, dictionary structure. • Bundle examples for Sling Models, Servlets, Filters and Schedulers. • Unit tests, integration tests, and client-side Hobbes tests with dev mode.
  • 18. Adobe Experience Manager AEM Developer Tools
  • 19. Adobe Experience Manager AEM Developer Tools https://docs.adobe.com/docs/en/dev-tools/aem-eclipse.html Gets new Java developers quickly efficient with AEM • Simple bootstrap of AEM projects via a specific Project Creation Wizard. • Easy synchronization for both content and OSGI bundles. • Seamless integration with AEM instances through Eclipse Server Connector. • Debugging support with code hot-swaping capabiliby. • JCR properties edition.
  • 20. Adobe Experience Manager AEM Developer Tools Sync Revision Control (git, svn, etc.) File System Content Repository Work on file system + transparent sync & content editing sync manual pull Brackets / Eclipse IDE auto push IDE works on
 the File System
  • 21. Adobe Experience Manager §3 – Enabling the Front-End Dev • Efficiently converting designs to web
 Brackets and the Extract extension • Working efficiently on AEM projects
 Brackets and the AEM extension
  • 23. Adobe Experience Manager Brackets https://docs.adobe.com/docs/en/dev-tools/aem-brackets.html Brackets and the Extract extension • Photoshop file support to extract information from a PSD file. • Code hints from the PSD, to easily reuse this extracted information in the code. • CSS preprocessor support, like LESS and SCSS. • And hundreds of additional extensions that cover more specific needs.
  • 24. Adobe Experience Manager Brackets https://docs.adobe.com/docs/en/dev-tools/aem-brackets.html Brackets and the AEM extension • Automated synchronization of changed files to the AEM development instance. • Manual bidirectional synchronization of files and folders. • Full content-package synchronization of the project. • Sightly code completion for expressions and data-sly-* block statements.
  • 25. Adobe Experience Manager Additional words of wisdom • Milage may vary, cultivate critical thinking. • Don’t mix concerns, stick to the language of the file extension. • Resist complexity, over-architecting is just moving the problem. • Keep it simple, it’s just a web server.
  • 26. Adobe Experience Manager Thank you! Developer tools: – Project Archetype
 https://github.com/Adobe-Marketing-Cloud/aem-project-archetype – AEM Eclipse Extension
 https://docs.adobe.com/docs/en/dev-tools/aem-eclipse.html – AEM Brackets Extension
 https://docs.adobe.com/docs/en/dev-tools/aem-brackets.html – Sightly Template Language
 http://www.slideshare.net/GabrielWalt/component-development – Sightly REPL Tool
 https://github.com/Adobe-Marketing-Cloud/aem-sightly-repl – Sightly TodoMVC Example
 https://github.com/Adobe-Marketing-Cloud/aem-sightly-sample-todomvc