concept list in category apache thrift

This is an excerpt from Manning's book Programmer's Guide to Apache Thrift.
The number of programming languages in common commercial use has grown considerably in recent years. In 2003, 80% of the Tiobe Index (http://www.tiobe.com/index.php/tiobe_index) was attributed to six programming languages: Java, C, C++, Perl, Visual Basic, and PHP. In 2013, it took nearly twice as many languages to capture the same 80%, adding Objective-C, C#, Python, JavaScript, and Ruby to the list (see figure 1.1). In early 2016 the entire Tiobe top 20 didn’t add up to 80% of the mind share. In Q4 2015, Github reported 19 languages all having more than 10,000 active repositories (http://githut.info/), adding Swift, Go, Scala, and others to the list.
Semantics should be made explicit in the interface syntax when possible. This minimizes the need for documentation and allows the compiler to enforce the semantics. Descriptive names and wise use of types and type definitions contribute greatly to highly explicit interfaces. For example, if a timing function for a boat race accepts a collection of boats to time, but the list must contain no boat more than once, the interface should prefer a declaration such as set<i32> boats over list<i32> boats. The set container type makes the unique requirement explicit. Great interfaces are hard to use incorrectly.
Listing 6.1. ~/ThriftBook/part2/IDL/fish_trade.thrift
/** Apache Thrift IDL definition for the Fish Market TradeHistory service */ namespace * FishTrade enum Market { Unknown = 0 Portland = 1 Seattle = 2 SanFrancisco = 3 Vancouver = 4 Anchorage = 5 } typedef double USD struct TimeStamp { 1: i16 year 2: i16 month 3: i16 day 4: i16 hour 5: i16 minute 6: i16 second 7: optional i32 micros } union FishSizeUnit { 1: i32 pounds 2: i32 kilograms 3: i16 standard_crates 4: double metric_tons } struct Trade { 1: string fish //The symbol for the fish traded 2: USD price //Price per size unit 3: FishSizeUnit amount //Amount traded 4: TimeStamp date_time //Date/time trade occured 5: Market market=Market.Unknown//Market where trade occured } exception BadFish { 1: string fish //The problem fish 2: i16 error_code//The service specific error code } exception BadFishes { 1: map<string, i16> fish_errors//The problem fish:error pairs } service TradeHistory { /** * Return most recent trade report for a fish type * * @param fish the symbol for the fish traded * @return the most recent trade report for the fish * @throws BadFish if fish has no trade history or is invalid */ Trade GetLastSale(1: string fish) throws (1: BadFish bf) /** * Return most recent trade report for multiple fish types * * @param fish the symbols for the fish to return trades for * @param fail_fast if set true the first invalid fish symbol is thrown * as a BadFish exception, if set false all of the bad * fish symbols are thrown using the BadFishes * exception. If no bad fish are passed this parameter * is ignored. * @return list of trades cooresponding to the fish supplied, the list * returned need not be in the same order as the input set and * a given input fish type may have multiple trades in the * output list due to simultanious transactions * @throws BadFish first fish discovered to be invalid or without a * trade history (only occurs if fail_fast=true) * @throws BadFishes all fish discovered to be invalid or without a * trade history (only occurs if fail_fast=false) */ list<Trade> GetLastSaleList(1: set<string> fish 2: bool fail_fast=false) throws (1: BadFish bf 2: BadFishes bfs) }
Apache Thrift IDL supports three container types:
- list
- set
- map