The Design of Software (CLOSED)

A public forum for discussing the design of software, from the user interface to the code architecture. Now closed.

The "Design of Software" discussion group has been merged with the main Joel on Software discussion group.

The archives will remain online indefinitely.

GUI/objects/SQL DB application design

I'm working on a desktop application that displays data from a SQLite database. Pretty classic: the user can view a list, add, edit or delete entries.

Is there any book/resource that explains how this is usually designed?

Right now, I've got SQL queries all over the place including in the GUI part and I don't like that.

My main list displays customers. It makes sense to have a CCustomer class, with methods such as GetName, GetAddress, etc. How do I load it from the db? Should CCustomer have a Load method that makes the SQL and loads it?
Or should I have an intermediate class between CCustomer and the DB?

What about the data model? If I want to change a column name, I would like to do this in only one place. How do I avoid having SQL statements all over the application that I need to go through to make my change?

Surely there must be books or online sites that deal with these questions. Any recommendations?

Parisian developer ISO cute geek girl
Thursday, October 27, 2005
Very brief overview

// Customer class. Models a customer but also provides static Fetch and Add methods.
class Customer {

 static Customer Fetch(int customerid){
  return myDataProviderInstance.GetCustomer(customerid);

 static void Add(Customer aCustomer){
  return myDataProviderInstance.AddCustomer(aCustomer);

 public Customer(string surname, string firstname);


// Manages all database access (conenctions,
// commands, readers etc. Returns only business
// objects and not things like datareaders eg Customer,
// CustomerCollection etc

class DataProvider {
 Customer GetCustomer(int id) {
  // make SQL statement and db Call or call a stored proc
  // build and return a customer object

 int AddCustomer(Customer c){
 // build sql or stored proc from customer details

// Then in your GUI somewhere if you wanted to get a specific customer you would just do

Customer myCustomer = Customer.Fetch(id);
redeye Send private email
Thursday, October 27, 2005
post pict of cute geek girl and I will answer
outside the us
Thursday, October 27, 2005
"ISO" = In Search Of - haven't found her yet.
How about this: you answer, I finish my app, then I have spare time to find the girl, and then I can send some pics.
Makes sense?
Parisian developer ISO cute geek girl
Thursday, October 27, 2005
Ah, that's a relief. I was a little worried about what the ISO standard for cute geek girls would look like.
comp.lang.c refugee
Thursday, October 27, 2005
There are dozens of ways to do this. I recommend looking at Martin Fowler's pattern catalog:

Start with the domain logic patterns and then look at the data source patterns. Just remember to keep at simple as you can  - some of these patterns look nice, but they can  introduce a lot of unneeded complexity.

He also has a good book with more detail:
Jeff Mastry Send private email
Friday, October 28, 2005
Dino Send private email
Monday, October 31, 2005
I think what you need is object-relational mapper. Google for it.
Friday, November 04, 2005
Take a look at the database utility 'CakeWalk' that comes with TurboGears.  It's done very well:

There's a short quicktime movie showing it's usage.
you-can-now-have-your-cake-and-eat-it-too Send private email
Wednesday, November 09, 2005

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics
Powered by FogBugz