当前位置:首页 » 软件开发
开发技术指南» 文章正文
    引言: There is a principle of object-o
 

 

 ·keep changes small: a happy jack story    »显示摘要«
    摘要:jack walked into the office one monday morning. underneath his arm, he carried a rolled-up piece of poster paper. he walked to the back of the building, where a group of couches and tables made up the......
    摘要:at the end of 2004, microsoft will stop supporting windows nt. at that point, anyone using windows nt will have several choices: follow microsofts upgrade path to windows 2003, continue to use windows......


Principles, Patterns, and Practices: The Factory Pattern
上一页   ... void f(list balls);

and if we invoke that function from many different places, each of which creates their own linkedlist to pass into it, then we cant really claim to be hiding the type of the list from anyone but f. and what good is hiding it from one function when everyone else knows it?

static factory 【程序编程相关:关于Map和List的性能测试报告

fortunately, there are several design patterns that address this issue, and allow us to hide the type of an object even from those who seek to create it. these patterns are known as factories. 【推荐阅读:用BeanShell实现公式管理

in some sense, the names of the two lists are unfortunate. they might have been better named insertionlist and indexedaccesslist. these two names decouple the reason that the two lists exist from their implementation style. we can enforce that decoupling by creating a class named listfactory that passes the following test: 【扩展信息:设计合适的接口

consider why we would choose a linkedlist over an arraylist. linkedlists have fast insert times, but slow indexed access times. for example, you can quickly insert or delete an element of a linked list in o(1) time; but it takes o(n) time to find the nth element. the situation for an arraylist is reversed. inserts are o(n), while indexed access is o(1). so the reason to choose one over the other depends on what we plan to do with the list.


...   下一页
    摘要:anyone who has dealt with complex enterprise applications knows the value of a good logging solution. features such as consolidating log files, separating events, and turning debugging on or off all c......
» 本期热门文章:

©2000-2007 All Rights Reserved. 最佳浏览:1024X768 MSIE