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 985621
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T05:11:33+00:00 2026-05-16T05:11:33+00:00

I was taught to decouple code implementation from database implementation through the use of

  • 0

I was taught to decouple code implementation from database implementation through the use of stored procedures. I’m wondering how much true benefit there is sometimes. I know it differs from case to case, so, for instance:

Decoupled DAO Methods (C#)

User FindByName(string value);
User FindByLogin(string value);
User FindByEmail(string value);
User FindByFoo(string value);
User FindByBar(string value);

Contrast that with:

Not-So-Decoupled DAO Methods

User FindBy(string columnName, string value);

This results in significantly less code to be written (though, admittedly, most of it would be cut-and-paste), many fewer stored procedures to be written and maintained, but also couples the code to the database implementation.

Where’s the line between good and impractical design practice in this example case?

  • 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-05-16T05:11:34+00:00Added an answer on May 16, 2026 at 5:11 am

    The decoupling is not as bad as you infer. In your example, you are likely to have FindByName() and FindByLogin(), any further options are not so likely.

    What you are actually seeking is a nice separation between your compiled code and the database, not a proliferation of stored procedures. Ideally it should be coded in such a way that it requires little to no change in your compiled code to change not just the content of the stored procs, but the entire database system. Think of it this way – the signature of the stored proc is like an interface, your compiled code doesn’t care what happens on the inside as long as the input and output types and rules remain the same.

    Of course this is an ideal scenario and it doesn’t mean you have to do this, it may be overkill and totally over engineered for your situation. A simple fuzzy FindBy() may be perfect for meeting your current and future requirements. Your application to database call structure can be as granular as you want to make it. But this doesn’t mean that your FindBy(string columnName, string value) is necessarily a good option to have because it is tying you to a specific table or view structure (even if you are actually calling a stored proc to implement it), which is what you are trying to keep away from with your code/database separation.

    At the end of the day, it comes down to a compromise between:

    • does it meet the current requirements
    • can it be done within the required timeframe and budgets
    • is it easily extensible
    • is it maintainable
    • is it testable
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been taught at school to use database with integer IDs, and I
I have always been taught to have one exit from functions and write code
No one has taught me how to use these, and I can't find much
I am a self taught developer. I use the term loosely because I only
Stackoverflow has taught me so much about what proper RESTful, MVC, GET/POST is that
I'm a self taught developer and ive always been told not to use SELECT
Learning Java I was sometimes taught to use the private access modifier so as
So I've always been taught that good coding practice is to use accessor methods
I've been taught to keep class definitions and code separate. However, I've seen situations
I'm completely self-taught, so there are obvious gaps in my knowledge. When I needed

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.