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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T19:12:26+00:00 2026-05-27T19:12:26+00:00

I am reading Clean Code and having trouble figuring out how to keep some

  • 0

I am reading “Clean Code” and having trouble figuring out how to keep some of my functions (usually constructors) to their MAXIMUM of 3 parameters.

Often my objects need an awful lot of information to work – am I supposed to make a small constructor and then use mutator functions to give them all of the information? This doesn’t seem any better than just using a big constructor.

As an example, I have a “MovablePatch” class. It lets the user drag a square around in a window. It needs a several parameters, including Radius, Color, Renderer, InitialPosition, and Visibility. Currently I collect all of these from my GUI and then call:

MovablePatch(int radius, Renderer* renderer, Color color,  Position initial, bool visibility)

These are only some of the things that I need in this class. Can anyone suggest how else I might package this information to pass to the constructor? I don’t see any obvious “break it into smaller classes” appearing 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-05-27T19:12:27+00:00Added an answer on May 27, 2026 at 7:12 pm

    You could have

    MovablePatch(Renderer* renderer, CircleAppearance circleAppearance)
    

    where CircleAppearance gathers the other info.

    However, clean code and other books that generalize about what good code should look like, are aiming for 80 percent of the code out there. Your code seems to be “closer to the metal” than the typical LoB (Line of Business) variety. As such, you may run into places where certain coding ideals are not applicable.

    The most important part is that you’re thinking about it and trying to keep things nice and tidy! 🙂

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

Sidebar

Related Questions

Ever since reading Clean Code I have been trying to keep my code descriptive
I just finished reading the Functions chapter from Uncle Bob's Clean Code . The
I am having some trouble reading some data from a serial port I opened
I'm reading Fowler Clean Code book and I think that my code is a
I'm reading the book Clean Code and am struggling with a concept. When discussing
Reading the VS2008 help file I've figured out that the clean way of exiting
I've been reading up on .NET Threading and was working on some code that
I'm reading Robert C. Martins book Clean Code. He writes about a convention not
I'm Currently reading two excellent books Working Effectively with Legacy Code and Clean Code.
I was reading Robert Martin's Clean Code and in that he mentions about 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.