Skip to Content.
Sympa Menu

gang-of-4-patterns - [gang-of-4-patterns] Pattern for data objects

gang-of-4-patterns AT lists.cs.illinois.edu

Subject: Design Patterns discussion

List archive

[gang-of-4-patterns] Pattern for data objects


Chronological Thread 
  • From: Patrick Plaatje <patrick AT ipros.nl>
  • To: gang-of-4-patterns AT cs.uiuc.edu
  • Subject: [gang-of-4-patterns] Pattern for data objects
  • Date: Mon, 28 Sep 2009 16:57:36 +0200
  • List-archive: <http://lists.cs.uiuc.edu/pipermail/gang-of-4-patterns>
  • List-id: Design Patterns discussion <gang-of-4-patterns.cs.uiuc.edu>

Hi all,

im fairly new to design patterns, but have read my share on the subject already. I am aware that not all programming needs design patterns, but i've come to a point where i could use a little help in solving a problem i am facing. Although i am not sure if i should post this, but if not, i hope someone can push me in the right direction.

I am implementing a data layer in my application, which on it's turn will be based on the JSR-283 specification (Java Content Repository). So with an existing package of interfaces i am trying to develop an independent storage (data) layer. The intention is that data can be stored on local disk, webdav, database, etc. When googling/reading/trying i finally came across Sun's Core J2EE pattern library. Here they have a pretty interesting pattern which could solve my challenge: the Data Access Object. So i started off implementing this design, but soon enough it stroke me that it was really a lot of work implementing this, and i'm starting to think that this might not be the way to go. Here's what's happening:

I am creating an abstract class: the DAOFactory, which is extended by the Data Layers (LocalFileSystem, WebDav, DB). These specific datalayers have methods which return a specialized object which knows how to deal with the actual object (loading/saving/etc). This sounds fairly simple and easy to do, but when i implemented this, it actually results in very, to my opinion, bloated code. Because for each specific datastore(-source) the domain objects need their specific implementation and when a new domain object is introduced, i will need to modify all datalayer classes.

I was wondering if someone had some thoughts about the preceding? I'd really appreciate anyone's opinion on this. If you need more info or actual code, please leave a reply.

Thanks in advance & best regards,

Patrick



  • [gang-of-4-patterns] Pattern for data objects, Patrick Plaatje, 09/28/2009

Archive powered by MHonArc 2.6.16.

Top of Page