cancel
Showing results for 
Search instead for 
Did you mean: 

SAP's JavaScript Programming Style

former_member268137
Participant
0 Kudos

Hi guys,

I'm digging into some SAPUI5 standard coding at the moment and I can't help wondering about SAP's programming style...

Look at that extract from the "cross.fnd.fiori.inbox.util.ConfirmationDialogManagerInbox" for example:

        _createConfirmationDialog: function(n, q, t, b, s) {
            var c;
            if (s) {
                c = [new T({
                    text: q
                }), new a("confirmDialogTextarea",{
                    liveChange: function(e) {
                        var f = e.getParameter('value');
                        var o = e.getSource().getParent();
                        o.data("note", f);
                        if (n) {
                            o.getBeginButton().setEnabled(f.length > 0);
                        }

As you can see, SAP likes to use only single letters as variable names. And I'm just wondering: is this standard JavaScript nomenclature? Does anybody understand this type of code? ("c is a new T with the text q"). I mean look at the signature alone: function(n, q, t, b, s) - Are you kidding me?!


What are your thoughts on this programming style? Am I too biased from the ABAP guidelines? Am I just out of the loop? Or is it really that "ugly"?


BR, Klaus

Accepted Solutions (1)

Accepted Solutions (1)

maheshpalavalli
Active Contributor

Actually if you use SAP Cloud Webide to push the app to server, then by default SAP will minify the code( For reducing the payload of the application). But if you look for other files, you can find -dbg files, which are the original files.

So SAP will put the original files in -dbg files and put the minified code in the actual file.

https://help.sap.com/doc/saphelp_tm92/9.2/de-DE/af/e809bf2a5b482e9c87974ffe5130b7/frameset.htm

Best Regards,

Mahesh

former_member268137
Participant

Hi Mahesh,

I didn't know that - thank you for your answer! I will try out the debug mode next time!

BR, Klaus

Answers (2)

Answers (2)

former_member306541
Participant
mariusobert
Developer Advocate
Developer Advocate

Hi Klaus,

I'm happy to help you here. Can I ask where you found this snippet? This code looks "minified" which is a common practice to improve the performance of webapps.

I can hardly imagine that this is the "real" code which needs to be maintained by anyone.

Regards,

Marius

former_member268137
Participant

Hi Marius,

that makes sense! Thanks for clarifying. I found this snippet while debugging the Inbox.

BR, Klaus