Blogる。

 [2007/04/24]blog復帰に向けてネタ探し中・・・

目次

Blog 利用状況

ニュース

巡回コミュニティ(ほぼROM)

わんくま同盟

  • わんくま同盟
  • C#, VB.NET 掲示板

Go!Go! ASP.NET

技術系ブログ

技術系サイト

趣味

まゆりんって何者?

  • 設計しりコーディングしたりテストしたり雑用したり家事したりゲームしたり 読書したり音楽聴いたりネットサーフィンしたりショッピングしたり引き篭もったりする低スペックな主婦です(・ω・)∩

広告

記事カテゴリ

書庫

日記カテゴリ

【.NET/Work】#if を使ってコメントアウト?

#私見が長すぎてしまったので、本題を読みたい方は★ -----から後へどうぞ。

開発を進めているうちに、改修等で不要なコードが発生する。
そして、大抵はそれらを消さずコメントアウトしていると思う。

大掛かりな改修ともなれば当然大量のコードが不要となるが、
それらも全てコメントアウト、なんていう場面に何度か直面している。
中には、クラス丸ごと不要となったにも関わらずクラス内のメソッドやプロパティだけコメントアウトしている事もあり、
枠だけ残す奇妙な行為を私は理解することが出来なかった。
(当然、そのクラスはカットオーバー以降も使われることはなかった)

とにかく、繰り返しコメントアウトされたプログラムは正直かなり見難くい。
本当に不要ならいっそ(どこかのタイミングで全て)消してしまった方が良いと思うのだが、
修正履歴のためだとか、また使うかもしれないからなどと言う人もいる。
しかし、VSS等のソース管理ソフトを上手く使えばその辺は問題ないんじゃ?と思うのだが・・・。

今まで常駐したことのある企業では、
修正前のコードをコメントアウトしてから修正するように、
といった内容がコーディング規約として明記されている所もあったし、
コメントアウトしたコードに履歴番号と修正内容を一言書き、
Excel等で作成した改修履歴書に同じような内容を書くといった管理をしているところもあった。

前者はコメントアウトしたコードに対するコメント記入方法まで細かく指定されていたので、
当時(今よりもっとダメPG)の私にとっては許容範囲であったが、
後者は明らかな多元管理であったので嫌気が差したものだ。

★ -----------------------------------------------------------------------------------

さて、拙い前置きが長くなったがここからが本題。
今常駐している企業も無論、コメントアウトしてから修正するよう指示を受けているのだが、
先日下のようなコメントアウトを見かけた。

//VS2003 ASP.NET(C#)
#if NoUse
    //2006-07-11 仕様変更の為、不要
    //要らなくなったコード
#endif

確かに、そうやって括れば折りたためてスッキリするけど、
本来の使い方通りに使っている箇所もあるので混同しかねない。
というか、使い方間違ってるよー。

どうせ括るなら、

#region 2006-07-11 仕様変更の為、不要
    //要らなくなったコード
#endregion

として欲しかったな。
まぁ、どちらにしてもVS以外で見ると見難いのは変わらないんだけど。

//本題の方が短く感じるのは気のせいです。

投稿日時 : 2006年7月11日 14:58

Feedback

# re: 【.NET/Work】#if を使ってコメントアウト? 2006/07/11 17:30 じゃんぬ

さて、問題です。
#if ディレクティブは何のためにあるのでしょうか?

# re: 【.NET/Work】#if を使ってコメントアウト? 2006/07/11 22:48 囚人

コメントアウトしたコードは、テストして問題がないのを確認して、少々置いてから一切削除しますねぇ。

>修正前のコードをコメントアウトしてから修正するように、
>といった内容がコーディング規約として明記されている所もあったし、

これは修正するときは当たり前と思っていました。もちろん修正後消しますが。

>#if ディレクティブは何のためにあるのでしょうか?

if 文が使えないときだよ!簡単すぎる!!

# re: 【.NET/Work】#if を使ってコメントアウト? 2006/07/12 0:06 まゆりん

>#if ディレクティブは何のためにあるのでしょうか?
デバッグとか環境別に異なる処理を動かしたい時に使う為ではないのですか?
そういうのにしか使ったことないんですが、
質問を投げてくるということは、何か含ませてますねw

>これは修正するときは当たり前と思っていました。
今の私もそう思ってます。
ただ、これを半永久的に残すのはどうかと・・・。

# re: 【.NET/Work】#if を使ってコメントアウト? 2006/07/23 10:43 中博俊

VSSに残ってるから、ズバット参上、ズバット解決(^^

# re: 【.NET/Work】#if を使ってコメントアウト? 2006/08/02 2:05 おぎわら

仕様が変更になったのなら、
前のコードはいらないハズなんですけどねー。

#if
なのは、C++, C 出身の人に多いですねー。

多元管理はISO9000シリーズ対応で、
「文書化」 「トレーサビリティ(追跡可能性)」「監査」
の要件があるからかなー。
開発期間が短くなっている現在では
余計なドキュメント作成時間がもったいないよーに思います。(システムで自動化されてればいいですが)

# Oakley Frogskins Sunglasses 2013/03/16 9:42 http://cheapoakleyfrogskinssunglasses.webs.com/

I can't help eating sweets whenever they are in my presence.How about going to a movie? She has been to school.You'll save time not waiting for the elevator.I agreeThe doctor began to operate on the boy.The doctor began to operate on the boy.You are just in time.I haven't seen you for ages.He asked me some personal questions, but I would never answer them.

# burberry sale 2013/03/17 19:25 http://www.evd.com.tr/burberry.html

The girl in red is his girlfriend.Don't worry.Don't let me down.He dare not tell us his evil conduct.What do you desire me to do? He dare not tell us his evil conduct.He dare not tell us his evil conduct.Don't let me down.He seems at little nervous.He thinks himself somebody, but we think him nobody.

# We're a group of volunteers and opening a new scheme in our community. Your website offered us with valuable information to work on. You have done an impressive job and our whole community will be thankful to you. 2019/02/02 20:20 We're a group of volunteers and opening a new sche

We're a group of volunteers and opening a new scheme in our community.
Your website offered us with valuable information to work on. You have done an impressive job and our whole
community will be thankful to you.

# WOW just what I was searching for. Came here by searching for C# 2019/02/04 9:32 WOW just what I was searching for. Came here by se

WOW just what I was searching for. Came here
by searching for C#

# fantastic points altogether, you simply received a new reader. What may you recommend in regards to your publish that you simply made a few days ago? Any certain? 2019/02/06 4:32 fantastic points altogether, you simply received a

fantastic points altogether, you simply received a new reader.
What may you recommend in regards to your
publish that you simply made a few days ago? Any
certain?

# Heya just wanted to give you a brief heads up and let you know a few of the pictures aren't loading properly. I'm not sure why but I think its a linking issue. I've tried it in two different internet browsers and both show the same outcome. 2019/02/07 10:08 Heya just wanted to give you a brief heads up and

Heya just wanted to give you a brief heads up and let you know a few of the pictures aren't loading properly.
I'm not sure why but I think its a linking issue. I've tried it
in two different internet browsers and both show the same outcome.

# Everything said made a bunch of sense. However, what about this? suppose you wrote a catchier post title? I ain't saying your information is not good., but what if you added a headline to possibly grab a person's attention? I mean 【.NET/Work】#if を使ってコメン 2019/04/19 16:01 Everything said made a bunch of sense. However, wh

Everything said made a bunch of sense. However, what
about this? suppose you wrote a catchier post title?
I ain't saying your information is not good., but what
if you added a headline to possibly grab a person's attention? I mean 【.NET/Work】#if を使ってコメントアウト? is a little boring.
You should look at Yahoo's home page and watch how they create post titles to get viewers interested.
You might add a related video or a pic or two to grab readers excited about
everything've written. Just my opinion, it might bring your posts a little livelier.

# Hello Dear, are you actually visiting this website regularly, if so then you will without doubt get good knowledge. 2019/05/13 12:21 Hello Dear, are you actually visiting this website

Hello Dear, are you actually visiting this website regularly, if so then you will without
doubt get good knowledge.

# This excellent website definitely has all the information I needed concerning this subject and didn't know who to ask. 2019/05/15 9:48 This excellent website definitely has all the info

This excellent website definitely has all the information I needed concerning this subject
and didn't know who to ask.

# Hello, i think that i saw you visited my website so i came to “return the favor”.I am attempting to find things to improve my site!I suppose its ok to use some of your ideas!! 2021/09/05 18:15 Hello, i think that i saw you visited my website s

Hello, i think that i saw you visited my website so i came to “return the favor”.I am attempting
to find things to improve my site!I suppose its ok to use some of
your ideas!!

# I read this piece of writing completely on the topic of the comparison of most up-to-date and earlier technologies, it's remarkable article. quest bars https://www.iherb.com/search?kw=quest%20bars quest bars 2021/09/12 22:24 I read this piece of writing completely on the top

I read this piece of writing completely on the topic of the comparison of most up-to-date and earlier technologies, it's remarkable article.
quest bars https://www.iherb.com/search?kw=quest%20bars quest bars

# I read this piece of writing completely on the topic of the comparison of most up-to-date and earlier technologies, it's remarkable article. quest bars https://www.iherb.com/search?kw=quest%20bars quest bars 2021/09/12 22:25 I read this piece of writing completely on the top

I read this piece of writing completely on the topic of the comparison of most up-to-date and earlier technologies, it's remarkable article.
quest bars https://www.iherb.com/search?kw=quest%20bars quest bars

# I read this piece of writing completely on the topic of the comparison of most up-to-date and earlier technologies, it's remarkable article. quest bars https://www.iherb.com/search?kw=quest%20bars quest bars 2021/09/12 22:26 I read this piece of writing completely on the top

I read this piece of writing completely on the topic of the comparison of most up-to-date and earlier technologies, it's remarkable article.
quest bars https://www.iherb.com/search?kw=quest%20bars quest bars

# I read this piece of writing completely on the topic of the comparison of most up-to-date and earlier technologies, it's remarkable article. quest bars https://www.iherb.com/search?kw=quest%20bars quest bars 2021/09/12 22:27 I read this piece of writing completely on the top

I read this piece of writing completely on the topic of the comparison of most up-to-date and earlier technologies, it's remarkable article.
quest bars https://www.iherb.com/search?kw=quest%20bars quest bars

# I constantly spent my half an hour to read this webpage's content all the time along with a mug of coffee. scoliosis surgery https://coub.com/stories/962966-scoliosis-surgery scoliosis surgery 2021/09/13 7:07 I constantly spent my half an hour to read this we

I constantly spent my half an hour to read this webpage's content all the time along with a mug of coffee.
scoliosis surgery https://coub.com/stories/962966-scoliosis-surgery scoliosis surgery

# Its like you read my mind! You seem to know so much about this, like you wrote the book in it or something. I think that you could do with some pics to drive the message home a little bit, but other than that, this is magnificent blog. An excellent rea 2022/03/24 8:08 Its like you read my mind! You seem to know so muc

Its like you read my mind! You seem to know so much
about this, like you wrote the book in it or something.

I think that you could do with some pics to drive the message
home a little bit, but other than that, this
is magnificent blog. An excellent read. I will definitely be back.

# Its like you read my mind! You seem to know so much about this, like you wrote the book in it or something. I think that you could do with some pics to drive the message home a little bit, but other than that, this is magnificent blog. An excellent rea 2022/03/24 8:09 Its like you read my mind! You seem to know so muc

Its like you read my mind! You seem to know so much
about this, like you wrote the book in it or something.

I think that you could do with some pics to drive the message
home a little bit, but other than that, this
is magnificent blog. An excellent read. I will definitely be back.

# Its like you read my mind! You seem to know so much about this, like you wrote the book in it or something. I think that you could do with some pics to drive the message home a little bit, but other than that, this is magnificent blog. An excellent rea 2022/03/24 8:10 Its like you read my mind! You seem to know so muc

Its like you read my mind! You seem to know so much
about this, like you wrote the book in it or something.

I think that you could do with some pics to drive the message
home a little bit, but other than that, this
is magnificent blog. An excellent read. I will definitely be back.

# Its like you read my mind! You seem to know so much about this, like you wrote the book in it or something. I think that you could do with some pics to drive the message home a little bit, but other than that, this is magnificent blog. An excellent rea 2022/03/24 8:11 Its like you read my mind! You seem to know so muc

Its like you read my mind! You seem to know so much
about this, like you wrote the book in it or something.

I think that you could do with some pics to drive the message
home a little bit, but other than that, this
is magnificent blog. An excellent read. I will definitely be back.

# Hey there just wanted to give you a quick heads up and let you know a few of the images aren't loading correctly. I'm not sure why but I think its a linking issue. I've tried it in two different browsers and both show the same results. 2022/06/03 4:46 Hey there just wanted to give you a quick heads up

Hey there just wanted to give you a quick heads up and let you know a few of the
images aren't loading correctly. I'm not sure
why but I think its a linking issue. I've tried it in two different browsers and both show the same results.

# When someone writes an post he/she retains the idea of a user in his/her brain that how a user can be aware of it. Thus that's why this article is outstdanding. Thanks! 2022/06/05 7:06 When someone writes an post he/she retains the ide

When someone writes an post he/she retains the idea of
a user in his/her brain that how a user can be aware of it.
Thus that's why this article is outstdanding. Thanks!

# This is my first time pay a visit at here and i am truly impressed to read everthing at one place. 2022/06/06 17:36 This is my first time pay a visit at here and i am

This is my first time pay a visit at here and i am truly
impressed to read everthing at one place.

# Hiya very cool website!! Guy .. Excellent .. Wonderful .. I will bookmark your website and take the feeds also? I'm satisfied to seek out a lot of helpful info right here in the publish, we need work out more techniques in this regard, thanks for sharing. 2022/06/09 6:34 Hiya very cool website!! Guy .. Excellent .. Wonde

Hiya very cool website!! Guy .. Excellent .. Wonderful .. I will
bookmark your website and take the feeds also? I'm satisfied to seek out a lot of helpful info right here in the publish, we need
work out more techniques in this regard, thanks for sharing.
. . . . .

# Valuable information. Lucky me I discovered your web site unintentionally, and I'm shocked why this accident didn't took place earlier! I bookmarked it. 2022/08/04 4:19 Valuable information. Lucky me I discovered your w

Valuable information. Lucky me I discovered your web site unintentionally, and I'm shocked
why this accident didn't took place earlier!

I bookmarked it.

# I was wondering if you ever thought of changing the structure of your website? Its very well written; I love what youve got to say. But maybe you could a little more in the way of content so people could connect with it better. Youve got an awful lot o 2022/08/09 19:44 I was wondering if you ever thought of changing th

I was wondering if you ever thought of changing the structure of your website?
Its very well written; I love what youve got to say.
But maybe you could a little more in the way of content so people could
connect with it better. Youve got an awful lot of text for
only having one or two images. Maybe you could space it out better?

# If some one wishes to be updated with most up-to-date technologies afterward he must be pay a visit this website and be up to date every day. 2022/08/12 12:18 If some one wishes to be updated with most up-to-d

If some one wishes to be updated with most up-to-date technologies afterward he must be pay a visit this
website and be up to date every day.

# When some one searches for his required thing, therefore he/she needs to be available that in detail, so that thing is maintained over here. 2022/08/15 13:52 When some one searches for his required thing, the

When some one searches for his required thing, therefore he/she needs
to be available that in detail, so that thing is maintained over
here.

タイトル
名前
Url
コメント