Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Coding standards for xsjs by following javascript design patterns. Is that a way to write efficient code ?

I have been using Hana's server side javascript XSJS for a while. Me primarily coming from a javascript background, i try to write quite efficient, modularized code in javascript. For that the solid & proven way is to follow some of the javascript design patterns. (Learning JavaScript Design Patterns)


Ex-

  • Constructor Pattern
  • Module Pattern
  • Revealing Module Pattern
  • Singleton Pattern
  • Mediator Pattern
  • Prototype Pattern

But with xsjs, surprisingly i haven't found anyone implementing those in their project's code or in the code samples. With xsjslib there comes an option for reusability, but i still find many of the approaches there is to simply create everything as functions.

As i'm trying to follow these pattern on my xsjs/xsjslib code, i would like to get few tips from the experts out here to know whether this is the best way to write a efficient,maintainable,reusable code or is this kind off overhead with xsjs. I sometimes wonder is this just because of developers in SAP ecosystem usually aren't from javascript background and don't really make the best use of javascript !

-Sakthivel

Tags:
Former Member
Not what you were looking for? View more on this topic or Ask a question