Click here to Skip to main content
15,890,717 members
Home / Discussions / Design and Architecture
   

Design and Architecture

 
QuestionPOP3 Components Pin
Jammer28-Jan-11 0:42
Jammer28-Jan-11 0:42 
AnswerRe: POP3 Components Pin
phil.o28-Jan-11 2:38
professionalphil.o28-Jan-11 2:38 
JokeRe: POP3 Components Pin
Jammer28-Jan-11 3:33
Jammer28-Jan-11 3:33 
GeneralRe: POP3 Components Pin
phil.o28-Jan-11 4:06
professionalphil.o28-Jan-11 4:06 
AnswerRe: POP3 Components Pin
Hans Dietrich4-Feb-11 12:00
mentorHans Dietrich4-Feb-11 12:00 
AnswerRe: POP3 Components Pin
Jammer13-Feb-11 23:56
Jammer13-Feb-11 23:56 
GeneralRe: POP3 Components Pin
phil.o14-Feb-11 0:10
professionalphil.o14-Feb-11 0:10 
QuestionOO design: Copying data from class A to B Pin
Nilzor25-Jan-11 23:05
Nilzor25-Jan-11 23:05 
This is a general and basic question about object oriented design. I've been programming for many years, but just recently I've started realizing many of my old ways of doing stuff is flawed or just plain wrong in terms of good OO design.

Simple case: You have class A and class B which have some overlapping properties. You want a method that copies or converts the common properties from class A to class B. Where does the method go?

1) Class A as a B GetAsB() ?
2) Class B as a constructor B(A input)?
3) Class B as a method void FillWithDataFrom(A input)?
4) Class C as a static method B ConvertAtoB(A source)?


Thinking of SOLID principles and testability I have a hunch that 4) is the best answer, but I'd like to hear some rationale. Maybe there isn't a definite answer?
AnswerRe: OO design: Copying data from class A to B Pin
venomation26-Jan-11 1:03
venomation26-Jan-11 1:03 
GeneralRe: OO design: Copying data from class A to B Pin
Nilzor26-Jan-11 1:14
Nilzor26-Jan-11 1:14 
GeneralRe: OO design: Copying data from class A to B Pin
Keld Ølykke26-Feb-11 14:12
Keld Ølykke26-Feb-11 14:12 
GeneralRe: OO design: Copying data from class A to B Pin
Nilzor27-Feb-11 22:39
Nilzor27-Feb-11 22:39 
GeneralRe: OO design: Copying data from class A to B Pin
Keld Ølykke28-Feb-11 10:24
Keld Ølykke28-Feb-11 10:24 
AnswerRe: OO design: Copying data from class A to B Pin
Eddy Vluggen26-Jan-11 8:07
professionalEddy Vluggen26-Jan-11 8:07 
GeneralRe: OO design: Copying data from class A to B Pin
Nilzor26-Jan-11 21:02
Nilzor26-Jan-11 21:02 
AnswerRe: OO design: Copying data from class A to B Pin
Ian Shlasko26-Jan-11 10:03
Ian Shlasko26-Jan-11 10:03 
AnswerRe: OO design: Copying data from class A to B Pin
Pete O'Hanlon26-Jan-11 22:41
mvePete O'Hanlon26-Jan-11 22:41 
AnswerRe: OO design: Copying data from class A to B Pin
GParkings2-Sep-11 2:30
GParkings2-Sep-11 2:30 
GeneralRe: OO design: Copying data from class A to B Pin
Nilzor2-Sep-11 3:27
Nilzor2-Sep-11 3:27 
GeneralRe: OO design: Copying data from class A to B Pin
GParkings2-Sep-11 4:16
GParkings2-Sep-11 4:16 
QuestionDifference between Generalization, Abstraction, Encapsulation? Pin
variantseeker19-Jan-11 15:58
variantseeker19-Jan-11 15:58 
AnswerRe: Difference between Generalization, Abstraction, Encapsulation? Pin
Praveen Raghuvanshi19-Jan-11 22:23
professionalPraveen Raghuvanshi19-Jan-11 22:23 
GeneralRe: Difference between Generalization, Abstraction, Encapsulation? Pin
Pravin Patil, Mumbai26-Jan-11 3:39
Pravin Patil, Mumbai26-Jan-11 3:39 
GeneralRe: Difference between Generalization, Abstraction, Encapsulation? Pin
Praveen Raghuvanshi26-Jan-11 5:01
professionalPraveen Raghuvanshi26-Jan-11 5:01 
QuestionHow to package the Factory into separate component assembly? Pin
Chesnokov Yuriy17-Jan-11 20:26
professionalChesnokov Yuriy17-Jan-11 20:26 

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.