Results 1 to 7 of 7

Thread: [RESOLVED] What to implement in this case

Threaded View

  1. #1

    Thread Starter
    Fanatic Member stlaural's Avatar
    Join Date
    Sep 2007
    Location
    Quebec, Canada
    Posts
    683

    Resolved [RESOLVED] What to implement in this case

    Hi guys, I'm kinda having a brain freeze here thinking about this.
    Simple best practice question here I would say.

    I have a class to create lets call it "Contract" and it has a type property that can be "Service" or "Product"

    If I instantiate a Contract of Service type, it should have a start date and and end date. These two dates should be mandatory but only if the instantiate Contract is a Service.

    What are the different ways to implement that ? I thought about using the Factory design pattern so if you ask the factory of a Service type Contract you need to provide the two dates but I kinda find it overkill for just two different cases (Service and Product) Any Ideas of other efficient ways of doing that? I Just can't believe there wouldn't be something else.

    Thanks for any suggestion.
    Last edited by stlaural; Aug 18th, 2010 at 12:19 PM.
    Alex
    .NET developer
    "No. Not even in the face of Armageddon. Never compromise." (Walter Kovacs/Rorschach)

    Things to consider before posting.
    Don't forget to rate the posts if they helped and mark thread as resolved when they are.


    .Net Regex Syntax (Scripting) | .Net Regex Language Element | .Net Regex Class | DateTime format | Framework 4.0: what's new
    My fresh new blog : writingthecode, even if I don't post much.

    System: Intel i7 920, Kingston SSDNow V100 64gig, HDD WD Caviar Black 1TB, External WD "My Book" 500GB, XFX Radeon 4890 XT 1GB, 12 GBs Tri-Channel RAM, 1x27" and 1x23" LCDs, Windows 10 x64, ]VS2015, Framework 3.5 and 4.0

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width