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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T12:15:45+00:00 2026-05-25T12:15:45+00:00

Imagine a simple banking application wherein a use case of fund transfer is being

  • 0

Imagine a simple banking application wherein a use case of fund transfer is being realized. While writing transfer fund operation, the programmer/designer has following two options

  1. Write an operation to check if there are sufficient funds or not and return a Boolean based on which the subsequent fund transfer option will be carried out. This require creating two function viz. the checkSufficientFunds() and transferFund()

  2. Write a single operation which itself checks if the funds are sufficient or not. This will throw an checked Exception if there are no sufficient funds and calling method have to handle this.

    I understand that this is an oversimplified scenario. My question is, in theory, what are the performance implications (Memory and CPU) of these two approaches? How do they compare?

  • 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-25T12:15:46+00:00Added an answer on May 25, 2026 at 12:15 pm

    The performance difference in the current JVMs should be negligible. However, stick to the rule that exceptions should be used in exceptional situations. It is a normal flow not to have sufficient funds, so I would use a method public boolean transferFund() that returns true if successful, and false otherwise. This suggestion violates the command/query separation, but I think it’s fine.

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

Sidebar

Related Questions

Imagine a simple case like this: class Book has_many :chapters end Let's say in
Imagine two simple java applications. Both of them are implementing the same JAR file
Imagine a simple page with a list of users. Selecting a user displays a
Imagine this simple form <form action=<?php echo $_SERVER['REQUEST_URI']; ?> method=post> <fieldset> <legend>Contact Me</legend> <label
excuse me for my ugly english) ! Imagine these very simple models : class
I imagine this has a rather simple answer <% for user in @users %>
I am having issues with what I can only imagine is a very simple
Imagine this simple form for uploading a file: <form action=upload enctype=multipart/form-data> <input type=text name=name/>
Let's imagine really simple game... We have a labirinth and two players trying to
Imagine the following simple code: public void F<T>(IList<T> values) where T : struct {

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.