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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T21:11:56+00:00 2026-05-11T21:11:56+00:00

OK, so I have a couple of modules in my application. One is called

  • 0

OK, so I have a couple of modules in my application. One is called ProductCatalogue and another is called Contracts. We now have a need for a contract to be associated with a number of products (eg the products which a party to a contract is allowed to order). Within the ProductCatalogue module we have a ProductDAL class which has the following functions

Public Function GetProducts()
    Set GetProducts = GenerateProductsList("SOME SQL")
End Function

Private Function GenerateProductsList(selectQuery)
    Dim list : Set list = New List
    Dim results : results = GetResultsFromDB(selectQuery)
    '... for each row
        Dim product : Set product = New Product
        product.Id = results(field, index)
        list.Add(product)
    'loop ...
    Set GenerateProductsList = list
End Function

Now, I want to get all products associated with a contract so I want to write a function that looks like this

Public Function GetProductsForContract(contractId)
    Set GetProductsForContract = GenerateProductsList("SOME SQL")
End Function

My question is, where should I put this function? I want to use the existing GenerateProductsList() function as it is a lot more complicated than it looks. There my question is “Where should I put GetProductsForContract”?

My options:

1) Put it in ProductDAL.

The problem with this is that ProductDAL suddenly becomes aware of what a contract is and I can see this getting quickly full of functions such as GetProductsForAllContracts, GetProductsForLiveContracts, etc, etc (and more when other modules want to access products) so really I’d like to keep those functions with the rest of the Contracts code.

2) Put it in ContractDAL and make ProductDAL.GenerateProductsList public.

Should I really be exposing this?

3) Create a new class which one method which has the sole responsibility of taking in an SQL dataset and returning a list of products.

Actually isn’t this the same as 2?

4) Stop doing it wrong.

I’m not sure how. Show me. Then hold me.

edit: Also, what about AddProductToContract, RemoveProductFromContract where does this go? I’m leaning towards a new ContractProductManager class but what’s the best way to access GenerateProductsList()

  • 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-11T21:11:56+00:00Added an answer on May 11, 2026 at 9:11 pm

    This is difficult to answer without knowing more about your app.
    I would say that if products and contracts are in the same database and always will be, having 2 DALs seems like an arbitrary separation. Since you likely have a relationship between product and contract in the database already, you are not gaining anything from separating the two in the DAL. You can place this new method into either class, imho.

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

Sidebar

Related Questions

I have a tomcat web application. It uses a couple of remote modules. One
I have a couple of controllers with associated helper modules. I got some helper
I have a couple of java modules set up in IDEA and I am
I have a complex build process to generate a couple of python extension modules
I have couple of dozen pieces of data that I need to save and
I have couple resource DLLs that I currently load when application starts using following
I have a couple of modules ( DZP::Catalyst and DZP::OurPkgVersion ) both of their
I've been working in PHP5 for a couple of years now and have developed
Given that I have a shell application and a couple of separate module projects
I have a couple of questions regarding a modular GWT based application framework. I

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.