1

私の現在のプロジェクトのユーザーベースは小さく、ほぼすべてのクライアントが Web サーバーと同じ LAN 上にあるため、パフォーマンスが実際に妨げられることはありませんが、私は悪い習慣を身につけるのが苦手なので、正しく行うことに慣れたいと思っています。 .

私は、一般的に使用される要件 (主にフォーム、ダイアログ、グリッド) を含む一般的な「サイト」レイヤーを作成し、必要に応じて他のコンポーネント (チャートなど) を追加することを考えていました。ページ。途中で維持するレイヤーは1つだけですが、各リクエストは大きくなります。

わずかに肥大化したレイヤーで 1 つのリクエストを作成するのと、いくつかの小さなレイヤーで 2 つのリクエストを作成するのとではどちらがよいと考えられますか?

4

1 に答える 1

2

Like most things, it depends. If your app is limited to a LAN, you're not going to care as much about wasted bytes as someone who pays by the byte for their hosting and end users who incur significant latency over a WAN. If the user is likely to end up navigating to a page with all the various components and need the code eventually, you could argue you're wasting your time making layers. It seems the tradeoff in your case is that you're incurring a little extra download time upfront. That either makes the initial page load slower or subsequent pages load quicker, depending on how you look at it. On a LAN that's probably negligible either way.

In general, it is better practice to create layers because of the potential for re-use of the smaller files in other pages or future applications on your site where there might be a cache hit, and also to minimize the possibility that users will download code for pages they won't visit. The cost for maintaining such layers shouldn't be too bad.

于 2009-11-30T19:37:39.303 に答える