Choice of method name : MFC and Cocoa

MFC and Cocoa have very different philosophy about programming model. The MFC is a wrapper of Win32 API and data types, while the Cocoa is written from the scratch to present new programmng model.

To me, writing with Cocoa has always been eaiser because Cocoa has understandable method names and so on.
Let’s take a look at a screenshot.

To set a text of an edit box, you should use SetWindowText. With NSTextField of Cocoa, you will use setStringValue. To understand why Set”WindowText”, you should understand that the CEdit is a subclass of a CWnd. So, the content of the CEdit is a kind of window text, although it sounds like a title of a window.

So, the Cocoa’s nomenclature is a lot easier to understand. Also, it is more readable, because of its capitalization. by mixing small and large letters, Cocoa helps you to see what is verb part and what is noun part. So, it is easier to recognize what the method means.

I think this is very good example how Apple and MS are different each other.
I have been seeing this kind of tradition from MS and Apple. It feels like that this is the very one which shows the two different cultures.


2 responses to this post.

  1. Posted by cgkim on April 22, 2009 at 8:09 AM

    이미 두번은 본듯 한 “The Pragmatic Programmer”을 가끔 한번씩 들쳐보는데 오늘 아침에 딱 펼친데서 나온 내용이군요. :) 저도 이 내용으로 블로그 포스팅이나 할까 했는데 정신없어서 결국 못했네요. :) foo나 a, b같이 무의미한 네이밍보다 더 좋지 않은 것이 오해를 불러일으키는 이름이라고 하죠. (포스팅 하신 내용과는 약간 다를 수 있기도 하지만…) 여튼, MFC는 기본적으로 저런 엉터리 네이밍이 많고 또, 그것을 습관적으로 보고 사용해온 개발자들이 많아서 저런 부분에 대해서 둔감한 사람들이 많은듯 합니다. 참 답답한 노릇이죠.

    요즘 바쁘신것 같던데, 좀 어떠세요? :)


  2. Posted by jongampark on April 22, 2009 at 11:45 AM

    좀 마음이 많이 심난했고.. 여전히 계속 그러고 있네요…


Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: