2 Replies - 617 Views - Last Post: 16 November 2013 - 02:39 PM

#1 astonecipher  Icon User is offline

  • Major DIC Head
  • member icon

Reputation: 548
  • View blog
  • Posts: 2,455
  • Joined: 03-December 12

class diagrams

Posted 16 November 2013 - 01:31 PM

I have a simple question that I know I just can't think of the correct answer.

Working with a database does your CRUD go with your connection class or the class that is being inserted, ect?

I believe it does go with the connection class but, I can't recall at the moment.

This post has been edited by astonecipher: 16 November 2013 - 01:32 PM

Is This A Good Question/Topic? 0
  • +

Replies To: class diagrams

#2 Martyr2  Icon User is offline

  • Programming Theoretician
  • member icon

Reputation: 4307
  • View blog
  • Posts: 12,085
  • Joined: 18-April 07

Re: class diagrams

Posted 16 November 2013 - 02:33 PM

It goes with your connection class. The connection class is your database layer and connection, as well as CRUD operations, may be database dependent. So the thought goes that if you were to change your database, you would just switch out the connection class and its methods and the rest of your code wouldn't know any different.

The class being inserted is the data, not the operations.

In other words...

Database db = new database(connectionstring);

db.create("tablename");
db.insert("tablename", data);
db.update("tablename", id, data);
db.delete("tablename", id);

etc etc...


This post has been edited by Martyr2: 16 November 2013 - 02:36 PM

Was This Post Helpful? 1
  • +
  • -

#3 astonecipher  Icon User is offline

  • Major DIC Head
  • member icon

Reputation: 548
  • View blog
  • Posts: 2,455
  • Joined: 03-December 12

Re: class diagrams

Posted 16 November 2013 - 02:39 PM

Okay, thank you for confirming my suspicions.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1