Code refactoring is a "disciplined technique for restructuring an existing body of code, altering its internal structure without changing its external behavior" 리팩토링은 위 정의대로 바뀌것은 없어보이지만, 소프트웨어 내부를 더 좋게 바꾸는 작업이다. 리팩토링을 하는 이유는 무엇일까? 1. 리팩토링으로 중복된 코드를 제거함으로써, 소프트웨어의 수정 및 가독성이 좋아진다.중복된 코드를 사용하게 되면, 코드의 길이가 늘어나게 된다. 이런 경우 굉장히 복잡해 보이고, 읽기 힘들어 지기 마련이다. 또한, 수정을 하더라도, 중복된 코드의 모든 내용을 수정해야하므로, 코드의 중복은 피할 수..
properties을 사용하기 위해 우선, 프로젝트에 properties파일을 생성해야한다. 자신이 원하는 이름의 properties파일을 사용하는 프로젝트에 생성하자. 확장명은 ????.properties이다. properties는 자료구조의 Map에서 key와 value로 구성되어, 사용되는 것과같이 유사한 방식으로 사용한다. properties에서 key=value로 개행하면서 글만 써주면된다. public static String getClassName(String key) { Properties properties = new Properties(); try { properties.load(new FileInputStream("project.properties")); } catch (FileNot..
문자열로 클래스를 만들기 위해서는 java.lang.Class.forName() 을 사용할 수 있다. 우선, Class.forName()의 정의는 이렇다. The java.lang.Class.forName(String name) method returns the Class object associated with the class or interface with the given string name. The java.lang.Class.forName(String name, boolean initialize, ClassLoader loader) method returns the Class object associated with the class or interface with the given stri..
- Total
- Today
- Yesterday