Click here to Skip to main content
14,602,799 members

Design and Architecture

 
AnswerRe: Application design code samples Pin
Eddy Vluggen12-Jan-11 4:52
professionalEddy Vluggen12-Jan-11 4:52 
AnswerRe: Application design code samples Pin
Kevin Marois12-Jan-11 5:54
professionalKevin Marois12-Jan-11 5:54 
QuestionSCRUM Pin
Civic0610-Jan-11 9:44
MemberCivic0610-Jan-11 9:44 
AnswerRe: SCRUM Pin
Praveen Raghuvanshi10-Jan-11 17:47
professionalPraveen Raghuvanshi10-Jan-11 17:47 
GeneralRe: SCRUM Pin
Civic0611-Jan-11 2:10
MemberCivic0611-Jan-11 2:10 
GeneralRe: SCRUM Pin
Praveen Raghuvanshi11-Jan-11 18:54
professionalPraveen Raghuvanshi11-Jan-11 18:54 
GeneralRe: SCRUM Pin
Ravi Sant17-Jan-11 21:57
MemberRavi Sant17-Jan-11 21:57 
QuestionObject heuristic Pin
Leslie Sanford5-Jan-11 11:35
MemberLeslie Sanford5-Jan-11 11:35 
Is there a design heuristic in object oriented programming that states that an object shouldn't send messages to objects it creates?

Is one of these "better"?

class AnotherClass
{
public:
    AnotherClass(SomeClass *obj)
    {
        this->obj = obj;
        this->obj->DoStuff();
    }

    // Rest of implementation....
};

SomeClass *obj1 = new SomeClass;
AnotherClass *obj2 = new AnotherClass(obj1);


vs.

class AnotherClass
{
public:
    AnotherClass()
    {
        obj = new SomeClass;
        obj->DoStuff();
    }

    // Rest of implementation....
};

AnotherClass *obj = new AnotherClass();


I have a vague memory of reading somewhere that the first version is a better design, but I can't remember why. I haven't found anything Googling.
AnswerRe: Object heuristic Pin
Luc Pattyn5-Jan-11 13:06
sitebuilderLuc Pattyn5-Jan-11 13:06 
GeneralRe: Object heuristic Pin
Leslie Sanford5-Jan-11 13:51
MemberLeslie Sanford5-Jan-11 13:51 
GeneralRe: Object heuristic Pin
Luc Pattyn5-Jan-11 14:06
sitebuilderLuc Pattyn5-Jan-11 14:06 
AnswerRe: Object heuristic Pin
Paul Michalik7-Jan-11 1:24
MemberPaul Michalik7-Jan-11 1:24 
QuestionDatabase Code Pin
Leslie Sanford5-Jan-11 5:46
MemberLeslie Sanford5-Jan-11 5:46 
AnswerRe: Database Code Pin
dasblinkenlight12-Jan-11 11:42
Memberdasblinkenlight12-Jan-11 11:42 
QuestionMatching between product and customer personal information Pin
Yanshof3-Jan-11 20:07
MemberYanshof3-Jan-11 20:07 
AnswerRe: Matching between product and customer personal information Pin
dasblinkenlight13-Jan-11 6:24
Memberdasblinkenlight13-Jan-11 6:24 
QuestionNeed guidance on designing and preparing MCPD Pin
Praveen Raghuvanshi3-Jan-11 7:11
professionalPraveen Raghuvanshi3-Jan-11 7:11 
AnswerRe: Need guidance on designing and preparing MCPD Pin
Richard MacCutchan4-Jan-11 5:36
mveRichard MacCutchan4-Jan-11 5:36 
GeneralRe: Need guidance on designing and preparing MCPD Pin
Praveen Raghuvanshi4-Jan-11 17:21
professionalPraveen Raghuvanshi4-Jan-11 17:21 
GeneralRe: Need guidance on designing and preparing MCPD Pin
Richard MacCutchan4-Jan-11 21:39
mveRichard MacCutchan4-Jan-11 21:39 
QuestionPossible inefficiency in post-increment FOR loop? Pin
Xpnctoc30-Dec-10 15:12
MemberXpnctoc30-Dec-10 15:12 
AnswerRe: Possible inefficiency in post-increment FOR loop? Pin
Richard MacCutchan30-Dec-10 23:05
mveRichard MacCutchan30-Dec-10 23:05 
AnswerRe: Possible inefficiency in post-increment FOR loop? Pin
Luc Pattyn30-Dec-10 23:37
sitebuilderLuc Pattyn30-Dec-10 23:37 
GeneralRe: Possible inefficiency in post-increment FOR loop? Pin
fat_boy31-Dec-10 2:12
Memberfat_boy31-Dec-10 2:12 
AnswerRe: Possible inefficiency in post-increment FOR loop? Pin
fat_boy31-Dec-10 2:13
Memberfat_boy31-Dec-10 2:13 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.