检索规则说明:AND代表“并且”;OR代表“或者”;NOT代表“不包含”;(注意必须大写,运算符两边需空一格)
检 索 范 例 :范例一: (K=图书馆学 OR K=情报学) AND A=范并思 范例二:J=计算机应用与软件 AND (U=C++ OR U=Basic) NOT M=Visual
机构地区:[1]咸阳师范学院计算机学院,陕西咸阳712000
出 处:《微型电脑应用》2017年第9期68-70,74,共4页Microcomputer Applications
基 金:咸阳师范学院专项科研计划项目(2014XSYK038)
摘 要:单例设计模式能够保证某个类的对象在内存中只有唯一的实例,该实例易于被外界访问并节约系统资源。分析了单例模式的角色构成和创建要点,分别从饿汉式、懒汉式、双重验证式、类加载式、枚举式等5个方面阐述了单例模式的实现过程,总结了5种形式的优缺点和应用场景。将单例模式应用到JDBC数据库开发中,设计了一个JDBC工具类,为单例模式的实际应用提供了一定的参考。The singleton design pattern ensures that one class has only one object instance in memory, the instance is easy to be accessed by the outside world and save system resources. The role composition and the key points of the singleton pattern are analyzed,the implementation process of the singleton pattern is described from five aspects of hungry type, lazy type, double authentication type, class loading type and enumeration type. Then it summarizes the advantages and disadvantages of those five types, and their application scenarios. The singleton pattern is applied to the database development with JDBC, and a JD- BC tool class is designed. It provides a reference for the practical application of the singleton pattern.
分 类 号:TP391.78[自动化与计算机技术—计算机应用技术]
正在载入数据...
正在载入数据...
正在载入数据...
正在载入数据...
正在载入数据...
正在载入数据...
正在载入数据...
正在链接到云南高校图书馆文献保障联盟下载...
云南高校图书馆联盟文献共享服务平台 版权所有©
您的IP:216.73.216.145