You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

All languages:

  • All source files should include the standard Apache license header.
  • All lines should be limited to 90 characters in width

C++

See the C++ Style Guide

Java

  • Currently undocumented - new code should follow existing style conventions.

Thrift

We don't have a formal style guide, but we do adhere to a few conventions:

  • Structs
    • Struct names begin with a "T", and use a capital letter for each new word, with no underscores.
    • All fields should be declared as either optional or required
    • Don't use semicolons after struct member declarations; they're optional, so we optimize for typing efficiency.
  • Functions
    • Function names start with a capital letter and have a capital letter for each new word, with no underscores.
    • Each function should take exactly one parameter, named FunctionNameParameter, and should return either void or FunctionNameResponse. This convention allows incremental updates.
  • Parameters
    • Parameter names use camel case (with no underscores).
  • Services
    • Service names should end in the word "Service"

Here's an example:

service MetadataRepositoryService {
  TRegisterResponse Register(1: TRegisterRequest request);
}

struct TRegisterRequest {
  1: required list<string> applicationIds
  2: required TNetworkAddress address
}

struct TRegisterResponse {
  1: required set<TMetadatum> metadata
}

 

  

  • No labels