2007년 12월 17일
Is state the root of all evil?
Functional programming languages dispense altogether with changing state. None of these has ever become popular. I think state is a valuable metaphor for us since our brains are structured and conditioned to deal with changing state. Single assignment or variableless programming forces us to discard too many effective thinking strategies to be an attractive choice.
Object language are a coping strategy for dealing with state. They offer the opportunity to avoid the problem of state changing "behind your back" by partitioning the state in the system into discrete little chunks, each of witch has strictly limited access to the others. It is easier to keep track of a handful of bytes than mega- or gigabytes. The problem of incorrectly assuming the value of some state remains, but with objects you have the chance to quickly and accurately review all access to a variable.
'Implementation Patterns'를 읽으면 컨트벡은 진솔한 사람인 것 같다.
객체지향 언어는 문제 많은 상태를 다루는 하나의 전략이다. 함수형 언어는 상태를 제거해서 상태로 인해 생기는 문제 자체를 없애려고 하지만 상태를 다룰 수 없어서 또 다른 어려움을 만든다. 함수형 언어를 쓰더라도 현실 세계를 모델링 하는 한 상태 개념 자체를 다루지 않을 수는 없다. 오용하지 못하게 사용을 어렵게 해놓았을 뿐이다.
함수형 언어가 이 책에 나오는 프로그래밍 원칙 중 지역 귀결(Local consequence)을 극단적으로 추구하는 형태라면 그 반대편에는 폰 노이만 아키텍쳐와 이 아키텍쳐를 그대로 반영한 어셈블리 언어가 놓이게 될 것 같다.
막대의 중심을 잡기 위해서는 그 양 끝을 아는 것이 도움이 된다.
# by | 2007/12/17 00:19 | 트랙백 | 덧글(4)







☞ 내 이글루에 이 글과 관련된 글 쓰기 (트랙백 보내기) [도움말]
하지만, 제거할수 없는 것들은 관리를 해줘야 합니다.
켄트벡이 좋은 이야기를 해줬네요...^^