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

  • Home
  • SEARCH
  • 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 591219
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T15:36:43+00:00 2026-05-13T15:36:43+00:00

So I have started my initial design of a simple system. I have a

  • 0

So I have started my initial design of a simple system.

I have a superclass/abstract called Customer. It has 2 subclasses: PrivateCustomer and BusinessCustomer.

I also have an account class. This account may be a downpayment account or just a regular account. It it determined by a Enum.
The Customer class has a List<> of accounts.

Now, I also have a transaction class, and this is where it gets tricky.
The transaction class has the following properties:

  • Sender
  • Receiver
  • Amount
  • Date
  • Type (Enum)

As you might imagine:
A customer can have 1 or more accounts.
A customer can make 0 or more transactions.
An account has transactions (or the other way around?)

Now. Where do I place there transaction? Keep in mind, the system might have/get [insert large number] of transactions over time.

  • Do I have a global list of all
    transactions and simply filter the
    list, when I want to see all
    transaction for PrivateCustomer
    12345?
  • Do each account property, in the
    Customer class, have a list of all
    transactions instead?
  • Something third?

As long as its an OO-solution, I will be satisfied.

  • 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-13T15:36:43+00:00Added an answer on May 13, 2026 at 3:36 pm

    Why not Sender and Receiver be references to Customer objects. Going the other way, each Customer has a List of references to Transaction objects that it is participating in. If your design will allow for a circular reference, this is the way I would go.

    Something along these lines:

    using System;
    using System.Collections.Generic;
    
    namespace Sample
    {
        public abstract class Customer
        {
            protected string _name;
            //...
        }
    
        public class PrivateCustomer : Customer
        {
            private List<Transaction> _transactions;
            //...
        }
    
        public class BusinessCustomer : Customer
        {
            private List<Transaction> _transactions;
            //...
        }
    
        public class Transaction
        {
            private Customer _sender;
            private Customer _receiver;
            private double _amount;
            private DateTime _date;
            private AccountType _accountType;
    
            //...
        }
    
        public enum AccountType
        {
            Downpayment,
            Regular
        }
    }
    

    a revision taking into account the account information (no pun intended):

    using System;
    using System.Collections.Generic;
    
    namespace Sample
    {
        public abstract class Customer
        {
            private List<Account> _accounts;
            protected string _name;
            //...
        }
    
        public class PrivateCustomer : Customer
        {
            //...
        }
    
        public class BusinessCustomer : Customer
        {
            //...
        }
    
        public class Transaction
        {
            private Account _sender;
            private Account _receiver;
            private double _amount;
            private DateTime _date;
    
            //...
        }
    
        public abstract class Account
        {
            private Customer _customer;
            private Collection<Transaction> _transactions;
        }
    
        public class RegularAccount
        {
            //...
        }
    
        public class DownpaymentAccount
        {
            //...
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have started using Linq to SQL in a (bit DDD like) system which
I have started design of a ColdFusion application that is entirely web based. Not
I have started using Jython as it seems to be a excellent language, and
I have started using aspects for parameter validation in our development framework. It works
I have started to play a little with Qt 4. And then I have
We have started to use spring aop for cross cutting aspects of our application
I have started testing my UI using qUnit, so I need to simulate some
We have started using Spring framework in my project. After becoming acquainted with the
I have started working on some code left behind by previous developers, and I'm
I have started coding an FTP client application (for fun). I’m trying to represent

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.