Many applications use connection/object Pool. A program may require a IMAP connection Pool and LDAP connection Pool. One could easily implement a IMAP connection Pool, then take the existing code and implement a LDAP connection Pool. The program grows, and now there is a need for a Pool of threads. So just take the IMAP connection Pool and convert that to a Pool of threads (Copy, paste, find, replace????). Need to make some changes to the Pool implementation? Not a very easy task, since the code has been duplicated in many places. Re-inventing source code is not an intelligent approach in an object oriented environment which encourages re-usability. It seems to make more sense to implement a Pool that can contain any arbitrary type rather than duplicating code. How does one do that? The answer is to use type parameterization, more commonly referred to as templates.
標簽:
connection
Pool
applications
program
上傳時間:
2013-12-25
上傳用戶:playboys0