Click here to Skip to main content
12,623,724 members (32,830 online)

Design and Architecture

 
AnswerRe: Application design code samples Pin
Eddy Vluggen12-Jan-11 5:52
memberEddy Vluggen12-Jan-11 5:52 
AnswerRe: Application design code samples Pin
Kevin Marois12-Jan-11 6:54
memberKevin Marois12-Jan-11 6:54 
QuestionSCRUM Pin
Civic0610-Jan-11 10:44
memberCivic0610-Jan-11 10:44 
AnswerRe: SCRUM Pin
Rags151210-Jan-11 18:47
memberRags151210-Jan-11 18:47 
GeneralRe: SCRUM Pin
Civic0611-Jan-11 3:10
memberCivic0611-Jan-11 3:10 
GeneralRe: SCRUM Pin
Rags151211-Jan-11 19:54
memberRags151211-Jan-11 19:54 
GeneralRe: SCRUM Pin
RaviSant17-Jan-11 22:57
memberRaviSant17-Jan-11 22:57 
QuestionObject heuristic Pin
Leslie Sanford5-Jan-11 12:35
memberLeslie Sanford5-Jan-11 12: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 14:06
mvpLuc Pattyn5-Jan-11 14:06 
GeneralRe: Object heuristic Pin
Leslie Sanford5-Jan-11 14:51
memberLeslie Sanford5-Jan-11 14:51 
GeneralRe: Object heuristic Pin
Luc Pattyn5-Jan-11 15:06
mvpLuc Pattyn5-Jan-11 15:06 
AnswerRe: Object heuristic Pin
paul_717-Jan-11 2:24
memberpaul_717-Jan-11 2:24 
QuestionDatabase Code Pin
Leslie Sanford5-Jan-11 6:46
memberLeslie Sanford5-Jan-11 6:46 
AnswerRe: Database Code Pin
dasblinkenlight12-Jan-11 12:42
memberdasblinkenlight12-Jan-11 12:42 
QuestionMatching between product and customer personal information Pin
Yanshof3-Jan-11 21:07
memberYanshof3-Jan-11 21:07 
AnswerRe: Matching between product and customer personal information Pin
dasblinkenlight13-Jan-11 7:24
memberdasblinkenlight13-Jan-11 7:24 
QuestionNeed guidance on designing and preparing MCPD Pin
Rags15123-Jan-11 8:11
memberRags15123-Jan-11 8:11 
AnswerRe: Need guidance on designing and preparing MCPD Pin
Richard MacCutchan4-Jan-11 6:36
mvpRichard MacCutchan4-Jan-11 6:36 
GeneralRe: Need guidance on designing and preparing MCPD Pin
Rags15124-Jan-11 18:21
memberRags15124-Jan-11 18:21 
GeneralRe: Need guidance on designing and preparing MCPD Pin
Richard MacCutchan4-Jan-11 22:39
mvpRichard MacCutchan4-Jan-11 22:39 
QuestionPossible inefficiency in post-increment FOR loop? Pin
Xpnctoc30-Dec-10 16:12
memberXpnctoc30-Dec-10 16:12 
AnswerRe: Possible inefficiency in post-increment FOR loop? Pin
Richard MacCutchan31-Dec-10 0:05
mvpRichard MacCutchan31-Dec-10 0:05 
AnswerRe: Possible inefficiency in post-increment FOR loop? Pin
Luc Pattyn31-Dec-10 0:37
mvpLuc Pattyn31-Dec-10 0:37 
GeneralRe: Possible inefficiency in post-increment FOR loop? Pin
fat_boy31-Dec-10 3:12
memberfat_boy31-Dec-10 3:12 
AnswerRe: Possible inefficiency in post-increment FOR loop? Pin
fat_boy31-Dec-10 3:13
memberfat_boy31-Dec-10 3: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.


Advertise | Privacy | Mobile
Web02 | 2.8.161128.1 | Last Updated 1 Dec 2016
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid