Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7942195
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T23:53:44+00:00 2026-06-03T23:53:44+00:00

I feel like I am asking a pretty basic question, and I think I

  • 0

I feel like I am asking a pretty basic question, and I think I should be able to find a good answer somewhere on the internet. But I am exhausted from searching and have only turned up a couple of dry bones. To top it all off, I am now frightened that this question is probably too subjective:)

Anyhow, here goes the question. What is considered good practice for accessing, processing, and manipulating data from a relational database in an object oriented program? So far in my programming I have been processing database data in a procedural sort of way. I am currently actively trying to improve my OOP habits and I wasn’t sure how to handle this issue.

Here is one of the scenarios I am working with. I have a table with many manufacturing job entries in it. The application I am writing (improving) performs a lot of processing on each job. For example I iterate through each row in the table and do the following:

  • Post the due date to Google calendar
  • create a folder unique to the job in a given directory
  • create a work order for the job
  • create a contract brief for the job
  • manages traveler documents
  • email info to a couple people
  • etc, the list goes on

You get the point. A lot of processing gets done on each job. Currently I have what most good programmers would call a fantastic crap pile of spaghetti code. Maybe it isn’t quite that bad, but almost. I iterate through each row in the table with a for each loop and sequentially perform each action on each row. I don’t like the way things are currently designed, but I don’t know what to do better.

I would like if I could have a neat object called “Jobs” which would implement all the properties of a job and provide a method for performing each of the actions. Then I could even make a custom collection to handle my jobs and all the world would be brighter. The whole solution would be more readable, easier to maintain, easier to add actions to perform on each job (which happens frequently), etc.

But my problem is I can’t figure out how to make the connection between the fancy objects and the database. Should I use some sort of Object-relational mapping (I read all kinds of mixed opinions about this)? Do I just loop through all the rows and convert them to objects which accumulate in a collection? Or is the best option to keep going about such projects in a procedural sort of way? I would love your answers and input.

I am interested in information on this subject in an abstract way. In other words I wonder how to handle a situation like this in general. Not just specific to the example I gave. But of course specifics are great as well. I do most of my programming in Visual Basic and C# with VS 2010.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T23:53:46+00:00Added an answer on June 3, 2026 at 11:53 pm

    Look at the Repository pattern. It’s a great way to separate data access from business processing in meaningful ways. Applying this pattern I have a few projects:

    • Entities – the objects that store stuff
    • DataAccess – the ORM DbContext and ADO.NET wrappers
    • Repository – wraps queries to present strongly-typed functions to the rest of the app
    • TheRest – the other projects / tiers: Business, GUI, etc

    See How to use Entity Framework context with dependency injection? for a good description of each of the project types

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I feel like this is a stupid question, but I can't think of a
I feel like a novice for asking this question -- but why is it
I feel pretty stupid asking this, but as I don't know the answer, I'm
I feel like I'm traveling 10 years back in time by asking this, but...
I feel like this is something I should already know, but I'm just not
I feel like this should be a no brainer, but clearly I'm missing something...
I feel like a moron asking this, but since I'm a new to developing,
I feel like an idiot for even asking this but does anyone have any
Ok, so I feel like a complete idiot asking this, but I've been looking
I feel like a real noob asking this, but here's my problem: I want

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.