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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T00:47:49+00:00 2026-05-23T00:47:49+00:00

Let’s say I have a class loader I want to register. $loader = new

  • 0

Let’s say I have a class loader I want to register.

$loader = new ClassLoader;

$loader->register();

When the method register() is called a second time, should I:

  1. Throw an exception stating that the class loader has already been registered
  2. Silently fail
  3. Return a boolean status

If I were to go with option #1, I would also provide a isRegistered() method offer the opportunity for some checking before it is called a second time.

What is the best way of handling this scenario?

Are there any other, better options?

  • 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-23T00:47:49+00:00Added an answer on May 23, 2026 at 12:47 am

    Have you considered something like triggering a warning or a notice?

    trigger_error("ClassLoader already registered", E_USER_WARNING);
    

    Unlike exceptions, triggering errors is a good way to find flaws/disruptions in code without halting the execution of the program. You keep the backtrace and a get an entry in the error log. If a mistake like this (registering a class loader twice) goes on production, you’d want it to be transparent for the user (it’s not critical), but with the programmer getting notified.

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

Sidebar

Related Questions

Let's say you have a class called Customer, which contains the following fields: UserName
Let's say I have a drive such as C:\ , and I want to
Let's say on a page I have alot of this repeated: <div class=entry> <h4>Magic:</h4>
Let's say that I have classes like this: public class Parent { public int
Let's say I have a simple UserControl with no codebehind: <UserControl xmlns= .... x:Class=TrafficLight.LightControl>
Let's say I have the following models class Photo(models.Model): tags = models.ManyToManyField(Tag) class Tag(models.Model):
Let's say I have an image called hello.png with dimensions 200x100 . I create
Let's say I want to see how copy is implemented in the Dictionary class.
Let's say i have input 22365.2588 in my Edit Text. I want to change
Let's say I'm building a data access layer for an application. Typically I have

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.