0
在設計應用程序時,我覺得最簡單的方法是先思考我想如何與我的網站上的模型功能進行交互。這種編碼風格叫什麼?
所以例如,如果我要設計論壇系統我先開始定義中使用的術語,然後我立刻開始在記事本中輸入此:
/*
- Thread
This is a thread a user has created in a board.
- Board
This is a unique place for threads to be stored.
- Categories
This is a way to create sub-menu boards. Boards within boards.
- Comment
This is a reply/comment to a thread.
*/
// -------------------------------------
// THREAD FUNCTIONS
// -------------------------------------
// Add comment to a thread
$thread->user_id = '55';
$thread->thread_id = '66';
$thread->add_comment(array('comment' => 'blah'));
// Edit comment (basically the same structure as add_comment)
$thread->user_id = '55';
$thread->thread_id = '66';
$thread->edit_comment(array('comment' => 'blah2'));
// Delete comment:
$thread->comment_id = '55';
$thread->delete_comment();
// Get's all the comment details within a thread.
$comments = $thread->get('username, comment, date_added, date_edited, subject');
$user_details = $user->user_id('5')
->get('user_title, user_joined_date,
user_location, post_count');
什麼這種方法叫做?我正常嗎? ; -D
你很可能是正常的,這被稱爲設計過程,原型,僞代碼?! – markus 2011-04-05 08:13:49
當然是所有這些東西。但是這種設計模式有什麼名字,即自上而下,自下而上,螺旋等嗎? – 2011-04-05 08:22:34
這不是一種設計模式。這只是你個人的思維設計方法。 – markus 2011-04-05 08:42:42