JAVA
[Java] Reflection 사용 시 주의점.
Reflection 이란 구체적인 정보를 알 지 못해도, 클래스와 메서드의 메타정보를 사용하여 해당 클래스의 메서드, 변수들에 접근할 수 있도록 해주는 기술이다. 이렇게 편리하고 좋아보이기만 하는 Reflection 기술에 무슨 주의점이 있을까? 그건 바로, Reflection은 런타임에 동작하기 때문에, 컴파일 시점에 오류를 잡을 수 없다는 것이다. 타입 정보를 기반으로 컴파일 시점 오류 체킹을 통해 개발편의성을 늘리는 방향으로 프로그래밍 언어가 발전해왔는데, Reflection 은 이러한 흐름에 역행하는 방식이다. 따라서 Reflection은 프레임워크 개발이나 매우 일반적인 공통 처리가 필요할 때만 조심히 사용해야 한다.
[Java] Enhanced for문 로직
아래 예시처럼 Enhanced for문의 경우, 위의 문장에서 아래의 문장으로 번역된다. https://docs.oracle.com/javase/specs/jls/se8/html/jls-14.html#jls-14.14.2 Chapter 14. Blocks and Statements In the following example, a mathematical graph is represented by an array of arrays. A graph consists of a set of nodes and a set of edges; each edge is an arrow that points from some node to some other node, or from a node to itself. In th..