"架构"到底是个什么东西? 转

转自http://blog.csdn.net/wishfly

"

举个例子吧。
你要在屏幕上打印“hello wrold.”
ok!
你写下:prtinf("hello world.");
然后,你有希望能够写道文件中。
于是改为;
if(屏幕){
prtinf("hello world.");
}else(文件){
write_to_file("c:\\hello.txt", "hello world.");
}
再然后,你有希望能够写到打印机。
if(屏幕){
prtinf("hello world.");
}else(文件){
write_to_file("c:\\hello.txt", "hello world.");
}else(打印机){
write_to_printer("hello world.");
}

于是你感觉有点烦--想办法:如何不改动程序或少改动程序,实现这种扩展?
于是框架进来了!

用一个函数:
print("hello world.")来实现多态。

具体实现的过程,就是框架实现。

总结:框架就是接口的集合,以便于程序扩展。

"

posted @ 2011-02-13 18:03  ndxsdhy  阅读(272)  评论(0编辑  收藏  举报