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

    Join Date
    Jun 2004
    Posts
    4
    Rep Power
    0

    Question Help me identify this design pattern please


    Imagine an application that simulates engines/transmissions/torque converters/etc. all of which derive from a base Part class. The Part class defines an array of input and output Shafts. The Shaft class only holds data to communicate between Parts, such as torque and speed.

    This design would allow me to configure a vehicle in a number of ways by connecting parts with shafts, and I could make custom parts for other vehicles that will take the input shafts data, modify it, and apply the results to the output shaft. I could connect multiple transmissions directly together, or have multiple differentials connected to each other, etc..

    Its inspired by Propellerhead's Reason software which lets you mount racks and manually connect wires on the back of the rack if that helps anyone understand it better.

    Can anyone tell me if a setup like this matches up with a particular design pattern that is defined out there on the internet somewhere?
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2013
    Location
    Usually Japan when not on contract
    Posts
    240
    Rep Power
    11
    I can't think of a Design Pattern(tm) that fits this, or maybe I can think how Design Pattern zombies can retroactively explain how any of their current must use/sell design patterns are really what you're describing.

    You may have noticed how little faith I have in OOP design patterns. This is mostly because the meaning of OOP has drifted so much since the GoF wrote their book that you're talking apples and goat-liver pudding if you're trying to find a GoF pattern that matches something in, say, straight Java or C++ (magical C++ libraries like Qt aside). Pretty much everything I've seen since the original design patterns book has either been snake oil or an attempt to "prove" that software development "is licensable engineering since we all follow patterns X, Y, and Z".

    Anyway, have no fear. The object system you describe fits the situation you are trying to simulate quite well. Its one of the best uses of objects I've seen described on this forum in quite a while.

    You have a good idea. Don't let someone come along and convince you out of pursuing your design path merely by winning an argument by eloquence or obfuscation.
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2004
    Posts
    4
    Rep Power
    0
    Thanks for the reply. I have actually found design patterns to be quite helpful when architecting a project, especially back when I was a newbie to programming. They really taught me more about polymorphism and why/how its useful. So I was just wondering if there was one for something like this.

    Thanks for the compliment. I won't be changing course on the design any time soon. I've been thinking about the design for years and I'm excited to put it to use.

IMN logo majestic logo threadwatch logo seochat tools logo