Ognacの雑感

木漏れ日々

目次

Blog 利用状況

書庫

ギャラリ

区分マスターの意味

性別を
enum 性別CODE
{
  男 =1,
  女 =2,
}
と列挙体で規定することは多いです。ソース上の可読性も高いです。
でも、DB上で 1,2で保持していると、どこかで置換処理が必要になります。

性別コードって公的規定があるのですね。4種類ある!!  http://en.wikipedia.org/wiki/ISO_5218

列挙体を使わずに区分マスターとして設定することもあります。

CODE='M' : 名称="男"
CODE='F' : 名称="女"

と規定しているのを見かけます。しかし、 '男','女' は1文字です。CODE値も 'M'/'F' の1文字です。
しかも、プログラムで if(code=='M'){...}   if(code=='F'){...}  というソースを見ると、性別マスタの存在は不要に思います。
直接 if(code=='男'){...}   if(code=='女'){...} でも差は無いし、'M'.'F'を'男','女'と脳内読替しない分、可読性が高い。

同様の理屈で、要素が数個のCODEマスターの存在が引っかかります。
得意先_仕入先区分マスター :  T:得意先 / S:仕入先  =>  '得' , '仕'
入金_出金区分マスター     :  N:入金   / S:出金    =>  '入' , '出'
受発注区分マスター        :  J:受注   / H:発注    =>  '受' , '発'

マスター化が必要だとする意見に、「コード値に対する表示名が確定できない」というのがあります。
しかし、用語辞書を設定し、 得仕_得 => 得意先 ,  得仕_仕 =>  仕入先  と置換すれば、表示名対応できます。

と書いてきましたが、そもそも、性別マスターや得意先_仕入先区分マスターなどの、行が増減しない固定区分って、マスター化する意味は、あるのかなぁ。
直接 'T'や'S'の値をソースで使用するのだったら(エイリアス変数を使うにしても)、マスター化しなくても良いと思うのです。
マスター化することで、プログラム内に値置換処理を書くことになります。その面でも不利。
「データ登録時の整合性チェックに用いるから必要だ」という考えもありますが、要素が不定のマスターと違い、区分の性質上、要素の増減はないので、RDBの行制約でカバーするほうが単純だと思うのです。

投稿日時 : 2009年9月7日 0:07

Feedback

# re: 区分マスターの意味 2009/09/07 0:45 Pasie.

 私はここで出てくる区分マスターみたいなものは極力排除したい派なので別にいいんですが。

 例えば「得意先」が「顧客」、「仕入先」が「業者」と名称変更された時はどう考えればよいのでしょう?
 それと用語辞書を設定する必要性は?具体的にはなぜ"得"なんでしょうか?"得意先"では不可?もっともマルチランゲージなりを意識しているのなら話は別なのですが。

# re: 区分マスターの意味 2009/09/07 0:55 biac

そして、 性別フィールドには、 性別マスタへの外部キーが張ってないのですね。 わかりますw

# re: 区分マスターの意味 2009/09/07 11:45 trapemiya

表示順なんてのもありますから、簡単なものでも区分マスター化してそこに表示順を持たせることが多いかな。

性別テーブル
コード 性別 表示順
1 男 10
2 女  20

#性別テーブルだとあまり表示順は要らないかな?

>でも、DB上で 1,2で保持していると、どこかで置換処理が必要になります。

上のテーブルのようにしておけば置換は必要ないと思いますよ??

# re: 区分マスターの意味 2009/09/07 11:48 trapemiya

>性別コードって公的規定があるのですね。4種類ある!! http://en.wikipedia.org/wiki/ISO_5218

これは知りませんでした。勉強になりました。ありがとうございます。m(_ _)m

# re: 区分マスターの意味 2009/09/07 12:58 えムナウ

以前はJIS規格にもありましたよ。
http://www.revulo.com/blog/20080115.html

最近は男女の区別が必須とできない状況もあります。
DBに置かないとVIEWで画面や帳票イメージを確認しづらいという場合もありますね。

# re: 区分マスターの意味 2009/09/07 13:08 trapemiya

>以前はJIS規格にもありましたよ。

こういうのあったんですね。いかに不勉強かバレますねw
でも私が使用しているのもISO5218と偶然同じです。というか、誰が考えてもありがちなパターンなんでしょうがw

# re: 区分マスターの意味 2009/09/07 19:12 Ognac

>例えば「得意先」が「顧客」、「仕入先」が「業者」と名称変更された時はどう考え
ればよいのでしょう?
用語辞書 で対応してますね。
  得意先を'徳", 仕入先を'仕'と表現するのは、プログラムソース内のことで、出力
綱目(画面や帳票)は、用語辞書経由で、"お客様"/"得意先"のように切り替え可能にし
ています。

# Its like you learn my thoughts! You seem to know so much about this, like you wrote the guide in it or something. I think that you can do with some % to power the message home a bit, however other than that, that is fantastic blog. A great read. I'll ce 2019/04/09 21:05 Its like you learn my thoughts! You seem to know s

Its like you learn my thoughts! You seem to
know so much about this, like you wrote the guide in it or something.
I think that you can do with some % to power the message home a bit, however other than that, that is
fantastic blog. A great read. I'll certainly be back.

# Can you tell us more about this? I'd love to find out some additional information. 2019/07/23 19:57 Can you tell us more about this? I'd love to find

Can you tell us more about this? I'd love to find out some additional information.

# Can you tell us more about this? I'd love to find out some additional information. 2019/07/23 19:58 Can you tell us more about this? I'd love to find

Can you tell us more about this? I'd love to find out some additional information.

# Can you tell us more about this? I'd love to find out some additional information. 2019/07/23 19:59 Can you tell us more about this? I'd love to find

Can you tell us more about this? I'd love to find out some additional information.

# Can you tell us more about this? I'd love to find out some additional information. 2019/07/23 20:00 Can you tell us more about this? I'd love to find

Can you tell us more about this? I'd love to find out some additional information.

# Have you ever considered about including a little bit more than just your articles? I mean, what you say is fundamental and everything. But imagine if you added some great photos or video clips to give your posts more, "pop"! Your content is 2019/07/31 23:48 Have you ever considered about including a little

Have you ever considered about including a little bit more than just your articles?
I mean, what you say is fundamental and everything.

But imagine if you added some great photos or video clips
to give your posts more, "pop"! Your content is excellent
but with pics and clips, this website could undeniably be
one of the best in its field. Terrific blog!

# Have you ever considered about including a little bit more than just your articles? I mean, what you say is fundamental and everything. But imagine if you added some great photos or video clips to give your posts more, "pop"! Your content is 2019/07/31 23:49 Have you ever considered about including a little

Have you ever considered about including a little bit more than just your articles?
I mean, what you say is fundamental and everything.

But imagine if you added some great photos or video clips
to give your posts more, "pop"! Your content is excellent
but with pics and clips, this website could undeniably be
one of the best in its field. Terrific blog!

# Have you ever considered about including a little bit more than just your articles? I mean, what you say is fundamental and everything. But imagine if you added some great photos or video clips to give your posts more, "pop"! Your content is 2019/07/31 23:50 Have you ever considered about including a little

Have you ever considered about including a little bit more than just your articles?
I mean, what you say is fundamental and everything.

But imagine if you added some great photos or video clips
to give your posts more, "pop"! Your content is excellent
but with pics and clips, this website could undeniably be
one of the best in its field. Terrific blog!

# Have you ever considered about including a little bit more than just your articles? I mean, what you say is fundamental and everything. But imagine if you added some great photos or video clips to give your posts more, "pop"! Your content is 2019/07/31 23:51 Have you ever considered about including a little

Have you ever considered about including a little bit more than just your articles?
I mean, what you say is fundamental and everything.

But imagine if you added some great photos or video clips
to give your posts more, "pop"! Your content is excellent
but with pics and clips, this website could undeniably be
one of the best in its field. Terrific blog!

# Very good article. I'm going through some of these issues as well.. 2019/09/03 7:23 Very good article. I'm going through some of these

Very good article. I'm going through some of these issues
as well..

# Very good article. I'm going through some of these issues as well.. 2019/09/03 7:24 Very good article. I'm going through some of these

Very good article. I'm going through some of these issues
as well..

# Very good article. I'm going through some of these issues as well.. 2019/09/03 7:25 Very good article. I'm going through some of these

Very good article. I'm going through some of these issues
as well..

# Very good article. I'm going through some of these issues as well.. 2019/09/03 7:26 Very good article. I'm going through some of these

Very good article. I'm going through some of these issues
as well..

# qEFbBpxDsXjtduWq 2021/07/03 4:22 https://www.blogger.com/profile/060647091882378654

There is definately a great deal to know about this subject. I really like all of the points you have made.

# Illikebuisse tjacc 2021/07/04 0:07 pharmacepticacom

hydroxyl chloroquine https://www.pharmaceptica.com/

# erectile stimulus 2021/07/10 16:27 hydroxychloroquine 200mg

long term side effects of plaquenil https://plaquenilx.com/# does hydroxychloroquine cause heart problems

# re: ????????? 2021/07/12 10:04 hydroxychloroquine sulfate tabs 200mg

chloroquina https://chloroquineorigin.com/# hydroxychloroquinine

# Hi, just wanted to say, I liked this article. It was helpful. Keep on posting! 2021/08/30 7:52 Hi, just wanted to say, I liked this article. It w

Hi, just wanted to say, I liked this article. It was helpful.
Keep on posting!

# Article writing is also a excitement, if you know afterward you can write otherwise it is difficult to write. 2021/08/31 18:16 Article writing is also a excitement, if you know

Article writing is also a excitement, if you know afterward you can write otherwise it is difficult to write.

# Article writing is also a excitement, if you know afterward you can write otherwise it is difficult to write. 2021/08/31 18:17 Article writing is also a excitement, if you know

Article writing is also a excitement, if you know afterward you can write otherwise it is difficult to write.

# Article writing is also a excitement, if you know afterward you can write otherwise it is difficult to write. 2021/08/31 18:18 Article writing is also a excitement, if you know

Article writing is also a excitement, if you know afterward you can write otherwise it is difficult to write.

# Article writing is also a excitement, if you know afterward you can write otherwise it is difficult to write. 2021/08/31 18:19 Article writing is also a excitement, if you know

Article writing is also a excitement, if you know afterward you can write otherwise it is difficult to write.

# These are truly wonderful ideas in about blogging. You have touched some good things here. Any way keep up wrinting. 2021/09/04 22:22 These are truly wonderful ideas in about blogging.

These are truly wonderful ideas in about blogging.
You have touched some good things here. Any way keep up wrinting.

# These are truly wonderful ideas in about blogging. You have touched some good things here. Any way keep up wrinting. 2021/09/04 22:23 These are truly wonderful ideas in about blogging.

These are truly wonderful ideas in about blogging.
You have touched some good things here. Any way keep up wrinting.

# These are truly wonderful ideas in about blogging. You have touched some good things here. Any way keep up wrinting. 2021/09/04 22:24 These are truly wonderful ideas in about blogging.

These are truly wonderful ideas in about blogging.
You have touched some good things here. Any way keep up wrinting.

# These are truly wonderful ideas in about blogging. You have touched some good things here. Any way keep up wrinting. 2021/09/04 22:25 These are truly wonderful ideas in about blogging.

These are truly wonderful ideas in about blogging.
You have touched some good things here. Any way keep up wrinting.

# It's hard to find educated people about this subject, however, you sound like you know what you're talking about! Thanks 2021/09/05 15:10 It's hard to find educated people about this subje

It's hard to find educated people about this subject, however, you sound like you know what you're talking about!
Thanks

# It's hard to find educated people about this subject, however, you sound like you know what you're talking about! Thanks 2021/09/05 15:11 It's hard to find educated people about this subje

It's hard to find educated people about this subject, however, you sound like you know what you're talking about!
Thanks

# It's hard to find educated people about this subject, however, you sound like you know what you're talking about! Thanks 2021/09/05 15:12 It's hard to find educated people about this subje

It's hard to find educated people about this subject, however, you sound like you know what you're talking about!
Thanks

# It's hard to find educated people about this subject, however, you sound like you know what you're talking about! Thanks 2021/09/05 15:13 It's hard to find educated people about this subje

It's hard to find educated people about this subject, however, you sound like you know what you're talking about!
Thanks

# fantastic post, very informative. I'm wondering why the other experts of this sector do not realize this. You must continue your writing. I am confident, you have a huge readers' base already! 2021/09/05 18:09 fantastic post, very informative. I'm wondering wh

fantastic post, very informative. I'm wondering why the other experts of this sector do not realize this.

You must continue your writing. I am confident, you have a huge readers' base already!

# I think the admin of this web page is genuinely working hard for his web site, for the reason that here every material is quality based stuff. scoliosis surgery https://coub.com/stories/962966-scoliosis-surgery scoliosis surgery 2021/09/12 23:21 I think the admin of this web page is genuinely wo

I think the admin of this web page is genuinely working
hard for his web site, for the reason that here every material is quality based stuff.
scoliosis surgery https://coub.com/stories/962966-scoliosis-surgery scoliosis surgery

# I think the admin of this web page is genuinely working hard for his web site, for the reason that here every material is quality based stuff. scoliosis surgery https://coub.com/stories/962966-scoliosis-surgery scoliosis surgery 2021/09/12 23:22 I think the admin of this web page is genuinely wo

I think the admin of this web page is genuinely working
hard for his web site, for the reason that here every material is quality based stuff.
scoliosis surgery https://coub.com/stories/962966-scoliosis-surgery scoliosis surgery

# I think the admin of this web page is genuinely working hard for his web site, for the reason that here every material is quality based stuff. scoliosis surgery https://coub.com/stories/962966-scoliosis-surgery scoliosis surgery 2021/09/12 23:23 I think the admin of this web page is genuinely wo

I think the admin of this web page is genuinely working
hard for his web site, for the reason that here every material is quality based stuff.
scoliosis surgery https://coub.com/stories/962966-scoliosis-surgery scoliosis surgery

# I think the admin of this web page is genuinely working hard for his web site, for the reason that here every material is quality based stuff. scoliosis surgery https://coub.com/stories/962966-scoliosis-surgery scoliosis surgery 2021/09/12 23:24 I think the admin of this web page is genuinely wo

I think the admin of this web page is genuinely working
hard for his web site, for the reason that here every material is quality based stuff.
scoliosis surgery https://coub.com/stories/962966-scoliosis-surgery scoliosis surgery

# vzarlhwzcfpc 2021/11/28 7:41 cegoiicm

https://chloroquinephosphates.com/ chloroquine phosphate canada

# jrzcbyqsboqo 2021/12/03 8:18 dwedayyjgb

https://chloroquinestrx.com/ hydroxychloroquine 200 mg tablet

# how to order doxycycline https://doxycyline1st.com/
200 mg doxycycline 2022/02/25 22:44 Doxycycline

how to order doxycycline https://doxycyline1st.com/
200 mg doxycycline

# clRpEmsPGxMXGqpewOG 2022/04/19 13:03 johnansaz

http://imrdsoacha.gov.co/silvitra-120mg-qrms

# ルイ ヴィトン 本社 2022/06/18 19:50 ewttjwsvzzu@aol.jp

【本日の特価】送料無料!
100%新品グルーポン系サービス!
【激安通販】本物保証!
2022正規品大特価販売店
独占販売代理店!
★期間限定★激安販売中!
激安通販,全商品送料無料!
特売品【送料無料】
楽天正規専門店,激安販売中!
超人気!
上質本革割引!
【激安専門店】
賛!
定番人気市場!
【楽天最安値に挑戦】

# best drug for ed https://erectionpills.best/
the best ed pills 2022/06/28 11:18 ErectionPills

best drug for ed https://erectionpills.best/
the best ed pills

# ed treatments https://erectiledysfunctionpills.shop/ 2022/10/14 16:45 Erectile

ed treatments https://erectiledysfunctionpills.shop/

# prednisone best prices https://prednisone20mg.icu/ 2022/10/15 7:19 Prednisone

prednisone best prices https://prednisone20mg.icu/

# グランドセイコーコピー 2022/10/24 23:08 ocmdanlbk@excite.co.jp

早い対応、親切な対応で嬉しかったです。また宜しくお願いします。
安く良い商品が買えて良かったです。キレイな状態だし、大きさも丁度よくガンガン使えそうです。
グランドセイコーコピー https://www.ginza24.com/product/detail/3950.htm

# dating sites our time https://datingsiteonline.site/
juicydatessites 2022/12/05 17:29 Tading

dating sites our time https://datingsiteonline.site/
juicydatessites

# generic hydroxychloroquine otc 2022/12/25 16:54 MorrisReaks

aralen online cheap https://www.hydroxychloroquinex.com/

# non prescription ed pills https://edpills.science/
ed pills cheap 2023/01/07 8:37 EdPills

non prescription ed pills https://edpills.science/
ed pills cheap

# re: 区分マスターの意味 2023/01/24 6:40 Optimum

town on what the opposition parties and their candidates are gearing up to do at the polls

# over the counter inhaler walmart 2023/01/27 7:44 Jamessop

https://over-the-counter-drug.com/# over the counter antifungal cream

# stromectol for sale 2023/02/06 1:06 Zacharyunava

Everything information about medication. Read information now.
https://stromectolst.com/# ivermectin ebay
п»?Medicament prescribing information. Read now.

# ivermectin 400 mg brands 2023/02/06 21:41 Kevinfot

Read information now. Read here.
https://stromectolst.com/# stromectol for sale
Drug information. Read information now.

# best ed treatment pills 2023/02/16 16:40 Robertjum

Read information now. Read now.
https://edonlinefast.com best ed pills at gnc
Learn about the side effects, dosages, and interactions. Read now.

# Read information now. Read information now.
https://edonlinefast.com
Drug information. Drug information. 2023/02/17 16:42 EdPills

Read information now. Read information now.
https://edonlinefast.com
Drug information. Drug information.

# re: 区分マスターの意味 2023/03/11 23:52 Optimum

of Serbia’s top skiers, just wanted to talk Russian. The political correcto crowd got on the case and Tennis

# re: 区分マスターの意味 2023/03/11 23:56 Optimum

of Serbia’s top skiers, just wanted to talk Russian. The political correcto crowd got on the case and Tennis

# doors2.txt;1 2023/03/14 14:55 dMiNJWzqGsXwx

doors2.txt;1

# doors2.txt;1 2023/03/14 16:29 YmMCeMyTuROqKXoUhG

doors2.txt;1

# re: 区分マスターの意味 2023/03/25 11:44 Optimum

jhfyufyuyuyif

# Misoprostol 200 mg buy online - https://cytotecsale.pro/# 2023/04/28 13:16 Cytotec

Misoprostol 200 mg buy online - https://cytotecsale.pro/#

# best over the counter hair color https://overthecounter.pro/# 2023/05/08 13:04 OtcJikoliuj

best over the counter hair color https://overthecounter.pro/#

# ed pills for sale 2023/05/14 10:38 Mickeynix

https://edpills.pro/# ed pills for sale

# new treatments for ed 2023/05/14 20:08 MichaelExcup

http://edpills.pro/# best treatment for ed

# ed medications online 2023/05/16 5:54 MichaelExcup

http://edpills.pro/# male erection pills

# cost of prednisone 40 mg https://prednisonepills.pro/# - prednisone 10mg cost 2023/06/05 5:22 Prednisone

cost of prednisone 40 mg https://prednisonepills.pro/# - prednisone 10mg cost

# buy cytotec online 2023/06/05 12:59 Davidodota

https://prednisonepills.pro/# how to purchase prednisone online

# cytotec buy online usa 2023/06/06 5:24 Davidodota

https://cytotecpills.pro/# buy cytotec in usa

# Cytotec 200mcg price 2023/06/07 11:39 Davidodota

http://prednisonepills.pro/# cost of prednisone 5mg tablets

# ed drug prices 2023/06/09 13:04 BennySpuse

https://edpillsfd.online/# best ed pills online

# best male enhancement pills 2023/06/11 3:04 BennySpuse

http://edpillsfd.com/# cures for ed

# sildenafil price 20mg 2023/06/27 22:23 DavidPaync

https://edpill.pro/# best otc ed pills

# buy sildenafil online australia 2023/06/28 14:53 DavidPaync

https://sildenafilpills.pro/# sildenafil 10 mg india

# sildenafil in usa 2023/06/29 5:08 DavidPaync

http://edpill.pro/# erectile dysfunction drug

# buy sildenafil 100mg 2023/06/30 13:15 DavidPaync

http://fastpills.pro/# certified canadian pharmacies

# cheap ed pills 2023/06/30 14:48 JosephKarnE

http://edpill.pro/# best treatment for ed

# paxlovid cost without insurance https://paxlovid.store/
paxlovid india 2023/07/13 21:45 Paxlovid

paxlovid cost without insurance https://paxlovid.store/
paxlovid india

# best ed pills https://edpills.ink/# - new ed pills 2023/07/26 14:31 EdPills

best ed pills https://edpills.ink/# - new ed pills

# buy cytotec over the counter https://cytotec.ink/# - buy cytotec pills online cheap 2023/07/27 1:17 PillsFree

buy cytotec over the counter https://cytotec.ink/# - buy cytotec pills online cheap

# Plavix 75 mg price https://plavix.guru/ buy clopidogrel online 2023/10/23 16:54 Plavixxx

Plavix 75 mg price https://plavix.guru/ buy clopidogrel online

# buying prednisone mexico https://prednisone.bid/ can you buy prednisone in canada 2023/12/27 2:38 Prednisone

buying prednisone mexico https://prednisone.bid/ can you buy prednisone in canada

タイトル
名前
Url
コメント