어떤 프로그램은 다른 리소스를 필요로 한다. 예를 들어 face detector는 model file이 필요하다(물론 그렇지 않은 detector도 있다). 얼굴에 대한 정보를 가지고 있는 model file이 있어야 target image에서 얼굴을 잡아낼 수 있다. OpenCV가 제공하는 face detector의 경우 xml파일이 이에 해당한다.
팀 내에서 프로젝트를 하는데 이 model파일을 찾아내서 사용하는 프로그램을 넘겨받았다. 환경변수를 다 뒤져서 그 경로마다 해당 파일이 있는지 확인하고 있으면 사용한다. 이런 짓은 이식성에 도움을 주기는 커녕 사용하는 사람들을 혼란에 빠트릴 뿐이다. 프로그램이 현재 실행되는 디렉토리에서 찾아보든지 아니면 실행시 argument로 file을 명시적으로 지정하게 해야 한다. 그 외에는 에러를 주고 멈추면 되는 것이다.
쓸데없는 노력으로 자신의 자부심나무에만 열심히 물을 주고 주변 모든 사람들을 괴롭게 만드는 사람들이 어디에나 있다.
Some program needs other resources to run. For example, OpenCV's face detector needs an xml file which includes model data about face. It finds faces using this model.
If one writes a program like this, there is no need to make the program find everywhere possible to find that xml file. Just find 'current' directory or get an argument that specifies the xml path. If it can not find an xml file, just stop to run with a generous error. My co-worker writes a program that finds everywhere possible using environment variables. If it runs well that way, it is more harmful more than not running. If the program stops or runs problematic way with the xml file problem, a user would not know where is errornous.
댓글 없음:
댓글 쓰기