Ognacの雑感

木漏れ日々

目次

Blog 利用状況

書庫

ギャラリ

登録時の整合性チェックと確認メッセージのタイミング

 (RDBのレコード更新/追加のアプリを想定してます。)
データの登録機能のときDBや業務ルールの整合性のチェックを行いますね。(中にはノーチェックの場合もあるかも知れませんが)
 登録SQLを発行する前に、UIレベルで可能な範囲のチェックをします。入力可能文字とか範囲とかマスタ存在Checkとか。
 RDBの項目制約(x<100とか ="A"  = "B" など)を設定している場合は、Insert/Update文を発行して、結果で判断することもありまずが、それは最終判定として有効ですがトラフィック(サーバーとのやり取りが)やトランザクションの維持やなどでサーバーに負荷がかかるのでアプリ内で判断できる範囲は、アプリ内で行うのが良いと考えます。
 ボタンを押して、いきなり登録処理を走らせるのはよくないですよね(このケースもありますが)。確認ボタンの存在が望ましいです。そのタイミングの話です。

①1:登録/変更ボタンのClick
  2:MessageBox.Show("登録確認","Yes/No")
  3:Noの時 : exit
  4:  エラーチェック
  5:Errorがあるとき:    MessageBox.Show("  xxxの値がおかしいよ") : Return
  6:  SQL 発行
  7:Errorがあるとき     MessageBox.Show("  RDBでError発生")      : Return
  8:  MessageBox.Show("登録しました")

②1:登録/変更ボタンのClick
  2:エラーチェック
  3:Errorがあるとき:    MessageBox.Show("  xxxの値がおかしいよ") : Return
  4:MessageBox.Show("登録確認","Yes/No"))
  5:Noの時 : exit
  6:SQL 発行
  7:Errorがあるとき     MessageBox.Show("  RDBでError発生")      : Return
  8:MessageBox.Show("登録しました")

"登録確認" メッセージの出すタイミングがエラーチェックの前後のどちらかなんですが、確認の意味合いが違う気がします。
①は登録ボタンをClickした事の確認で、"今から登録作業に入ります。いいですか?" と聞こえます。
②はエラーが無いので"実登録に入ります"と聞こえます。
私としては、②は実装したことが無かったので、目新しく感じました。

②だと常にエラーチェックが走ります。誤操作で登録キーを押しても走ります。
チェックコストの長短はありますが冗長感がして、①を推奨してます。
開発をばらまいて、仕上がってきた個々のアプリをみると①と②が混在している時があります。明記や統一をしなかった設計側の原因なので、文句はいえません。依頼して統一しました。
統一してないと、エンドユーザーはこの辺りのUIの違いには敏感で、不安感を持たれたりします。
人は自分の経験した姿をデフォル基準とする傾向があるので、明記しないとバラつきがでます。
(*)某パッケージで "会計システムは①" 、"販売管理は②"というのがありました。
   プロジェクト単位で統一しても、全社単位では不統一になることもしばしば、作成時期にも左右されるし。PM/SEの感覚の問題もあるし。
   少し疑問を感じたものです。
UIの統一は適用が難しいです。確認ダイアログ画面でも、キャンセルボタンとESCキーが連動していないと違和感を覚えますし。(私だけ?)
。自分の作成物も統一してないし....orz.

投稿日時 : 2007年12月6日 0:13

Feedback

# re: 登録時の整合性チェックと確認メッセージのタイミング 2007/12/06 0:46 やじゅ

私も過去に似たようなネタを書きました。
入力チェックと登録確認メッセージの処理順
http://blogs.wankuma.com/yaju/archive/2007/11/01/105540.aspx

私の場合は、②の方を推奨しました。
複数箇所の項目で入力エラーがあるたびに、
確認メッセージが出ることになり、うざいためです。

# re: 登録時の整合性チェックと確認メッセージのタイミング 2007/12/06 1:04 中博俊

1か・・・
エラーチェックもプレゼン層のチェック、ビジネス層のチェック、データ層のチェックといろいろあるので、難しい。

ASP.NETは
1:登録/変更ボタンのClick
2:Client:エラーチェック
3:Client:Errorがあるとき: MessageBox.Show(" xxxの値がおかしいよ") : Return
4:Client:MessageBox.Show("登録確認","Yes/No"))
5:Client:Noの時 : exit
6:Server:エラーチェック
7:Server:Errorがあるとき: MessageBox.Show(" xxxの値がおかしいよ") : Return
8:Server:ビジネス層チェック
9:Server:データ層チェック(ロックとかFK違反とか)
10:Server:更新SQL 発行
11:Server:Errorがあるとき MessageBox.Show(" RDBでError発生") : Return
12:Server:MessageBox.Show("登録しました")

# re: 登録時の整合性チェックと確認メッセージのタイミング 2007/12/06 9:00 やじゅ

もう一点、エラーではなく警告だった場合
①では、登録確認ダイアログしたあとに、警告で
続行確認ダイアログが出ることになりますが、
例 ・登録しますか?
  ・○○が超えています、登録しますか?
②では、警告と登録確認ダイアログが同一メッセージ
で出せたりします。
例 ○○が超えています、登録しますか?

# re: 登録時の整合性チェックと確認メッセージのタイミング 2007/12/06 10:30 れい

私も2かな。

ユーザー視点で考えると。

登録する直前に確認したい。
エラーは登録確認の前に確認したい。
複数層ある場合、全層のエラーチェック終わった後に確認したい。

確認したら確実に登録したい。

プログラマ視点だと、そんなのやりたくないってなるんですが。

# re: 登録時の整合性チェックと確認メッセージのタイミング 2007/12/06 11:05 まさる

私も2が好みです。

項目エラーがあった場合、1だと「確認したくせになんだよ。登録出来ねぇじゃねーか。」って気分になります。

# re: 登録時の整合性チェックと確認メッセージのタイミング 2007/12/06 12:02 Ognac

コメントありがとうございます。
>私も過去に似たようなネタを書きました。
 気になりますよね。 読み落としていました。失礼しました。
>例 ○○が超えています、登録しますか?
>私の場合は、②の方を推奨しました。
>1か・・・
>私も2かな。
>私も2が好みです。

②が多数派なんですね。チェックルーチンが都度走るのはプログラムが冗長なだけで、ユーザー感覚で、登録可能になってから確認するほうが理に叶っている...ような気がしてきました。(優柔不断ですがwwww)

更新SQL発行時に RDBの制約違反などでエラーになった場合、 「 xxxxの値がおかしい」と表示することになるので、
>「確認したくせになんだよ。登録出来ねぇじゃねーか。」
の状態になりますね。
難しいものですね。考えなくちゃ。結論はでそうにないですが。

# re: 登録時の整合性チェックと確認メッセージのタイミング 2007/12/06 13:54 NAL-6295

私も②が好みですが、②の場合、5と6の工程の間にもう一度2の工程を入れたいです。

# re: 登録時の整合性チェックと確認メッセージのタイミング 2007/12/06 21:06 Ognac

>5と6の工程の間にもう一度2の工程を入れたいです
二度走るのを良しとします?

# re: 登録時の整合性チェックと確認メッセージのタイミング 2007/12/07 1:18 NAL-6295

確認ダイアログを出す前にチェックをするのはユーザの利便性のためで、確認ダイアログを閉じてからチェックするのは本来のエラーチェックのためだと思っています。
確認ダイアログって出しっぱなしにできるし、タイムラグが大きいですよね。
だから、全く同じ検証を確認ダイアログの前と更新の直前で2度やるようにしています。

もし、2度走るのを良しとしないなら、①の確認ダイアログ
後にエラーチェックをする事を選択します。

# This is very attention-grabbing, You are an overly professional blogger. I've joined your feed and look ahead to searching for extra of your magnificent post. Also, I have shared your website in my social networks 2021/08/30 17:27 This is very attention-grabbing, You are an overly

This is very attention-grabbing, You are an overly professional blogger.
I've joined your feed and look ahead to searching for extra of
your magnificent post. Also, I have shared your
website in my social networks

# My spouse and I stumbled over here coming from a different web page and thought I might as well check things out. I like what I see so i am just following you. Look forward to looking at your web page repeatedly. 2021/09/01 2:39 My spouse and I stumbled over here coming from a

My spouse and I stumbled over here coming from a different web page and thought I
might as well check things out. I like what I
see so i am just following you. Look forward to looking at
your web page repeatedly.

# My spouse and I stumbled over here coming from a different web page and thought I might as well check things out. I like what I see so i am just following you. Look forward to looking at your web page repeatedly. 2021/09/01 2:40 My spouse and I stumbled over here coming from a

My spouse and I stumbled over here coming from a different web page and thought I
might as well check things out. I like what I
see so i am just following you. Look forward to looking at
your web page repeatedly.

# My spouse and I stumbled over here coming from a different web page and thought I might as well check things out. I like what I see so i am just following you. Look forward to looking at your web page repeatedly. 2021/09/01 2:41 My spouse and I stumbled over here coming from a

My spouse and I stumbled over here coming from a different web page and thought I
might as well check things out. I like what I
see so i am just following you. Look forward to looking at
your web page repeatedly.

# My spouse and I stumbled over here coming from a different web page and thought I might as well check things out. I like what I see so i am just following you. Look forward to looking at your web page repeatedly. 2021/09/01 2:42 My spouse and I stumbled over here coming from a

My spouse and I stumbled over here coming from a different web page and thought I
might as well check things out. I like what I
see so i am just following you. Look forward to looking at
your web page repeatedly.

# Hello, I enjoy reading all of your post. I wanted to write a little comment to support you. 2021/09/02 21:42 Hello, I enjoy reading all of your post. I wanted

Hello, I enjoy reading all of your post. I wanted to write a little
comment to support you.

# Hello, I enjoy reading all of your post. I wanted to write a little comment to support you. 2021/09/02 21:43 Hello, I enjoy reading all of your post. I wanted

Hello, I enjoy reading all of your post. I wanted to write a little
comment to support you.

# Hello, I enjoy reading all of your post. I wanted to write a little comment to support you. 2021/09/02 21:44 Hello, I enjoy reading all of your post. I wanted

Hello, I enjoy reading all of your post. I wanted to write a little
comment to support you.

# It's awesome to go to see this website and reading the views of all mates on the topic of this paragraph, while I am also eager of getting experience. 2021/09/03 14:18 It's awesome to go to see this website and reading

It's awesome to go to see this website and reading the views of all mates on the topic of this paragraph,
while I am also eager of getting experience.

# When someone writes an paragraph he/she maintains the idea of a user in his/her mind that how a user can know it. So that's why this post is outstdanding. Thanks! https://parttimejobshiredin30minutes.wildapricot.org/ part time jobs hired in 30 minutes 2021/10/22 23:08 When someone writes an paragraph he/she maintains

When someone writes an paragraph he/she maintains
the idea of a user in his/her mind that how a user can know it.
So that's why this post is outstdanding. Thanks! https://parttimejobshiredin30minutes.wildapricot.org/ part time jobs hired in 30 minutes

# What a stuff of un-ambiguity and preserveness of valuable familiarity regarding unexpected emotions. 2021/10/25 16:35 What a stuff of un-ambiguity and preserveness of v

What a stuff of un-ambiguity and preserveness of valuable familiarity regarding unexpected emotions.

# You ought to be a part of a contest for one of the highest quality websites on the net. I most certainly will recommend this blog! 2021/11/12 15:00 You ought to be a part of a contest for one of th

You ought to be a part of a contest for one of the highest quality websites on the net.
I most certainly will recommend this blog!

# You ought to be a part of a contest for one of the highest quality websites on the net. I most certainly will recommend this blog! 2021/11/12 15:00 You ought to be a part of a contest for one of th

You ought to be a part of a contest for one of the highest quality websites on the net.
I most certainly will recommend this blog!

# You ought to be a part of a contest for one of the highest quality websites on the net. I most certainly will recommend this blog! 2021/11/12 15:01 You ought to be a part of a contest for one of th

You ought to be a part of a contest for one of the highest quality websites on the net.
I most certainly will recommend this blog!

# You ought to be a part of a contest for one of the highest quality websites on the net. I most certainly will recommend this blog! 2021/11/12 15:02 You ought to be a part of a contest for one of th

You ought to be a part of a contest for one of the highest quality websites on the net.
I most certainly will recommend this blog!

タイトル
名前
Url
コメント