blog logo
[ultimatesocial count="true" networks="linkedin,facebook,twitter" url="" skin="minimal"]

5 Focus Areas for Back-End Code Review in Demandware

Shane Soifert • December 16, 2015

By Shane Soifert, Technical Lead

Peer code review is crucial to creating and maintaining a code base that’s up-to-date, performance-driven and well documented.  As a Demandware developer, I appreciate that identifying bugs and defects before Quality Assurance testing can greatly reduce the amount of work needed to get an eCommerce site up and running. That’s why I wanted to pass along these five areas to focus on for a back-end code review in Demandware.

When conducting a code review, I advise breaking it up into sub-sections. Because reviews become less effective as the inspector loses focus, a good rule of thumb is no more than 500 lines in an hour, not including pipeline line coordinates.


Reviewing pipeline XML can be a very tedious and often difficult task.  I suggest that you focus on scripts, variable (key-binding-alias), pipelet and node changes. The reviewer can easily find changes by using the filter search in the outline elements table section in Eclipse.

A good tip for variable modifications or additions is to make sure the developer accounts for possible null references in object hierarchy. Take the case where a custom attribute value is needed, but it’s nested deep within the top level object such as Basket.getCouponLineItem(“coupon1”).getCustom().systemsCode.  The method “getCouponLineItem” may throw an error since the code is trying to access a value from a null reference.  Using shorthand conditional logic, we can prevent the error. Doing so produces an alternative result if the coupon line item object does not exist. For example: Basket.getCouponLineItem(“coupon1”) != null ? Basket.getCouponLineItem(“coupon1”).getCustom().systemsCode : “”;


Calculating performance by looking at the code can prove to be a difficult task since it’s not very intuitive. Instead, I recommend using pipeline profiling and browser tools to check performance. This works best for major structural changes, integrations or large features.

To keep an eCommerce site performing well, even under heavy load, it’s best to minimize unnecessary code, reduce making calls to the application layer, and maximize the use of full- or partial-page caching techniques.

One way to remove unnecessary code is writing conditional logic to bypass code that’s not going to be used or not instantiating variables until the developer is positive the variable will need to be used. Another example is to break continued looping if the code already has the information that’s needed.


Make sure you provide documentation for the code. This is crucial for continued maintenance and usability because it prevents developers from wasting time trying to figure out what the code is supposed to do.

All pipeline start nodes must contain a text block stating the purpose of the pipeline. Demandware requires that scripts contain a header text block explaining the use of the script, input and output parameters, as well as other information useful to developers.

Two Other Areas of Focus

While not part of a standard code review, I recommend adding a check of Error Logs as well as Quota and Deprecation Logs. Demandware will reject certain requests if quotas are exceeded.

  • Error Logs – Shorthand conditional logic helps alleviate errors. However, you need to consider what happens when you remove the error so as to prevent creating other errors down the road. Consider code that produces an empty string instead of throwing an error triggering the catch block. A reviewer must make sure the empty string will not create another issue, later on, that was alleviated by triggering the catch block logic.
  • Quota and Deprecation Logs – The quota section should be checked first to analyze the site for warnings or current violations related to performance and scalability. Quota violations can be difficult to fix if they require moving certain integrations and making major structural changes. The deprecation logs show methods that have been replaced with an updated version such as fixes for a major bug, new code structure, and performance.

Closing Thoughts

Back-end code review can streamline the development process and catch bugs that might go undetected through testing and production. It’s crucial to keep all code streamlined to make it easy for developers after the project launches.

One other important piece of code reviews, sometimes overlooked, is that the reviewer’s code also needs to be peer reviewed.

Keep in mind that no matter how great looking an eCommerce site is, it still needs to do what you want it to do behind the scenes.  If you have any questions about how development best practices can enhance a website project, please contact LYONSCG.

Related Reading: 7 Focus Areas for Front-End Development Code Review in Deamndware

Shane Soifert is a Technical Lead on the LYONSCG implementation team and has been building Demandware websites since 2011. He loves nothing more than enjoying the ocean in the summer and skiing or snowmobiling in the winter.

Shane Soifert

About the author

Shane Soifert

Subscribe to our blog

Let's discuss the next step in your commerce journey.

XSchedule a meeting