2

I have a frontend service written in javascript and a backend service written in python.

My question is what is the naming convention to be used when sending data between the services; specifically are payload keys to use camel case notation or be underscore delimited?

In either case one of the services ends up breaking naming convention and create an inconsistent appearance to code. I'm not sure if there is an established convention for this yet or a general consensus, but would appreciate any information, thoughts, and opinions on this.

Arkkra
  • 21
  • 2

2 Answers2

0

Naming conventions are generally company/team-defined.

Douglas Crockford has some great naming conventions for JavaScript, which can be ensured by using JSLint or JSHint (or even ESLint).

Python follows the PEP8 Style Guide, which widely differs from JavaScript's syntax.

Use the established naming conventions for the JavaScript code, and PEP 8 for the Python code. The actual passing of the data between JavaScript and Python should be handled by making an AJAX request that passes JSON data.

JSON has its own validator, which can be found at JSONLint.

Hope this helps! :)

Obsidian Age
  • 41,205
  • 10
  • 48
  • 71
  • I think your somewhat missing the point of the question. The OP is asking about a naming convention for passing data between the two programs e.g JSON. He's asking what naming convention should be used in the intermediate data. (BTW, I didn't downvote). – Christian Dean Oct 10 '17 at 23:44
  • 1
    Thanks for the extra clarity; I did initially not think of that. I've updated the answer to expand on that :) Still not sure on the downvote though :P – Obsidian Age Oct 10 '17 at 23:48
0

Short answer: Any naming convention is as good as any but the most important part is having consistency. There was a good answer to a similar question here.

Andresson
  • 1,257
  • 10
  • 15