개발자 99% 커뮤니티에서 수다 떨어요!
TIL (Today I Learned)
2022.03.01
오늘 읽은 범위
Objects and Data Structures
책에서 기억하고 싶은 내용을 써보세요.
Data Abstraction
Hiding implementation is about abstractions.
The Law of Demeter
There is a well-know heuristic called the Law of Demeter that says a module should not know about the innards of the objects if manipulates.
The method should not invoke methods on objects that are returned by any of the allowed functions. In other words, talk to friends, not to strangers.
DTOs are very useful structures, especially when communicating with databases or parsing messages from sockets, and so on.
Objects expose behavior and hide data. Data structures expose data and have no significant behavior.
Good software developers understand these issues without prejudice and choose the approach that is best for the job at hand.
오늘 읽은 소감은? 떠오르는 생각을 가볍게 적어보세요
앞서 읽었던 함수 챕터가 많이 생각나는 장이었습니다. 함수와 변수의 이름 짓기에 이어서 객체 지향 프로그래밍에서 getter와 setter를 어떻게 쓸 것인지에 대한 고민을 할 수 있어서 좋았습니다. javascript에서는 getter와 setter가 없지만 물고 늘어지는 배열에 대입해서 이번 챕터를 읽으면 좋을 것 같네요.
궁금한 내용이 있거나, 잘 이해되지 않는 내용이 있다면 적어보세요.
Low of Demeter에 대해서 찾아보았습니다. 정확한 발음은 모르겠으나 유래는 그리스 로마 신화의 데메테르가 맞는 듯 하네요. 이 법칙과 관련해서는 이 블로그에 알기 쉽게 적혀있어서 도움이 많이 되었습니다. https://smjeon.dev/etc/law-of-demeter/