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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T20:07:55+00:00 2026-05-18T20:07:55+00:00

I’ve written a task manager program using Java, and made a single UI implementation

  • 0

I’ve written a task manager program using Java, and made a single UI implementation for the moment in swing. The program has 3 layers at the moment. A presentation layer that interacts with the domain layer via a use case controller, and finally a technical services layer used for persistence. There are several actions a user can take at this point, such as adding tasks, editing the status of a task, etc… The purpose of my logger in this scheme is to keep track of all actions taken by the users. So, there are a few places where I could invoke the logger to write a command. I will not be doing any logging in the presentation layer as this would be a terrible design decision and so I’m left with the controller, the command interface (implemented to handle the execution of all commands for the purpose of implementing undo/redo functions), or in the lower level classes that are actually being manipulated, say the task class for instance.

I think the controller is a relatively decent option for this as it acts as the point of contact between the UI layer and the domain, thus all notable commands ultimately pass through the controller making it easy to verify that all of the important methods are being logged. A reason not to do it in the controller is that it will reduce the cohesion, increase coupling and potentially lead to a bloated controller.

The concrete commands are another potential location as they too have all of the information needed for logging. This would again cause the commands to become less cohesive and increases the coupling. Also, if I don’t use the command interface for taking an action on a domain object than I lose my logging.

Finally this leads me to implementing the logger in the lower level domain objects methods. This is a good candidate because logging will always occur if the program is being used and all of the information needed is available. The only negative part is that logger commands will be sparsely scattered amongst the lower level domain objects making it harder to ensure that all of the right methods are being logged.

I would love get a debate going about this type of decision and appreciate all of your comments.

  • 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-18T20:07:56+00:00Added an answer on May 18, 2026 at 8:07 pm

    Think about practicality first. Logging is often a maintenance & administrative concern. Each layer in your design is a candidate for logging, but for somewhat different reasons.

    Without really knowing your object hierarchy and design…

    Going from domain to UI, each layer is an abstraction or collection of behavior of the previous layer. You have to ask yourself things like what level of granularity are you looking for? Would it be useful to see a logging of a command? Would it also be useful to see logging for each associated domain layer calls? It may not always be easy to decipher domain calls and associate it with a particular command.

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

Sidebar

Related Questions

We are using XSLT to translate a RIXML file to XML. Our RIXML contains
I need to clean up various Word 'smart' characters in user input, including but
i want to parse a xhtml file and display in UITableView. what is the
public static bool CheckLogin(string Username, string Password, bool AutoLogin) { bool LoginSuccessful; // Trim

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.