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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T15:47:46+00:00 2026-05-22T15:47:46+00:00

Suppose you have a class that is frequently (or even exclusively ) used as

  • 0

Suppose you have a class that is frequently (or even exclusively) used as part of a linked list. Is it an anti-pattern to place the linkage information within the object?

For example:

   public class Item
   {
       private Item prev; 
       private Item next;
       ...
   }

An often-cited recommendation is to simply use a generic container class (such as java.util.LinkedList in Java), but this creates the overhead of having a separate node object (and the linked object cannot readily refer to its siblings).

Thoughts?

  • 1 1 Answer
  • 1 View
  • 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-22T15:47:47+00:00Added an answer on May 22, 2026 at 3:47 pm

    It is not necessarily an anti-pattern. Anti-patterns must have negative side-effects to earn the right to the “anti”.

    For example, a Node in a Tree data structure would need it’s linkage cached inside of the Node. Anything else would violate the much more important concept of encapsulation and localization of data and code based on responsibility of the object.

    On the other hand, a Customer data structure that embeds its “next” customer would imply that the Customer data structure is handling two unrelated responsibilities, that of maintaining the Customer data, and that of maintaining the Customer‘s list data structure. In such a scenario, the two responsibilities could intermingle in ways that impact the ease of maintenance; and hence, would be seen as an anti-pattern.

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

Sidebar

Related Questions

Suppose I have a calculator class that implements the Strategy Pattern using std::function objects
Suppose I have a class that represents a list of movies, belonging to a
Suppose I have a class that processes some data: class SomeClass { public: void
Suppose I have a class Baz that inherits from classes Foo and Bar ,
Suppose I have a Python class that I want to add an extra property
Suppose I have a class Customer that is mapped to the database and everything
Suppose I have a Base class and a Child class that inherits from Base
Possible Duplicate: How to Deserialize XML document Suppose that I have a class that
Suppose I have a Generic abstract class that provides some default constructor functionality so
Suppose I have a static method of my class that returns an object of

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.