Solved

Layered Architecture Confusion

Posted on 2004-04-07
5
225 Views
Last Modified: 2010-04-17
This question relates to the Layered Architecture pattern and to OOA/D in general. I hope I have posted it in the right area!

I am new to OOA/D and patterns (including the layers pattern). I am developing a computerised log book system in .NET using layers, in other words I am using an access db (data layer), I have a domain layer, and I am using Windows forms for the presentation layer.

The log book system is used to keep track of photographic films that have been dropped into a shop for processing. The user of the system must select the type of photographic developement service for the film from a list of available services, and then select the appropriate service options. Each service has one or more service options. When the user selects a particular photographic development service, I need the presentation layer (i.e. the windows form) to then display the appropriate service options in a suitable format. For example some service options might be represented by checkboxes, some might be textboxes, and some might be comboboxes.

What is the best way to go about this, bearing in mind that I do not want to couple the presentation layer to the domain layer too tightly. I have had it suggested to me that I should be looking to implement a data-driven approach, but I don't really know what this means.

Any help would be greatly appreciated.


Kind Regards,
Brad
0
Comment
Question by:bradwebber
  • 2
5 Comments
 
LVL 6

Expert Comment

by:mmusante
ID: 10776142
I usually solve problems like this by adding a field to the DB table (service options) that describe with a code the datatype of the record (for example 0=boolean 1=text 2=numeric...), then the GUI code choose the right control based on this datatype code (for example 0=checkbox, 1=textbox 2=textbox ...)

... hope this can help you ...
0
 

Author Comment

by:bradwebber
ID: 10778718
Hi there mmusante,

How would I represent something like a combo box with three or four entries though? A service option would correspond to an entry in the combox, but how would the gui know which combobox to assign the service option to (assuming there was more than one combobox)???
0
 
LVL 6

Accepted Solution

by:
mmusante earned 300 total points
ID: 10781326
I suggest to store the comboitems in your DB in a table like this:

idCombo INTEGER   \   Unique index  with both fields
ItemText VARCHAR /

and then store the idCombo in a field of the the "service options" table when the datatye is the code for 'combo'

you can pass to the presentation layer a list with the comboitems and use it to dynamically fill the combo
0

Featured Post

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Displaying an arrayList in a listView using the default adapter is rarely the best solution. To get full control of your display data, and to be able to refresh it after editing, requires the use of a custom adapter.
This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question