1

標的

プロジェクトに適切かつ効率的なビュー アーキテクチャを実装する (繰り返しユニットを最大限に再利用する)

私のプロジェクトについて

私のプロジェクトには、チューターが受講したクラスと、チューターが公開したパックが含まれます。フレームワークは使用されていませんが、オブジェクト指向とクラス階層がモデル、コントローラー部分に存在します。

私は次のモジュールを持っています -

  1. 検索 -> クラスのリスト - 検索結果に表示されるクラスのリスト。
  2. 学生室 -> クラスのリスト - 学生が購入したクラスのリスト

  3. 検索 -> クラスの詳細 - 検索モジュールのクラスの詳細ページ

  4. 学生室 -> 授業の詳細 - 学生室の授業の詳細ページ

パックについても同様に -

  1. 検索 -> パック リスト - 検索結果に表示されるパックのリスト。
  2. 学生室 -> パックのリスト - 学生が購入したパックのリスト。

  3. 検索 -> パックの詳細 - 検索モジュールのパックの詳細ページ

  4. Student room->Pack Details - Student room のパックの詳細ページです。

私の現在の計画

私は次のようなクラスを持つことを計画しています:-

Class Name                               Contents



commonListingDisplay                     paginationHtml()
                                         smallRatingHtml()
commonDetailsDisplay                     commentsHtml()
                                         largeRatingHtml()

commonClassPackListingDisplay extends commonListingDisplay   
                                         abbreviatedDetailsHtml()

                                         (abbreviated  class/pack                    
                                          details html (class/pack details
                                          ending with ... and a link to the
                                          Class/pack details page).

commonClassPackDetailsDisplay extends commonDetailsDisplay
                                         currently empty

commonClassDisplay                       classDateTimeHtml()
                                         classReminderHtml()

classDetails extends commonClassPackDetailsDisplay,commonClassDisplay

ここでモジュールの例を取り上げます- 検索 -> クラスの詳細 - search_class_details.controller.php ファイルから、クラス classDetails のオブジェクトを開始し、すべての再利用可能な関数にアクセスできるようにします。- すべての変数と classDetails オブジェクトを class_details.view.php (class_details モジュールのビュー ファイル) に渡します。ファイルは次のようになります。

<div class="class_details">
<h2><?php echo $className ?></h2>
<div><?php echo $classDetails ?></div>
<?php  $classDetailsObj->largeRatingHtml($ratingValue) ?>

<?php $classDetailsObj->commentsHtml($commentsArray) ?>

</div>

アプローチはどのように見えますか?経験者からの提案が欲しかった。

ありがとう

4

0 に答える 0