473,405 Members | 2,141 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

object oriented question

Hello all,

I have an object in business layer called
JPPage
Which has the properties:
id
title
content
parent
level

what I want to know is. I have a crumb trail on my front end which
only requires the properties id and title. So do I use a collection of
JPPage objects (even though the JPPage object has more properties that
I need for my crumb trail) or do I create a crumb trail object with
properties id and title? If I do this then in essense I have duplicate
code.

Or do I create an object, for example, called JPSimplePage with the
properties id and title and then create an object JPPage which
inherits JPSimplePage and has the additional properties of content,
parent and level?

Thanks in advance, just want to get my OO methology correct.

thanks
Russ
Nov 18 '05 #1
3 942
Russell,
First off, I don't see anything overly wrong with having a collection of
JPPage objects which only have a couple of their properties set. The only
real problem I see is that people might try to access other properties -
since it's fairly reasonable to expect the entire set of properties to be
properly set.

I think your inheritance idea is the way to go. This way there's no
confusion about what data is available when.

KArl

--
MY ASP.Net tutorials
http://www.openmymind.net/
"Russell" <ru************@hotmail.com> wrote in message
news:15**************************@posting.google.c om...
Hello all,

I have an object in business layer called
JPPage
Which has the properties:
id
title
content
parent
level

what I want to know is. I have a crumb trail on my front end which
only requires the properties id and title. So do I use a collection of
JPPage objects (even though the JPPage object has more properties that
I need for my crumb trail) or do I create a crumb trail object with
properties id and title? If I do this then in essense I have duplicate
code.

Or do I create an object, for example, called JPSimplePage with the
properties id and title and then create an object JPPage which
inherits JPSimplePage and has the additional properties of content,
parent and level?

Thanks in advance, just want to get my OO methology correct.

thanks
Russ

Nov 18 '05 #2


cheers Karl.. I thought you might say that. Im loving OO. no more
spagetti code!!

RuSs

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #3
Russell if you have duplicate code then you may need a further level in your
hierarchy

How about:

BaseObject
id

CrumbObject : BaseObject
title

JPPage : CrumObject
content
parent
level

MattC

"Russell" <ru************@hotmail.com> wrote in message
news:15**************************@posting.google.c om...
Hello all,

I have an object in business layer called
JPPage
Which has the properties:
id
title
content
parent
level

what I want to know is. I have a crumb trail on my front end which
only requires the properties id and title. So do I use a collection of
JPPage objects (even though the JPPage object has more properties that
I need for my crumb trail) or do I create a crumb trail object with
properties id and title? If I do this then in essense I have duplicate
code.

Or do I create an object, for example, called JPSimplePage with the
properties id and title and then create an object JPPage which
inherits JPSimplePage and has the additional properties of content,
parent and level?

Thanks in advance, just want to get my OO methology correct.

thanks
Russ

Nov 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Sandman | last post by:
Could anyone give me a tip about a good primer on object oriented php programming - why I should use it, the benefits, the drawbacks, the bugs, the glory? And, should I upgrade to php5 before...
2
by: Ricardo Batista | last post by:
I need that someone help me. I need to program the dijkstra algorithm by object oriented. I'll send my code. #!/usr/bin/env python # -*- encoding: latin -*- NIL =
6
by: flamesrock | last post by:
ok, so to my knowledge, object oriented means splitting something into the simplest number of parts and going from there. But the question is- when is it enough? For example I have the following...
5
by: Martin | last post by:
When was inheritance intruduced into object oriented programming? More generally, does anyone know or have any sources on when the different features were introduced into object oriented...
100
by: E. Robert Tisdale | last post by:
What is an object? Where did this term come from? Does it have any relation to the objects in "object oriented programming"?
11
by: Vishal Naidu | last post by:
i m a college student in my second year..... my queston is.. is it really possible to write object oriented code in C ? and if yes how do we achieve abstration, polymorhism , hierarchy etc. in C
2
by: ulrich schumacher | last post by:
Hi ASP.NET 2.0 Professionals, I've got a question concerning the new ASP.NET 2.0 DataBinding with object oriented business classes: Example: There are two business classes in my domain...
47
by: Thierry Chappuis | last post by:
Hi, I'm interested in techniques used to program in an object-oriented way using the C ANSI language. I'm studying the GObject library and Laurent Deniau's OOPC framework published on his web...
46
by: ajba74 | last post by:
Hi fellows, I am reading some books to learn the C programming language, and sometimes I have the feeling that when somebody becomes a C expert, he must learn a more modern and object-oriented...
3
by: notnorwegian | last post by:
i have some confusion over this. sure a class is basically a classification, like for example an animal or flower. and an object/instance of that class is then for example a cat. an object is...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.