Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

OO Design question, XDocument

Posted on 2010-09-24
2
Medium Priority
?
481 Views
Last Modified: 2012-05-10
Please help me to understand the newer and possibly more modern programmers I am working with.  I come from a SmallTalk / C++ background but I would like to think I know something about inheritance and c#.

We will be doing a lot of work with .Nets XDocument on a series of XML sources with very- very similar schemas.

So it is reasonable from my background to create a new name space and extend the XDocument class with functionality we will need.  I think it is reasonable to create a more refined XDocument from the point of view of our needs.  I favor a ‘Is-A’ design where the new class is integrated with our logging and other proprietary behaviors.  Furthermore containing methods that we need over and over again.

The true .NET recently college trained programmers strongly object.  They advocate a ‘Has-A’ design with other classes that accept enumerators of type XDocument to do the type of refinements necessary.


I value your opinion.  Thank you for your time and consideration.  

Example code.
namespace MyCompany.MyProduct.XDocument
{

public class XDocumentFR : XDocument , IDisposable

static XElement CloneElement(XElement element)
public string ValueAsTextFromElement(XElement rootElement, string xPath)
public void Load(xmlSourceType eXmlSource, string xmlSourceValue)


0
Comment
Question by:wilfordrocks
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 5

Accepted Solution

by:
VincentSG earned 2000 total points
ID: 33759040
Hi!

I think this is an interesting question.

The benefits of a "Is-A" approach is that all functionalities are already built-in into the class. If you are sure that in your project and future projects you will keep using this same class without much modification, then it could be easier to manage your code in the future.

However, having a "Has-A" approach allows you to build functionality classes such as Logging etc that can be reused in other projects which could have totally different nature.

Therefore I would suggest that if you are planning to build a library that be reused for other projects OR you already have other classes such as Logging etc from other projects, use a "Has-A" approach. If you do not need or want to support other projects or want to keep it simple and within this project, then use a "Is-A" approach.

Personally I would prefer a "Has-A" approach in general cases however I believe whether to follow which approach should be on a case-by-case basis.
0
 

Author Closing Comment

by:wilfordrocks
ID: 33760096
Thank you for your insight.  
Personally, I find the .Net strangely lacking in project wizards and frameworks like the document / view architecture.  The development framework provided is more like VB 6.0 than VC 6.0.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

One of Google's most recent algorithm changes affecting local searches is entitled "The Pigeon Update." This update has dramatically enhanced search inquires for the keyword "Yelp." Google searches with the word "Yelp" included will now yield Yelp a…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question