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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T03:18:10+00:00 2026-05-14T03:18:10+00:00

I have got a designing dilema. I have a class named UserAccount that represent

  • 0

I have got a designing dilema. I have a class named UserAccount that represent a user that has the ability to log into a school system and access information like the courses he/she is taking, avatar, news, etc. Then there is another class named Course that represents any course given in this school. It holds information like the amount of students that are taking this course in this term, the course id number, etc.

So the UserAccount has a method like this

UserAccount user = new UserAccount("username", "password");
user.login();
Array<Courses> courses = user.getCourses();

This method getCourses() will return an array of courses with the courses the user is taking. So is obvious that the object user holds a reference to the courses he/she is taking.

But, and here is my problem, the course has to access information from the server(using REST) but all the requests have to be sent with the session cookie and some user’s info. So somehow the course has to know which user is trying to get the info. For me it seems wrong that the course holds a reference to a user and having to pass the user as a parameter to course’s method that needs this info seems to be wrong too.

Does anyone have a better solution?

NOTE: I have no control on how the system was designed, I should have told that actually there is no public API, I’m scrapping the html responses so I don’t know how the system was implemented and I don’t need to check which courses is the student taking, that information is given by server by doing a simple request. As I said before the problem is that when I have to make the request to the server (regarding to courses info) I have to send the session cookie and some other not public information that is being hold by the user object because the user must be logged in to get the information from the system. The thing is that it doesn’t feel natural that the course should have a reference to the student.

  • 1 1 Answer
  • 2 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-14T03:18:10+00:00Added an answer on May 14, 2026 at 3:18 am

    Course shouldn’t do requests if it doesn’t have data. Solutions I see are :

    • Another object could collect data from User and Course and do the request.
    • Do not return Courses from User but UserCourse or something related to user that would have a reference to the user and the course.
    • Pass a user as a parameter to the method that do requests requiring user data.
    • Eventually realize that Course might be related to the User and give a reference to User to Course ?
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was designing a class and I realize that I've got several methods that
I am designing a class diagram and I got a doubt: I have a
I have got the following problem since the server has safe mode turned on,
I'm designing a city building game and got into a problem. Imagine Sierra's Caesar
I have a unique issue - I am designing a web application that creates
I'm currently designing a system that requires an admin to log in using a
Ive got an app that allows users to listen to music. Each artist has
I am designing a webpage where I have got 6 dialog boxes in a
I'm designing a web site where I've got a blog post and have the
I have defined a UIView in the header file named rectangle0 I got a

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.