東方算程譚

Oriental Code Talk ── επιστημηが与太をこく、弾幕とは無縁のシロモノ。

目次

Blog 利用状況

ニュース

著作とお薦めの品々は

著作とお薦めの品々は
東方熱帯林へ。

あわせて読みたい

わんくま

  1. 東京勉強会#2
    C++/CLI カクテル・レシピ
  2. 東京勉強会#3
    template vs. generics
  3. 大阪勉強会#6
    C++むかしばなし
  4. 東京勉強会#7
    C++むかしばなし
  5. 東京勉強会#8
    STL/CLRによるGeneric Programming
  6. TechEd 2007 @YOKOHAMA
    C++・C++/CLI・C# 適材適所
  7. 東京勉強会#14
    Making of BOF
  8. 東京勉強会#15
    状態遷移
  9. 名古屋勉強会#2
    WinUnit - お気楽お手軽UnitTest

CodeZine

  1. Cで実現する「ぷちオブジェクト指向」
  2. CUnitによるテスト駆動開発
  3. SQLiteで組み込みDB体験(2007年版)
  4. C++/CLIによるCライブラリの.NET化
  5. C# 1.1からC# 3.0まで~言語仕様の進化
  6. BoostでC++0xのライブラリ「TR1」を先取りしよう (1)
  7. BoostでC++0xのライブラリ「TR1」を先取りしよう (2)
  8. BoostでC++0xのライブラリ「TR1」を先取りしよう (3)
  9. BoostでC++0xのライブラリ「TR1」を先取りしよう (4)
  10. BoostでC++0xのライブラリ「TR1」を先取りしよう (5)
  11. C/C++に対応した、もうひとつのUnitTestFramework ─ WinUnit
  12. SQLiteで"おこづかいちょう"
  13. STL/CLRツアーガイド
  14. マージ・ソート : 巨大データのソート法
  15. ヒープソートのアルゴリズム
  16. C++0xの新機能「ラムダ式」を次期Visual Studioでいち早く試す
  17. .NETでマンデルブロ集合を描く
  18. .NETでマンデルブロ集合を描く(後日談)
  19. C++/CLI : とある文字列の相互変換(コンバージョン)
  20. インテルTBBによる選択ソートの高速化
  21. インテルTBB3.0 によるパイプライン処理
  22. Visual C++ 2010に追加されたSTLアルゴリズム
  23. Visual C++ 2010に追加されたSTLコンテナ「forward_list」
  24. shared_ptrによるObserverパターンの実装
  25. .NETでマンデルブロ集合を描く(番外編) ── OpenCLで超並列コンピューティング
  26. StateパターンでCSVを読む
  27. 状態遷移表からStateパターンを自動生成する
  28. 「ソートも、サーチも、あるんだよ」~標準C++ライブラリにみるアルゴリズムの面白さ
  29. インテルTBBの同期メカニズム
  30. なぜsetを使っちゃいけないの?
  31. WPFアプリケーションで腕試し ~C++でもWPFアプリを
  32. C++11 : スレッド・ライブラリひとめぐり
  33. Google製のC++ Unit Test Framework「Google Test」を使ってみる
  34. メールでデータベースを更新するココロミ
  35. Visitorパターンで遊んでみたよ
  36. Collection 2題:「WPFにバインドできる辞書」と「重複を許す検索set」
  37. Visual C++ 2012:stateless-lambdaとSQLiteのぷち拡張
  38. 「Visual C++ Compiler November 2012 CTP」で追加された6つの新機能

@IT

  1. Vista時代のVisual C++の流儀(前編)Vista到来。既存C/C++資産の.NET化を始めよう!
  2. Vista時代のVisual C++の流儀(中編)MFCから.NETへの実践的移行計画
  3. Vista時代のVisual C++の流儀(後編) STL/CLRによるDocument/Viewアーキテクチャ
  4. C++開発者のための単体テスト入門 第1回 C++開発者の皆さん。テスト、ちゃんとしていますか?
  5. C++開発者のための単体テスト入門 第2回 C++アプリケーションの効率的なテスト手法(CppUnit編)
  6. C++開発者のための単体テスト入門 第3回 C++アプリケーションの効率的なテスト手法(NUnit編)

AWARDS


Microsoft MVP
for Visual Developer - Visual C++


Wankuma MVP
for いぢわる C++


Nyantora MVP
for こくまろ中国茶

Xbox

Links

記事カテゴリ

書庫

日記カテゴリ

パーシャルクラスに対する一抹の不安

ネタ元 → パーシャルクラスの使い道

んだね。ひとつのクラスを複数のソースで記述できる。
C++屋に言わせてもらえば「なにをいまさらー」なワケです ^^;
C++では クラスの実装 = クラスの宣言 + Σ各メソッドの実装 ですからね。

パーシャルクラス@C# と C++クラス の決定的な違いは、
C++ではクラスの宣言を分割できません。
なのでメソッドやフィールドを後付けでほいほい追加することはできず、
必ず宣言部(ヘッダ)をいぢくらにゃあきません。

επι的には、パーシャルクラスには一抹の不安を覚えます。
というのも、ソースコードひとつ眺めてもそのクラスの全貌を知ることはできません。
そのクラスを実装する全ソースをかき集めないと全体像が見えない。
つまりはコンパイル済みのアセンブリからリフレクション使ってメタデータを
引っこ抜かないと全貌はわからんてことです。
# 片やC++ではヘッダ一本眺めれば、そのクラスの全貌が掴めます。

ソースコードという、ヒトがコードを理解するのに最も単純でツブシの効く表現
だけでは全体像を掴めないってーとこに居心地の悪さみたいなものを感じますです。
プリントアウトをズラリと並べても”これで全部”という保証はどこにもないのですから。

# 同様の居心地の悪さを拡張メソッドにも感じるわけなんだが

投稿日時 : 2009年9月9日 21:43

コメントを追加

# re: パーシャルクラスに対する一抹の不安 2009/09/09 23:31 やまだ

えーと、元ネタの方にもコメントしたんですが。

> 全体像を掴めないってーとこに居心地の悪さみたいなものを感じますです。

んーと、でも、フレームワークとかってそういうものではないかという気もします。
フレームワークが何をしているか、その全体は知る必要はない、ただそこで必要とされるパーツの意味だけしっかりと理解して作成・組み合わせれば良い。

パーシャルクラスによって、フレームワーク(?)のカバー範囲が広がる、という可能性もあるかなぁ、と。一方は開発者自身、もう一方はツールが生成するという前提で。
この場合、手書きの部分と、別途コード生成の部分を組み合わせて動作することになりますから、そのインタフェースはきっちりと切らないといけないですが。

両方とも開発者の手書きの前提で考えると、個人の中で行う作業としてはメリットは薄く、開発チーム内で作業分担を行うにはインタフェース決めのオーバヘッドが大きいのでそれだけの規模や再利用性がないとコストの方が高くつくかなぁ、と。

# re: パーシャルクラスに対する一抹の不安 2009/09/09 23:33 éclair

便利な反面、同じクラス名でも別プロジェクトになると依然使っていたものと同じなのか確認が大変にはなるでしょうね。
実際のところ、使いまわしの利くクラスを作ってもそこに誰かが余計なものを追加する事でクラスの一貫性が保障されないと言うのは…プロジェクト的にどうなんでしょう?
私個人であれば絶対禁止させるでしょうけど、中にはこういうのに頓着しない人も多いですからね。
C#は良く知らないのですが、こういうクラスをライブラリ化して使った場合などに、そのクラスをpartial出来るのかどうかがいまいちわかりません。
※何か日本語が変で意味不明かもしれませんがお許しを。

# re: パーシャルクラスに対する一抹の不安 2009/09/10 1:03 NyaRuRu

># 片やC++ではヘッダ一本眺めれば、そのクラスの全貌が掴めます。

単にメソッド名とフィールド名が分かっただけで「クラスの全貌が掴め」たと主張できるのであれば,C# は IntelliSense でメンバ一覧を表示するだけで「クラスの全貌が掴め」る言語なので,コーディング中ほぼ常に「クラスの全貌」を把握し続けられる便利な言語と言えるんじゃないでしょうかね.

C++ の場合,ヘッダファイルを見ただけではメソッドの中身がどうなっているのか分からないのは当然として,ソースコードがコンパイルされるまでの複雑なプリプロセス,複雑な名前のルックアップ,複雑なリンク処理等々,居心地の悪い部分が沢山あるのがやです.

現実には #include <windows.h> した時点でひっくり返る程度の居心地の悪さじゃないですかね.

# re: パーシャルクラスに対する一抹の不安 2009/09/10 1:22 επιστημη

僕がアナクロなのは百も承知でして ^^;

裏返せばインテリセンスつかVSてゆーヘルパ頼みの快適さなのが...どうもね。

たとえば掲示板なんかで"うごきません/わかりません"なんてのに"んじゃソース見せてみ"つって出てきたコードがホントにこれで全部? なんて不安があるです。 コードレビューでも同様の。

居心地の悪さって点では確かにC++は玉砂利に正座するくらい居心地悪いけども ^^;;;;

# re: パーシャルクラスに対する一抹の不安 2009/09/10 19:51 渋木宏明(ひどり)

「リスクを感じる」という点には同意します。
けど、それほど重大なリスクだとは思いません。

C++ のマクロやジェネリックだってそーとー危ないし ;-)
ようは使い方次第でしょう。

C# に partial や拡張メソッドなどの機能が追加されていく様は、「「多重継承を封じられた状況で、如何にしてクラスの振る舞いを拡張するか?」という問いに応える歴史」にも見えて、面白いです。

# re: パーシャルクラスに対する一抹の不安 2009/09/10 23:53 zak

>インテリセンスつかVSてゆーヘルパ頼みの快適さ
キーポイントはここでしょうね。
C/アセンブラでごにょってたのとはもはや世界が違う感じです。
私自身、「これでいいんかしら・・・」と思うこともあります。

#アナクロ、といわれれば確かにそれまで、ですが。
#C++もIDEの助けなしには深くDiveするのが厳しいくらいに複雑になりましたし・・・。
#優れた脳内コンパイラを持たずとも、ステップを踏めばどうにか理解できるようになる。
#その点は歓迎すべきなのかな。などと妄想する次第です。

# re: パーシャルクラスに対する一抹の不安 2009/09/13 9:08 やねうらお

> C++ではクラスの宣言を分割できません。

こういうの↓は、C#のpartialが有用なのと同じ理屈で、意外と実用的だったりしますが。

class XXX
{
#include "XXXpart1.h"
#include "XXXpart2.h"
};

# re: パーシャルクラスに対する一抹の不安 2009/09/14 16:17 επιστημη

↑あー。はいはい。

privateを隠すべく

class XXX {
# include "XXX.private"
public:
 ...
};

なんてーのはたまにやったりやらなかったり。
# あんましウケがよくありません。
# これはこれで居心地が良くないんでしょうねぇ

# I got this website from my buddy who informed me on the topic of this site and now this time I am visiting this website and reading very informative posts at this place. 2019/05/05 6:14 I got this website from my buddy who informed me o

I got this website from my buddy who informed me on the topic of this site and now this time
I am visiting this website and reading very informative posts at this place.

# I visited multiple web pages except the audio feature for audio songs present at this site is actually wonderful. 2019/05/10 9:37 I visited multiple web pages except the audio feat

I visited multiple web pages except the audio feature for audio songs present at
this site is actually wonderful.

# Hey there I am so excited I found your webpage, I really found you by mistake, while I was browsing on Aol for something else, Anyways I am here now and would just like to say cheers for a fantastic post and a all round exciting blog (I also love the th 2019/05/11 16:45 Hey there I am so excited I found your webpage, I

Hey there I am so excited I found your webpage, I really found you by mistake, while I was browsing on Aol for something else,
Anyways I am here now and would just like to say cheers for a fantastic post and
a all round exciting blog (I also love the theme/design), I don’t have time to go through it all at the moment but I have book-marked
it and also included your RSS feeds, so when I have time I
will be back to read more, Please do keep up the superb jo.

# I'm truly enjoying the design and layout of your website. It's a very easy on the eyes which makes it much more enjoyable for me to come here and visit more often. Did you hire out a designer to create your theme? Fantastic work! 2019/09/04 12:22 I'm truly enjoying the design and layout of your w

I'm truly enjoying the design and layout of your website.

It's a very easy on the eyes which makes it much more enjoyable for me to come here
and visit more often. Did you hire out a designer to create your theme?
Fantastic work!

# I'm truly enjoying the design and layout of your website. It's a very easy on the eyes which makes it much more enjoyable for me to come here and visit more often. Did you hire out a designer to create your theme? Fantastic work! 2019/09/04 12:23 I'm truly enjoying the design and layout of your w

I'm truly enjoying the design and layout of your website.

It's a very easy on the eyes which makes it much more enjoyable for me to come here
and visit more often. Did you hire out a designer to create your theme?
Fantastic work!

# I'm truly enjoying the design and layout of your website. It's a very easy on the eyes which makes it much more enjoyable for me to come here and visit more often. Did you hire out a designer to create your theme? Fantastic work! 2019/09/04 12:24 I'm truly enjoying the design and layout of your w

I'm truly enjoying the design and layout of your website.

It's a very easy on the eyes which makes it much more enjoyable for me to come here
and visit more often. Did you hire out a designer to create your theme?
Fantastic work!

# I'm truly enjoying the design and layout of your website. It's a very easy on the eyes which makes it much more enjoyable for me to come here and visit more often. Did you hire out a designer to create your theme? Fantastic work! 2019/09/04 12:25 I'm truly enjoying the design and layout of your w

I'm truly enjoying the design and layout of your website.

It's a very easy on the eyes which makes it much more enjoyable for me to come here
and visit more often. Did you hire out a designer to create your theme?
Fantastic work!

# No matter if some one searches for his vital thing, thus he/she wishes to be available that in detail, therefore that thing is maintained over here. 2021/09/03 20:03 No matter if some one searches for his vital thing

No matter if some one searches for his vital
thing, thus he/she wishes to be available that in detail,
therefore that thing is maintained over here.

# No matter if some one searches for his vital thing, thus he/she wishes to be available that in detail, therefore that thing is maintained over here. 2021/09/03 20:04 No matter if some one searches for his vital thing

No matter if some one searches for his vital
thing, thus he/she wishes to be available that in detail,
therefore that thing is maintained over here.

# No matter if some one searches for his vital thing, thus he/she wishes to be available that in detail, therefore that thing is maintained over here. 2021/09/03 20:05 No matter if some one searches for his vital thing

No matter if some one searches for his vital
thing, thus he/she wishes to be available that in detail,
therefore that thing is maintained over here.

# No matter if some one searches for his vital thing, thus he/she wishes to be available that in detail, therefore that thing is maintained over here. 2021/09/03 20:06 No matter if some one searches for his vital thing

No matter if some one searches for his vital
thing, thus he/she wishes to be available that in detail,
therefore that thing is maintained over here.

# Hello mates, its great article on the topic of teachingand completely explained, keep it up all the time. 2021/09/05 15:50 Hello mates, its great article on the topic of tea

Hello mates, its great article on the topic of
teachingand completely explained, keep it up all the time.

# Hello mates, its great article on the topic of teachingand completely explained, keep it up all the time. 2021/09/05 15:51 Hello mates, its great article on the topic of tea

Hello mates, its great article on the topic of
teachingand completely explained, keep it up all the time.

# Hello mates, its great article on the topic of teachingand completely explained, keep it up all the time. 2021/09/05 15:52 Hello mates, its great article on the topic of tea

Hello mates, its great article on the topic of
teachingand completely explained, keep it up all the time.

# Hello mates, its great article on the topic of teachingand completely explained, keep it up all the time. 2021/09/05 15:53 Hello mates, its great article on the topic of tea

Hello mates, its great article on the topic of
teachingand completely explained, keep it up all the time.

# I go to see everyday some web pages and sites to read articles, however this webpage presents feature based posts. scoliosis surgery https://coub.com/stories/962966-scoliosis-surgery scoliosis surgery 2021/09/12 19:17 I go to see everyday some web pages and sites to

I go to see everyday some web pages and sites to read articles, however this webpage presents
feature based posts. scoliosis surgery https://coub.com/stories/962966-scoliosis-surgery scoliosis surgery

# I go to see everyday some web pages and sites to read articles, however this webpage presents feature based posts. scoliosis surgery https://coub.com/stories/962966-scoliosis-surgery scoliosis surgery 2021/09/12 19:18 I go to see everyday some web pages and sites to

I go to see everyday some web pages and sites to read articles, however this webpage presents
feature based posts. scoliosis surgery https://coub.com/stories/962966-scoliosis-surgery scoliosis surgery

# I go to see everyday some web pages and sites to read articles, however this webpage presents feature based posts. scoliosis surgery https://coub.com/stories/962966-scoliosis-surgery scoliosis surgery 2021/09/12 19:19 I go to see everyday some web pages and sites to

I go to see everyday some web pages and sites to read articles, however this webpage presents
feature based posts. scoliosis surgery https://coub.com/stories/962966-scoliosis-surgery scoliosis surgery

# I go to see everyday some web pages and sites to read articles, however this webpage presents feature based posts. scoliosis surgery https://coub.com/stories/962966-scoliosis-surgery scoliosis surgery 2021/09/12 19:20 I go to see everyday some web pages and sites to

I go to see everyday some web pages and sites to read articles, however this webpage presents
feature based posts. scoliosis surgery https://coub.com/stories/962966-scoliosis-surgery scoliosis surgery

# Hello there! This post could not be written any better! Going through this article reminds me of my previous roommate! He constantly kept preaching about this. I most certainly will forward this post to him. Pretty sure he's going to have a good read. Tha 2021/10/26 21:27 Hello there! This post could not be written any be

Hello there! This post could not be written any better!
Going through this article reminds me of my previous roommate!

He constantly kept preaching about this. I most certainly will forward this
post to him. Pretty sure he's going to have a
good read. Thanks for sharing!

# Hello there! This post could not be written any better! Going through this article reminds me of my previous roommate! He constantly kept preaching about this. I most certainly will forward this post to him. Pretty sure he's going to have a good read. Tha 2021/10/26 21:28 Hello there! This post could not be written any be

Hello there! This post could not be written any better!
Going through this article reminds me of my previous roommate!

He constantly kept preaching about this. I most certainly will forward this
post to him. Pretty sure he's going to have a
good read. Thanks for sharing!

# Hello there! This post could not be written any better! Going through this article reminds me of my previous roommate! He constantly kept preaching about this. I most certainly will forward this post to him. Pretty sure he's going to have a good read. Tha 2021/10/26 21:29 Hello there! This post could not be written any be

Hello there! This post could not be written any better!
Going through this article reminds me of my previous roommate!

He constantly kept preaching about this. I most certainly will forward this
post to him. Pretty sure he's going to have a
good read. Thanks for sharing!

# Hello there! This post could not be written any better! Going through this article reminds me of my previous roommate! He constantly kept preaching about this. I most certainly will forward this post to him. Pretty sure he's going to have a good read. Tha 2021/10/26 21:30 Hello there! This post could not be written any be

Hello there! This post could not be written any better!
Going through this article reminds me of my previous roommate!

He constantly kept preaching about this. I most certainly will forward this
post to him. Pretty sure he's going to have a
good read. Thanks for sharing!

# It's a pity you don't have a donate button! I'd certainly donate to this excellent blog! I guess for now i'll settle for bookmarking and adding your RSS feed to my Google account. I look forward to fresh updates and will talk about this blog with my Fa 2021/11/13 15:53 It's a pity you don't have a donate button! I'd ce

It's a pity you don't have a donate button! I'd certainly donate to this excellent
blog! I guess for now i'll settle for bookmarking and adding
your RSS feed to my Google account. I look forward to fresh updates and will talk about this blog
with my Facebook group. Chat soon!

# Hi there! This article could not be written much better! Reading through this post reminds me of my previous roommate! He continually kept talking about this. I most certainly will send this article to him. Fairly certain he's going to have a good read. 2021/12/17 15:18 Hi there! This article could not be written much b

Hi there! This article could not be written much better!
Reading through this post reminds me of my previous roommate!
He continually kept talking about this. I most certainly will send this article to him.
Fairly certain he's going to have a good read. Many thanks for sharing!

# Hi there! This article could not be written much better! Reading through this post reminds me of my previous roommate! He continually kept talking about this. I most certainly will send this article to him. Fairly certain he's going to have a good read. 2021/12/17 15:18 Hi there! This article could not be written much b

Hi there! This article could not be written much better!
Reading through this post reminds me of my previous roommate!
He continually kept talking about this. I most certainly will send this article to him.
Fairly certain he's going to have a good read. Many thanks for sharing!

# Hi there! This article could not be written much better! Reading through this post reminds me of my previous roommate! He continually kept talking about this. I most certainly will send this article to him. Fairly certain he's going to have a good read. 2021/12/17 15:19 Hi there! This article could not be written much b

Hi there! This article could not be written much better!
Reading through this post reminds me of my previous roommate!
He continually kept talking about this. I most certainly will send this article to him.
Fairly certain he's going to have a good read. Many thanks for sharing!

# Hi there! This article could not be written much better! Reading through this post reminds me of my previous roommate! He continually kept talking about this. I most certainly will send this article to him. Fairly certain he's going to have a good read. 2021/12/17 15:20 Hi there! This article could not be written much b

Hi there! This article could not be written much better!
Reading through this post reminds me of my previous roommate!
He continually kept talking about this. I most certainly will send this article to him.
Fairly certain he's going to have a good read. Many thanks for sharing!

# What a material of un-ambiguity and preserveness of precious familiarity regarding unpredicted emotions. http://54.157.50.96/wiki/Twosday_Shirt_Rhinestone_T-shirt_And_The_Evolution_Of_Vogue_-_Clothing https://warriorcats.wiki/index.php/Taco_Twosday_T_S 2022/01/14 23:48 What a material of un-ambiguity and preserveness o

What a material of un-ambiguity and preserveness of precious familiarity regarding unpredicted emotions.



http://54.157.50.96/wiki/Twosday_Shirt_Rhinestone_T-shirt_And_The_Evolution_Of_Vogue_-_Clothing
https://warriorcats.wiki/index.php/Taco_Twosday_T_Shirt_The_Little-Recognized_Secrets_To_Shirt
https://wiki.motardo.com/Utilisateur:GwenSulman35628
https://peace.myserenity.net/doku.php?id=twosday_shi_t_the_way_to_make_a_shi_t_with_c_icut_-_step-by-step
https://pacific-rp.com/index.php?title=Taco_Twosday_Shirt_Eight_Tremendous_Useful_Suggestions_To_Improve_Shirt_Dress
http://darkusblack.com/wiki/index.php?title=Twosday_2_22_22_T_Shirt_Men_s_Polo_T-shirt_-_User_Expertise_-_Fashion

タイトル
名前
URL
コメント