<commit_before>
あなたといたら いつまでも
心の波が 揺れ動く
歴史に残る 歌詠みに
なれる気にすら なれるほど
#shichigo

フェードアウトは もう無理と
思えるくらい 前に出て
会えなくなる日 近づいて
どうしていいか 分からない
#shichigo

届かぬ思い そのままに
歌でも詠んで 忘れよう
春の陽の下 麗しい
花を眺めた 昼下がり
#shichigo

あなたと過ごす 昼下がり
おいしいランチ 食べながら
何気ないこと 言いながら
過ごした時は 輝いて
# shichigo

時計の針は それほどに
動いてないと 思うけど
心の波は どれほどに
動いた事か 分からない
#shichigo

あなたと過ごす 午後の時
時計でみれば 短いが
他の誰かと 過ごしてた
どんな時より 長かった
#shichigo



plugin -> service


straw-ios-http-service
straw-ios-http-service.js

/**
 * STWServiceCall is the model class of the Service Method call from Browser.
 *
 * @layer Domain
 */
@interface STWServiceCall : NSObject

@property (nonatomic, retain) NSNumber *callId;
@property (nonatomic, retain) NSString *service;
@property (nonatomic, retain) NSString *method;
@property (nonatomic, retain) BOOL *success;

@end



/**
 * STWServiceCallFactory is the factory class of STWServiceCall objects.
 *
 * @layer Domain
 */
@interface STWServiceCallFactory : NSObject
+ (STWServiceCall *)createFromJSON:(JSONObject *)json;
@end

/**
 * STWService is the protocol conformed by Straw Service implementations.
 *
 * @layer Domain
 */
@protocol STWService <NSObject>

- actionCall:(STWCall *)call;

@end

/**
 * STWServiceCallContext is a context of a single Service Method call.
 * Service authers can succeed or fail Service Method Call using this class.
 *
 * @layer Application
 */
@protocol STWServiceCallContext <NSObject>

@property (nonatomic, assign, readonly) UIViewController *viewController
@property (nonatomic, assign, readonly) UIWebView *webView;
@property (nonatomic, retain, readonly) STWServiceCall *call;

- (void)succeed;
- (void)succeedWithString:(NSString *)value;
- (void)succeedWithNumber:(NSNumber *)value;
- (void)succeedWithJSON:(JSONObject *)value;

- (void)failWithCode:(NSNumber *)code withMessage:(NSString *)message;

@end

/**
 * STWServiceRepository is the repository class of id <STWService>.
 *
 * @layer Domain
 */
@interface STWServiceRepository : NSObject

@property (nonatomic, retain, readonly)
@end


/**
 * ExampleService is a example of Service implementation
 *
 * @layer Service
 */
@interface ExampleService <StrawService> : NSObject
- (void)action:(JSONObject *)params withContext:(STWServiceContext *)context;
@end

@implementation ExampleService
- (void)action:(JSONObject *)arg withContext:(STWServiceCallContext *)context {
    if ([self blah]) {
        [context succeed];

    } else if ([self blahblah]) {
        [context succeedWithObject:@{@"a": @123}];

    } else {
        [call failWithCode:@123 withMessage:@"example failed!"];
    }
}
@end


- (void)callService:(id <STWService>)service withContext(id <STWServiceCallContext>)context
{
    STWServiceCall *call = context.serviceCall;

    // Service Method must have the form of
    // `- (void)methodName:(NSDcitionary *)params withCall:(id <STWServiceCallContext>)`
    NSString *methodName = [NSString stringWithFormat:@"%@:withContext:", call.method];

    // create the selector for Service Method
    SEL selector = NSSelectorFromString(methodName);

    if ([service respondsToSelector:selector]) {

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Warc-performSelector-leaks"

        // invoke Service Method
        [service performSelector:selector withObject:call.params withObject:context];

#pragma clang diagnostic pop

    } else {
        // TODO: log error
    }
}

@interface STWNativeWebViewBridge : NSObject

+ (NSString *)createNativeToBrowserMessage:(NSDictionary *)params;
+ (NSString *)retrieveRequestObjectForCallId:(NSString *)callId;

@end

A service can be either stateful or stateless.
That's why the naming of `Straw Service Method`.
Reusable services should be most likely stateless.
Application specific services can be stateful.


Service - a bundle of series of functions.
Service Method - a functionality of a service.
Service Call - a call of Service Method.
Service Call Context - a context of a call of Service Method

Service Repository - repository of services
Service Call Factory - factory of service call object

----

The Domain Services should never touch the Application layer.
(But specific service implementations can touch the application layey,
because they are half-application.)

Do people really want stateful services?

----

TODO:
- LogError on call factory failures.
- .podspec of straw-ios

- infra
  - straw service registry
    - mongodb, heroku

- services:
  - log servcie
    - log on each level
  - http service
  - kvdb service (corresponding to sharedPreferences service of straw-android)
    - based on https://github.com/colinyoung/kvdb
  - hud servcie (corresponding to toast service of straw-android)
    - based on MPProgressHUD


- STWWebView, STWViewController (in Wrapper group)

- whatsmyip-ios
  - implement existing feature
  - add some achievements

- refactor straw-android completely
  - separate domain and application according to straw-ios
    - remove StrawDrink and instead of that create StrawCallContext interface and StrawCallOperation class (which implements StrawCallContext)
  - rename `plugin` to `service`

- next application!

DONE:
- implementation - done
- tests - done
- define interfaces - almost done
- build on xcode 5.1
- STWServiceFactory
- log - done

[END]
<commit_msg>Update memo<commit_after>
あなたといたら いつまでも
心の波が 揺れ動く
歴史に残る 歌詠みに
なれる気にすら なれるほど
#shichigo

フェードアウトは もう無理と
思えるくらい 前に出て
会えなくなる日 近づいて
どうしていいか 分からない
#shichigo

届かぬ思い そのままに
歌でも詠んで 忘れよう
春の陽の下 麗しい
花を眺めた 昼下がり
#shichigo

あなたと過ごす 昼下がり
おいしいランチ 食べながら
何気ないこと 言いながら
過ごした時は 輝いて
# shichigo

時計の針は それほどに
動いてないと 思うけど
心の波は どれほどに
動いた事か 分からない
#shichigo

あなたと過ごす 午後の時
時計でみれば 短いが
他の誰かと 過ごしてた
どんな時より 長かった
#shichigo

もはやあの人と 過ごしてた
5年の時の 重みより
今や君との 数回の
食事の時の 思い出が
#shichigo

今の僕には 輝いて
夏の陽のように 輝いて
命の水の わき上がる
泉のように 大事なの
#shichigo




plugin -> service


straw-ios-http-service
straw-ios-http-service.js

/**
 * STWServiceCall is the model class of the Service Method call from Browser.
 *
 * @layer Domain
 */
@interface STWServiceCall : NSObject

@property (nonatomic, retain) NSNumber *callId;
@property (nonatomic, retain) NSString *service;
@property (nonatomic, retain) NSString *method;
@property (nonatomic, retain) BOOL *success;

@end



/**
 * STWServiceCallFactory is the factory class of STWServiceCall objects.
 *
 * @layer Domain
 */
@interface STWServiceCallFactory : NSObject
+ (STWServiceCall *)createFromJSON:(JSONObject *)json;
@end

/**
 * STWService is the protocol conformed by Straw Service implementations.
 *
 * @layer Domain
 */
@protocol STWService <NSObject>

- actionCall:(STWCall *)call;

@end

/**
 * STWServiceCallContext is a context of a single Service Method call.
 * Service authers can succeed or fail Service Method Call using this class.
 *
 * @layer Application
 */
@protocol STWServiceCallContext <NSObject>

@property (nonatomic, assign, readonly) UIViewController *viewController
@property (nonatomic, assign, readonly) UIWebView *webView;
@property (nonatomic, retain, readonly) STWServiceCall *call;

- (void)succeed;
- (void)succeedWithString:(NSString *)value;
- (void)succeedWithNumber:(NSNumber *)value;
- (void)succeedWithJSON:(JSONObject *)value;

- (void)failWithCode:(NSNumber *)code withMessage:(NSString *)message;

@end

/**
 * STWServiceRepository is the repository class of id <STWService>.
 *
 * @layer Domain
 */
@interface STWServiceRepository : NSObject

@property (nonatomic, retain, readonly)
@end


/**
 * ExampleService is a example of Service implementation
 *
 * @layer Service
 */
@interface ExampleService <StrawService> : NSObject
- (void)action:(JSONObject *)params withContext:(STWServiceContext *)context;
@end

@implementation ExampleService
- (void)action:(JSONObject *)arg withContext:(STWServiceCallContext *)context {
    if ([self blah]) {
        [context succeed];

    } else if ([self blahblah]) {
        [context succeedWithObject:@{@"a": @123}];

    } else {
        [call failWithCode:@123 withMessage:@"example failed!"];
    }
}
@end


- (void)callService:(id <STWService>)service withContext(id <STWServiceCallContext>)context
{
    STWServiceCall *call = context.serviceCall;

    // Service Method must have the form of
    // `- (void)methodName:(NSDcitionary *)params withCall:(id <STWServiceCallContext>)`
    NSString *methodName = [NSString stringWithFormat:@"%@:withContext:", call.method];

    // create the selector for Service Method
    SEL selector = NSSelectorFromString(methodName);

    if ([service respondsToSelector:selector]) {

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Warc-performSelector-leaks"

        // invoke Service Method
        [service performSelector:selector withObject:call.params withObject:context];

#pragma clang diagnostic pop

    } else {
        // TODO: log error
    }
}

@interface STWNativeWebViewBridge : NSObject

+ (NSString *)createNativeToBrowserMessage:(NSDictionary *)params;
+ (NSString *)retrieveRequestObjectForCallId:(NSString *)callId;

@end

A service can be either stateful or stateless.
That's why the naming of `Straw Service Method`.
Reusable services should be most likely stateless.
Application specific services can be stateful.


Service - a bundle of series of functions.
Service Method - a functionality of a service.
Service Call - a call of Service Method.
Service Call Context - a context of a call of Service Method

Service Repository - repository of services
Service Call Factory - factory of service call object

----

The Domain Services should never touch the Application layer.
(But specific service implementations can touch the application layey,
because they are half-application.)

Do people really want stateful services?

----

TODO:
- LogError on call factory failures.
- .podspec of straw-ios

- infra
  - straw service registry
    - mongodb, heroku

- services:
  - log servcie
    - log on each level
  - http service
  - kvdb service (corresponding to sharedPreferences service of straw-android)
    - based on https://github.com/colinyoung/kvdb
  - hud servcie (corresponding to toast service of straw-android)
    - based on MPProgressHUD


- STWWebView, STWViewController (in Wrapper group)

- whatsmyip-ios
  - implement existing feature
  - add some achievements

- refactor straw-android completely
  - separate domain and application according to straw-ios
    - remove StrawDrink and instead of that create StrawCallContext interface and StrawCallOperation class (which implements StrawCallContext)
  - rename `plugin` to `service`

- next application!

DONE:
- implementation - done
- tests - done
- define interfaces - almost done
- build on xcode 5.1
- STWServiceFactory
- log - done

[END]

{'fraction_non_alphanumeric': 0.08996149873227532, 'fraction_numerical': 0.0015963940276082261, 'mean_word_length': 4.349070818684078, 'pattern_counts': {'":': 2, '<': 17, '<?xml version=': 0, '>': 19, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '578701', 'n_tokens_mistral': 3713, 'n_tokens_neox': 3479, 'n_words': 1069}