Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Product Lifecycle
  3. Collaboration / Beta Testing
  4. Architecture question

Architecture question

Scheduled Pinned Locked Moved Collaboration / Beta Testing
oopdatabasequestionalgorithmsdata-structures
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Jon Merrifield
    wrote on last edited by
    #1

    Hi all, I've been reading CP for a while now but this is my first post, so I hope it makes sense! I'm working on a project that uses a somewhat complex data structure, consisting of about 8 different classes of object all related together. The classes in the structure are getting a bit complex and I would like to break things down a bit but I'm not sure about the best way to do it. Each class has code for accessing the data it contains, displaying itself graphically, saving and loading itself from the database, and checking itself for validity. A lot of these features make strong use of the inheritance hierarchy which is why they are in the classes in the first place. My main idea at the moment is to create multiple parallel class hierarchies, one representing the base data, one containing display code, one containing DB code, and so on. Each class in the data namespace will have a corresponding class in each of the other namespaces. I'm concerned though that, although this seems to be a better abstraction, it will be hard to do without violating encapsulation - the DB loading/saving classes will need fairly unrestriced access to the data classes. The other problem is the complexity of maintaining all these parallel hierarchies, and of course the best way to use them - do I create a full parallel object graph of database classes if I need to save the data structure, or use static methods in the database namespace to perform the DB operations? I'm sure there's no straight answer to a question like this, but I'd be interested to know how others achieve the same thing, also if anyone could recommend some good reading on the subject I'd be grateful! Thanks Jon Merrifield

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups