2010年4月12日 星期一

Something about Category and Extention

Category 和 Extention 有著非常相似的使用方式, 然而卻還是有些不同的使用情境. 基本上, Extention 是個
"anonymous" Category.
讓我們來復習一下 Category 的寫法:

@interface MyClassName ( MyCategoryName)
// extra methods' definitions
- (void)superShrimp;
@end

然後再看看 Extention
@interface MyClassName ()
// extra methods' definitions
- (void)superShrimp;
@end

2010年3月23日 星期二

function pointer in C++ to boost::function

Effective c++ item 35 舉了一個有趣的例子GameCharacter,

主要的精神在於利用function pointer把真正計算血量的部份,交給專門計算血量的function。達到像Strategy pattern可以隨時抽換實作內容的目的。

一開始看到後面boost時沒什麼fu,主要的原因在於自己對原本c++要怎麼delegate function的實作方式不熟,所以當後面進階的boost::function跟boost::bind的觀念導入後,心中只剩OS:這哪裡方便了?一點都不蝦阿~為了不模糊焦點,我們先不管pattern怎麼用,直接看看function pointer in standard C++的技巧。

2010年3月12日 星期五

你是雞,是豬,還是鬥雞?

在看Scrum的時候連帶看到了一個寓言The Chicken and the Pig

A pig and a chicken are walking down a road. The chicken looks at the pig and says, “Hey, why don’t we open a restaurant?” The pig looks back at the chicken and says, “Good idea, what do you want to call it?” The chicken thinks about it and says, “Why don’t we call it ‘Ham and Eggs’?” “I don’t think so,” says the pig, “I’d be committed, but you’d only be involved.”

大意是做出一份有雞蛋與培根/火腿的早餐,雞跟豬各自扮演的角色,用來比擬在一個專案或產品內每個人的角色。

Scrum軟體開發工具與方法—系列講座 (一) 課後雜記

昨天公司給我去參加外部課程的機會,在此先感謝一下老闆 (逢迎拍馬才是升官之道)
趁還有記憶在這寫一下筆記,以便之後準備公司內部報告。

2010年3月4日 星期四

Razorcap Studios

推一下 http://www.razorcap.com 作者是我當兵時候的學長,一直都在遊戲軟體業耕耘,現在也開始玩iPhone Programming了 超蝦~ Razorcap這名字的由來也很酷,請學長有空可以跟大家介紹一下 :)

2010年2月6日 星期六

C++物件模型之二

今天要上一道小菜: constructor initialization list

概念很簡單,以下的constructor寫得不好:
class Person {
    String _name;
    int    _age;
public:
    Person() {
        _name = 0;
        _age = 0;
    }
};
因為compiler會把它轉化成以下(*):
Person() {
    String tmpString(0);    // temporary String object been created
    String _name.String();
    _name = tmpString;      // copy assignment operator been called
    tmpString.~String();    // destruct temporary String object

    _age = 0;    // basic data type, set value directly
}

2010年2月1日 星期一

C++物件模型之一

記得十幾年前當C++正席捲整個軟體業的時候,有部分engineer拒絕從C進化到C++,主要的論點是C++ compiler在背後做太多事,以至於影響程式的效能。時至今日,C++早已成為許多軟體、系統的基本開發語言,但我覺得我自己對於compiler到底在程式碼上面動了甚麼手腳,掌握度還是不夠,於是開始研究起C++物件模型,並且想用一系列的文章和大家交流一下。