#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2010
    Posts
    5
    Rep Power
    0

    OO Design Collections


    Could anyone please help me solving this puzzle:

    There is a big vessel filled with Milk and I am required to fill some small vessels with this milk. How am I supposed to approach this scenario in an OO way.

    Your help will be greatly appreciated!
  2. #2
  3. Jealous Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    14,303
    Rep Power
    9400
    What have you thought of so far? Tried anything yet?
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2010
    Posts
    5
    Rep Power
    0
    Anyone please!
  6. #4
  7. Jealous Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    14,303
    Rep Power
    9400
    You mean anyone else, I take it?

    Don't like that I'm not giving you the answer? Don't like that I'm encouraging you to do it on your own?

    I'll ask again: what have you done so far with this assignment? How much thought have you put into it yourself?

    Comments on this post

    • jzd agrees
  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2010
    Posts
    5
    Rep Power
    0
    Sorry, I thought it was the quote written in your signature so I ignored it. My mistake sorry!

    I know I need to use collections over here but don't know how to explain it!

    I am expecting this question next week in my exams!
  10. #6
  11. No Profile Picture
    Contributing User
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    May 2004
    Posts
    3,417
    Rep Power
    887
    We don't do your homework here, but we'd be happy to help if you exhibit some level of motivation that goes beyond pleading for help. Perhaps you could start by asking a sensible question that doesn't imply having us do all the work for you?

    Are you a computer science student? What year?
    What have you covered in class so far?

    Comments on this post

    • jzd agrees
    I no longer wish to be associated with this site.
  12. #7
  13. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2010
    Posts
    5
    Rep Power
    0
    I understand its a difficult question but any suggestions will be appreciated!

    Comments on this post

    • jwdonahue disagrees : You were given a chance to prove you weren't completely useless and lazy. I guess [i]that[/i] was difficult for you to understand.
  14. #8
  15. Contributing User
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Feb 2007
    Posts
    1,940
    Rep Power
    3117
    Its not a difficult question. It is just that no one wants to do your homework for you.
  16. #9
  17. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Jul 2005
    Location
    Bay Area, California
    Posts
    841
    Rep Power
    1682
    Okay, how about instead of an answer some hints to help you start thinking of an answer? I think that's a fair compromise.

    Remember that OO is all about interactions between intelligent agents (aka objects: encapsulated state + behavior). That means that an object-oriented design should have the following characteristics: messaging, local retention and protection and hiding of state-process, late-binding (polymorphism, duck-typing, etc). Inheritance is not part of the core principles of OO, but rather a language extension, so you don't need it unless it simplfies your design.

    The next step is to think about the domain model (cargo transportation). Can you generalize out milk as a just the contents of the cargo? There may be other cargo types that add constraints, e.g. toxic. The cargo containers may be of different sizes so filling vessles may have different approaches (e.g. greedy algorithm). There may be different scheduling types to minimize an attribute (cost, shipping time, etc). All of these things may need to be modelled in an industrial-strength application.

    Now your requirements are quite simple, so recognize the domain model but keep it limitted to your use-case. Think about the roles, responsibilities, and collaborations required to solve the problem. Ensure that no single role is too big, distribute intelligence, and preserve flexibility.

    Spend some type scratching out ideas on a sheet of paper or whiteboard. Once you have something you like, then post it for our feedback.

    Comments on this post

    • cubic98 agrees
    Core design principles when developing software systems.
    See my open-source project as an example of professional code.
    ---
    The opinions expressed do not represent those of my employer.
  18. #10
  19. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2010
    Posts
    5
    Rep Power
    0
    Thanks Novax!
    I appreciate your comments and I will come back with some concrete feedback.

    Once again thanks a lot!
  20. #11
  21. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2008
    Posts
    62
    Rep Power
    14
    NovaX gave you some hints, you can do something and all of us can learn something discussing your ideas...
    To find out everything about design patterns check the Design Patterns Reference on oodesign.com.

    Find and share the best tips, tutorials and howto's for php web developers on the newly started php-html.net community.
  22. #12
  23. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2010
    Location
    Bangle of India
    Posts
    52
    Rep Power
    5
    I also know that almost everyone who teaches object orientation uses the class as a fundamental building block. Such an approach misses the central point of object orientation: the objects themselves, and what they portend for flexibility and effective design. No prior knowledge of object orientation is assumed, though some knowledge of Java or other high level programming language is required. Thanks and like to share.
  24. #13
  25. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2010
    Location
    http://www.rackmountsales.com/
    Posts
    78
    Rep Power
    0
    Object oriented programming plays an important role in software design. it is very easy to use and has less complexity.

    Comments on this post

    • jzd disagrees : What does this have to do with the question?

IMN logo majestic logo threadwatch logo seochat tools logo