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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T08:58:21+00:00 2026-06-11T08:58:21+00:00

The following methods are implemented in an abstract base class, that is extended by

  • 0

The following methods are implemented in an abstract base class, that is extended by many subclasses:

public final void doSomething() {
    if( hasBehavior1() ) {
        // special behavior 
    }

    if( hasBehavior2() ) {
        // special behavior 
    }

    // do other things
}

protected abstract boolean hasBehavior1();
protected abstract boolean hasBehavior2();

How should I name these methods hasBehaviorX() for the cases that the special behavior is

  • to encrypt some data?
  • to ignore an error?
  • to check for correctness?

The special behavior is too easy to use a different implementation pattern like the strategy pattern, so I’m really looking for some useful naming conventions here.

  • 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-06-11T08:58:22+00:00Added an answer on June 11, 2026 at 8:58 am

    I found a way to express the special behavior by using the java conventions for boolean members with the verb in its present progressive form:

    isEncrypting()
    isIgnoringError()
    isCheckingForCorrectness()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a base class that has an abstract getType() method. I want subclasses
I have the following methods in my Authentication class that is called by my
I have the following methods: public <T> T fromJson( Reader jsonData, Class<T> clazz )
I want to do the following public abstract class MyAbstractClass { public static abstract
Within my code a have the following abstract superclass public abstract class AbstractClass<Type extends
I'm trying to do the following: public abstract BaseClass { public virtual void ReceiveEvent(Event
I am faced with the following conundrum: Our software has an abstract base class
I have a base class like the following. TMakerObject = class ... public method
Consider following simple DAO example: public abstract class DAOFactory { public abstract AccountDAO getAccountDAO();
I am facing the following problem: I defined an abstract class that contains the

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.