-3

This is the documentation with the original RPC client API specification. The naming convention in the specification is camel case.

Naming conventions might differ in subtle ways for different languages (camel case vs. pascal case), but for some conventions like snake case (Python) or Swift's Fluent Usage API changing the names in the original specification might increase the cognitive load when using the API for those already familiar with the specification.

When searching for different JSON RPC APIs on GitHub, some implementations seem to take advantage of reflection to intercept method calls and pass them to RPC request "as is" so method names for that language are the same as in the original spec. If reflection is not available the names are hardcoded and are mostly the same as the spec, changing only the capitalization of letters for some languages.

Some examples:

Not using Fluent Design in Swift

https://github.com/fanquake/CoreRPC/blob/master/Sources/CoreRPC/Blockchain.swift https://github.com/brunophilipe/SwiftRPC/blob/master/SwiftRPC/SwiftRPC+Requests.swift

Not using snake case in Ruby

https://github.com/sinisterchipmunk/bitcoin-client/blob/master/lib/bitcoin-client/client.rb

Changing method names to pascal case in C#

https://github.com/cryptean/bitcoinlib/blob/master/src/BitcoinLib/Services/RpcServices/RpcService/RpcService.cs

5
  • Seems like you forgot to include the actual question :)
    – Duroth
    Aug 20, 2020 at 14:42
  • @Duroth Thanks. Added the question in the title.
    – rraallvv
    Aug 20, 2020 at 14:44
  • Could someone please point out what's wrong with this question? (a.k.a. why the downvote?)
    – rraallvv
    Aug 20, 2020 at 15:16
  • 2
    Haven't the conventions provided in your links answered your question already? What more would you like to know about this?
    – Dan Wilson
    Aug 20, 2020 at 20:26
  • @DanWilson I can't tell for sure whether people already familiar with the specification would be the majority of users, in which case I could use the names given in the original spec.
    – rraallvv
    Aug 21, 2020 at 1:07

1 Answer 1

0

It unclear what you mean here.

You can't write a client for multiple languages, its a client for language X and you should follow languages X's naming conventions.

If you are writing an api, then use the conventions for the format of the data transfer. JSON would conventionally use javascript conventions ie camel case.

But its unimportant as everyone will be using a client of some sort to access your api. They will never see your names

1
  • I didn't ask about writing a client for multiple languages, I said designing a client, there is a difference, you can design an API intended to have implementations in multiple languages. Also in the question there is a very popular implementation of a client library that doesn't follow the programming language naming convention.
    – rraallvv
    Aug 21, 2020 at 21:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.