|
From: ajspowart on 1 Nov 2006 20:52 My question relates to good design when it comes to creating an OO application that uses a relational database to store most of its data, how do people go about designing and storing the data once it has been retrieved from the database? Do you keep it as records, or when you get the data, do you create collections of objects which represent the data which you have obtained from your database? I am wanting to create an application that is for time management and I want most of the data to be on my webservers database, but in creating my OO 'client' I really want to create a good design. Anthony
From: Frans Bouma on 2 Nov 2006 03:37 ajspowart(a)gmail.com wrote: > My question relates to good design when it comes to creating an OO > application that uses a relational database to store most of its data, > how do people go about designing and storing the data once it has been > retrieved from the database? Do you keep it as records, or when you > get the data, do you create collections of objects which represent > the data which you have obtained from your database? > > I am wanting to create an application that is for time management and > I want most of the data to be on my webservers database, but in > creating my OO 'client' I really want to create a good design. It's IMHO always a good idea to start with a design for your abstract datamodel. This is a level above E/R, so it can have inheritance etc. For the technique, please check http://www.orm.net (Object Role Modelling, formely known as NIAM) This gives you a good idea which entities are identifyable within your system, their attributes and their relations with other entities. Once you've modelled this out, you can go in several directions: you can pick this model and turn it into a domain model (thus a class model)and simply get an o/r mapper of your liking and store the entities into a physical datamodel matching your domain model. You can also pick it up and create a physical data model in a database with it and use it as well for your entity classes, which are then consumed by your application logic. Please read my essay about this here: http://weblogs.asp.net/fbouma/archive/2006/08/23/Essay_3A00_-The-Databas e-Model-is-the-Domain-Model.aspx FB -- ------------------------------------------------------------------------ Lead developer of LLBLGen Pro, the productive O/R mapper for .NET LLBLGen Pro website: http://www.llblgen.com My .NET blog: http://weblogs.asp.net/fbouma Microsoft MVP (C#) ------------------------------------------------------------------------
From: topmind on 2 Nov 2006 11:44 ajspowart(a)gmail.com wrote: > My question relates to good design when it comes to creating an OO > application that uses a relational database to store most of its data, > how do people go about designing and storing the data once it has been > retrieved from the database? Do you keep it as records, or when you get > the data, do you create collections of objects which represent the data > which you have obtained from your database? > > I am wanting to create an application that is for time management and I > want most of the data to be on my webservers database, but in creating > my OO 'client' I really want to create a good design. > > Anthony This is an age-old quesition. OO and relational tend to have different philosophical tilts such that there is no easy or universal way to meld them. -T- oop.ismad.com
From: H. S. Lahman on 2 Nov 2006 12:21 Responding to Ajspowart... > My question relates to good design when it comes to creating an OO > application that uses a relational database to store most of its data, > how do people go about designing and storing the data once it has been > retrieved from the database? Do you keep it as records, or when you get > the data, do you create collections of objects which represent the data > which you have obtained from your database? > > I am wanting to create an application that is for time management and I > want most of the data to be on my webservers database, but in creating > my OO 'client' I really want to create a good design. I assume the time management application does something complex rather than simply acting as a pipeline between RDb and UI (i.e., CRUD/USER processing). If not, you can stop reading. Solving a time management problem is a quite different subject matter than persisting the relevant data. Solve the time management problem in you application first. Then, when you know what object attributes need to be persisted, define a suitable Data Model for the database. The RDB Data Model and the solution's Class Model will typically be different for non-CRUD/USER applications because they need to be optimized differently. Finally, provide a subsystem for the application that maps between the two views. The interface to the DB Access subsystem is defined by the time management solution's need to obtain and store data to initialize and save objects. The DB Access subsystem then maps those requests into SQL queries or whatever that are appropriate for the Data Model. Typically, on the solution side one will have factory objects to instantiate the solution's objects. Those factory objects will request the appropriate data from the DB Access to do the instantiation and initialization. Conversely, when it is time to save attributes from the solution objects, some object extracts the relevant attribute values sends them off to the DB Access subsystem to be stored. ************* There is nothing wrong with me that could not be cured by a capful of Drano. H. S. Lahman hsl(a)pathfindermda.com Pathfinder Solutions http://www.pathfindermda.com blog: http://pathfinderpeople.blogs.com/hslahman "Model-Based Translation: The Next Step in Agile Development". Email info(a)pathfindermda.com for your copy. Pathfinder is hiring: http://www.pathfindermda.com/about_us/careers_pos3.php. (888)OOA-PATH
From: Doug Pardee on 2 Nov 2006 16:00
ajspowart(a)gmail.com wrote: > when it comes to creating an OO application that uses a relational > database to store most of its data, how do people go about designing > and storing the data once it has been retrieved from the database? > Do you keep it as records, or when you get the data, do you create > collections of objects which represent the data which you have > obtained from your database? Martin Fowler's book "Patterns of Enterprise Application Architecture" covers this territory. It would be a good starting point. |