由买买提看人间百态

topics

全部话题 - 话题: fileloader
(共0页)
s*******y
发帖数: 558
1
来自主题: Java版 - 问一个design的傻问题
问一个傻问题把。 有两个class。 第一个是 public class DataTable, 里面定义了一
些数据结构用来存储数据。另一个是 public class FileLoader, 里面定义了读从文件
里面读数据, 并且把数据存到DataTable里面的功能。
那么怎样设计FileLoader的结构比较好呢?
Choice 1:
public class FileLoader{
...
private DataTable mDataTable;
...
/** loadData 读文件,存储数据到mDataTable, 然后返回一个mDataTable
* 的reference
*/
public DataTable loadData(File fileName){...}
...
}
Choice 2:
public class FileLoader{
...
private DataTable mDataTable;
...
/** loadData 读文件,存储数据到mDataTable, 然后copy mDa
r*****l
发帖数: 2859
2
来自主题: Java版 - 问一个design的傻问题
How about this:
1. Make DataTable an entity class.
2. Create a DataTableManager class to manager DataTable.
DataTableManager can be utility/stateless.
3. Create interfact Loader that read/write from/to stream
to/from binary format (or char[], String, XML etc.).
4. FileLoader implements Loader.
5. DataTableManager uses Loader (FileLoader) to interact
with stream (file) and store/load data to/from DataTable.
Maybe not perfect since I did not spend lots of time
thinking.
m*r
发帖数: 37612
3
这个就是把fileload上去?
然后就可以在电视上看了?
# Staples has Western Digital TV Live HD Media Player for $119 - $25 off $75
coupon ( Buy from e-junkie or SDer ) = $94with free shipping
* 1080p / HDMI / Wifi Stream from Youtube, Netflix
* Next lowest price is $112 ( Google Product )
* 3.5/5 customer reviews on Amazon ( Reviews and Price at Amazon )
(共0页)