小学一年生の冬休みの宿題で、算数の繰り上がり/繰り下がりのカードがある。
これを毎日やるのが宿題なのだけど、
- 親がカードが捲って
- 子供が答える
- 間違えていたら、後でもう一度やり直し。
という手順になっている。
2の「親が捲る」のが面倒なので、数を足す練習ぐらいならば「自分でできる」ほうが良かろう、と思って iPhone アプリを作ってみた。
例によって、プロトタイプの画面はひどくチープです。
そして、ロジックは、ばかばかしいほど簡単に。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | #import "KidCalcViewController.h" @implementation KidCalcViewController - ( void )didReceiveMemoryWarning { [ super didReceiveMemoryWarning]; // Release any cached data, images, etc that aren't in use. } #pragma mark - View lifecycle int num1, num2, ans; void nextQuest() { num1 = rand() % 9 + 1; num2 = rand() % num1 + (10-num1); ans = num1 + num2; } - ( void )viewDidLoad { [ super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. srand(time( NULL )); nextQuest(); labelCalc.text = [ NSString stringWithFormat: @"%d + %d = " , num1, num2 ]; labelAns.text = [ NSString stringWithFormat: @"%d" , ans ]; labelAns.hidden = YES ; } - ( void )viewDidUnload { [ super viewDidUnload]; // Release any retained subviews of the main view. // e.g. self.myOutlet = nil; } - ( void )viewWillAppear:( BOOL )animated { [ super viewWillAppear:animated]; } - ( void )viewDidAppear:( BOOL )animated { [ super viewDidAppear:animated]; } - ( void )viewWillDisappear:( BOOL )animated { [ super viewWillDisappear:animated]; } - ( void )viewDidDisappear:( BOOL )animated { [ super viewDidDisappear:animated]; } - ( BOOL )shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { // Return YES for supported orientations if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) { return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown); } else { return YES ; } } -( IBAction )buttonCalcClick:( id )sender { labelAns.hidden = NO ; } -( IBAction )buttonNextClick:( id )sender { nextQuest(); labelCalc.text = [ NSString stringWithFormat: @"%d + %d = " , num1, num2 ]; labelAns.text = [ NSString stringWithFormat: @"%d" , ans ]; labelAns.hidden = YES ; } @end |
娘に見せて、まぁ評判が良かったら、画像なり色なりを付けてリリースすれば、この冬「相手をしなくてよいか」と画策したのだが、娘曰く
「自分でやって、自分で答えをみると、『ああ、そうか』だけで詰まらない」
「親とやりとりしているのが楽しい」
のだそうだ。
まぁ、そりゃそうだろうな。自分でやってみても「ひどく面白くなかった」ので。IT が埋められないもの(かな?)が其処にある、という話。
親としては、iPhone プログラミングをしている間は「楽しい」のだが、いざ使ってみると「詰まらない」という具合。製作者の楽しみは、利用者の楽しみとイコールではない。かつ、製作者の利便性と、利用者の利便性もイコールではないという話。
当然、少しでもイコールに近づけたいのが「アジャイルだ」と思いたい。