BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Design Questions First Steps

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi OO design
View previous topic :: View next topic  
Author Message
diktyo
Guest





PostPosted: Wed May 11, 2005 6:19 pm    Post subject: Design Questions First Steps Reply with quote



First steps in OO design (literlly crawling through MVP,
Iterators etc).

Trying to design some simple Business Objects (not even
accustomed to the notation ...)


type
TCity = class(TObject)
fCityID : integer;
fCityDesc : string;


TCustomer = class(TObject)
fCustID : integer;
fCustName : string;
f...................
fCityID : integer;
fCityName : string ;//<======= should I put it here ????


CITY is kind of look-up object. In DB Normalization theory I should
NOT put CityDesc within Customer (record). Is there any BENEFIT (only
benefits please) so as to put it in TCustomer ?

Thanks

Petros

PS. I am (trying to) develop a simple application for
an association I am member to (no fees involved) and I have
"plenty" of time (till summer end), so I decided to give it
a try both ways , the old RAD way and the "new to me" OO way.
I also post to Database groups, but for the "old" way"


Back to top
Peter Morris [Droopy eyes
Guest





PostPosted: Wed May 11, 2005 10:21 pm    Post subject: Re: Design Questions First Steps Reply with quote



Quote:
fCityID : integer;
fCityName : string ;//<======= should I put it here ????

You should have CityID or CityName there, you should only have

City: TCity;

You can get the ID from the City object itself if you need to.

If you are trying various approaches, you should try ECO.



--
Pete
====
ECO Modeler, Audio compression components, DIB graphics controls,
FastStrings
http://www.droopyeyes.com

Read or write articles on just about anything
http://www.HowToDoThings.com

My blog
http://blogs.slcdug.org/petermorris/



Back to top
Joanna Carter (TeamB)
Guest





PostPosted: Wed May 11, 2005 10:34 pm    Post subject: Re: Design Questions First Steps Reply with quote



"diktyo" <diktyo (AT) mail (DOT) gr> a ecrit dans le message de news:
[email]42824caf (AT) newsgroups (DOT) borland.com[/email]...

Quote:
type
TCity = class(TObject)
fCityID : integer;
fCityDesc : string;

Of course you should never have published fields like this :-)

You should really not use the class name to prepend fields or properties
either :

TCity = class
private
fID: Integer;
fDescription: string;
...
public
property ID ...
property Description ...
...
end;

TCustomer = class
private
fID: Integer;
fName: string;
f...................
fCity: TCity;
public
property ...
end;

Quote:
fCityName : string ;//<======= should I put it here ????

You should not have anything to do with the City, apart from a TCity object,
inside the Customer class.

Joanna

--
Joanna Carter (TeamB)

Consultant Software Engineer
TeamBUG support for UK-BUG
TeamMM support for ModelMaker



Back to top
diktyo
Guest





PostPosted: Thu May 12, 2005 9:05 am    Post subject: Re: Design Questions First Steps Reply with quote

Quote:
You should not have anything to do with the City, apart from a TCity
object, inside the Customer class.

Joanna



It's so obvious when someone else tells you how
to do it !!!

Joanna, Peter thanks, but I think I need a much
stronger brainwash to get rid of old habits
(design database schema first etc.)

Can't teach an old dog new tricks.

Petros

Back to top
Joanna Carter (TeamB)
Guest





PostPosted: Thu May 12, 2005 10:09 am    Post subject: Re: Design Questions First Steps Reply with quote

"diktyo" <diktyo (AT) mail (DOT) gr> a écrit dans le message de news:
[email]42831c6d (AT) newsgroups (DOT) borland.com[/email]...

Quote:
Joanna, Peter thanks, but I think I need a much
stronger brainwash to get rid of old habits
(design database schema first etc.)

Yes, it's a common problem :-)

Don't forget to look up things like how to manage aggregation vs.
composition :

Aggregation means just having a reference to an object like your City
example.

Composition means ensuring the that a containing class is totally
responsible for the items it contains. e.g. SalesOrder contains
SalesOrderLine items. In this case, you would expect a database to have a
reference to the SalesOrder in each of the SalesOrderLines.

But this is not how you design classes; you should have a read only list
property inside the SalesOrder class and only be able to add new lines by
addressing an AddLine method in the SalesOrder class.

Not aiming to confuse you; just making sure you don't let this one slip by
Smile)

Quote:
Can't teach an old dog new tricks.

Oh, I don't know - I went to Uni at age 37

Joanna

--
Joanna Carter (TeamB)

Consultant Software Engineer
TeamBUG support for UK-BUG
TeamMM support for ModelMaker



Back to top
Bryan Crotaz
Guest





PostPosted: Fri May 13, 2005 12:47 pm    Post subject: Re: Design Questions First Steps Reply with quote

Quote:
Can't teach an old dog new tricks.

Oh, I don't know - I went to Uni at age 37

Joanna

So that makes you an old dog... Hmmm self esteem problems, J? ;-)

Bryan




Back to top
Jim Cooper
Guest





PostPosted: Fri May 13, 2005 1:27 pm    Post subject: Re: Design Questions First Steps Reply with quote


Quote:
So that makes you an old dog...

Bitch, actually <vbg>

Oh bugger, I just remembered she knows where I live. Damn!!



Cheers,
Jim Cooper

__________________________________________

Jim Cooper [email]jcooper (AT) tabdee (DOT) ltd.uk[/email]
Tabdee Ltd http://www.tabdee.ltd.uk

TurboSync - Connecting Delphi to your Palm
__________________________________________

Back to top
krisztian pinter
Guest





PostPosted: Fri May 13, 2005 2:17 pm    Post subject: Re: Design Questions First Steps Reply with quote



you are going to have a VB3 project


Jim Cooper <jcooper (AT) tabdee (DOT) ltd.uk> wrote:

Quote:
Bitch, actually
Oh bugger, I just remembered she knows where I live. Damn!!


Back to top
Joanna Carter (TeamB)
Guest





PostPosted: Fri May 13, 2005 2:25 pm    Post subject: Re: Design Questions First Steps Reply with quote

"Bryan Crotaz" <bryan (AT) no (DOT) spam.for.me.please.inspirationmatters.com> a écrit
dans le message de news: 4284a1ef$1 (AT) newsgroups (DOT) borland.com...

Quote:
So that makes you an old dog... Hmmm self esteem problems, J? Wink

That reminds me; wasn't I due to visit your kennel sometime this year ? Smile)

Call me on my mobile.

Joanna

--
Joanna Carter (TeamB)

Consultant Software Engineer
TeamBUG support for UK-BUG
TeamMM support for ModelMaker



Back to top
Jim Cooper
Guest





PostPosted: Fri May 13, 2005 3:58 pm    Post subject: Re: Design Questions First Steps Reply with quote


Quote:
you are going to have a VB3 project

I know, I've been bad :-)


Cheers,
Jim Cooper

__________________________________________

Jim Cooper [email]jcooper (AT) tabdee (DOT) ltd.uk[/email]
Tabdee Ltd http://www.tabdee.ltd.uk

TurboSync - Connecting Delphi to your Palm
__________________________________________

Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi OO design All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.