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. General Programming
  3. C / C++ / MFC
  4. Develop with style

Develop with style

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialc++databasedesignoop
3 Posts 3 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.
  • E Offline
    E Offline
    Emanuele 0
    wrote on last edited by
    #1

    I write apps in C++ (using VC++) and often I'm not sure where to palce the classes. For example, if I have a class that interact with a database (CDaoMyClass) I put a reference to this class in the CMyDocument class. Is it right? I have some trouble in design the class hirerchy for my applycation. Is there a book that teach how to design a GOOD application with an Object Oriented approach? I mean the Style of programming is important!!! Thanks!

    T N 2 Replies Last reply
    0
    • E Emanuele 0

      I write apps in C++ (using VC++) and often I'm not sure where to palce the classes. For example, if I have a class that interact with a database (CDaoMyClass) I put a reference to this class in the CMyDocument class. Is it right? I have some trouble in design the class hirerchy for my applycation. Is there a book that teach how to design a GOOD application with an Object Oriented approach? I mean the Style of programming is important!!! Thanks!

      T Offline
      T Offline
      Tomasz Sowinski
      wrote on last edited by
      #2

      For example, if I have a class that interact with a database (CDaoMyClass) I put a reference to this class in the CMyDocument class. Is it right? What do you mean by a 'reference'? Something like this? // member of CMyDocument CDaoMyClass &m_rDaoMyClass; Is there a book that teach how to design a GOOD application with an Object Oriented approach? 'Design Patterns' by Gamma et al. Tomasz Sowinski -- http://www.shooltz.com

      1 Reply Last reply
      0
      • E Emanuele 0

        I write apps in C++ (using VC++) and often I'm not sure where to palce the classes. For example, if I have a class that interact with a database (CDaoMyClass) I put a reference to this class in the CMyDocument class. Is it right? I have some trouble in design the class hirerchy for my applycation. Is there a book that teach how to design a GOOD application with an Object Oriented approach? I mean the Style of programming is important!!! Thanks!

        N Offline
        N Offline
        NormDroid
        wrote on last edited by
        #3

        The 'Orthodox' way is to store all persistent data in the applications document. There are problems with doing this: Eg. You have an SDI application, with a control bar, nested in control bar is a custom list ctrl. Now from the list ctrl you need to display data stored in the document, this is where MFC becomes very messy. You do the following, 1/ Get the MainFrame (AfxGetMainWnd and cast to CMainFrame*) 2/ Get the ActiveDocment (GetActiveDocument and cast to CMyDoc) This completely sucks, however I have lived with this for 7 years. The other solution is a MVC (Model/View/Controller) pattern, Stingray have developed a class framework implementing MVC (unfortunately I haven't used this). MVC is a much OOD way of the DOC/View metaphor. Regards Norm

        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