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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T19:08:01+00:00 2026-05-11T19:08:01+00:00

I am a C++ programmer and recently joined a new company that uses a

  • 0

I am a C++ programmer and recently joined a new company that uses a lot of C. When they reviewed my code, they were thinking I over-designed some of the things which I totally disagreed. The company is doing everything in embedded system, so my code needs to be memory
efficient, but the stuff I am doing is not CPU intensive. I would like to know how you guys think what my design. Here is the list.

  1. I have some arrays that need to pass around and eventually need to pass to some C code. I could pass a pointer and a size all over of the place. But I chose to create a class that represents this — a class that has a fixed size (we know the maximum size) buffer, and a length which should be always <= the size of the buffer, otherwise assert. In this way, I can pass the array around with only one variable instead of two, and if the maximum size changes in the future, I should be able to change it easily. I don’t use dynamic allocation for the array because it is embedded system and memory allocation could potentially fail and we don’t use exception. The class is probably less than 30 lines code, and I use it for quite a few places. They said I over-designed it.

  2. They have their own containers implementation in C. I needed to use one of them, but I wanted to hide all the detailed code away from my main logic, so I created a wrapper class
    for it. The wrapper class is similar to stl, so I have iterators and it manages the memory
    allocation internally, but unlike stl, it returns a error code when it can’t allocate more
    memory. Their argument on this one is that I am the only one uses it, so they don’t want it to be in the repository. I found it stupid to be honest.

EDIT: The following class is more or less that I used for point 1. All I wanted to do is to have something to pass around without carrying the length all the time.

class A
{
  static const MAX_SIZE = 20;
  int m_Array[MAX_SIZE];
  size_t m_Len;

public:
  A(const int* array, size_t len)
  {
    assert(len <= MAX_SIZE);
    memcpy(m_Array, array, len);
    m_Len = len;
  }

  size_t GetLen() const { return m_Len; }
  const int* GetArray() const { return m_Array; }
};
  • 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-11T19:08:01+00:00Added an answer on May 11, 2026 at 7:08 pm

    You’re probably right, but on the other hand if everyone in the company decided that they don’t like the existing APIs, and each designed their own shims and helper functions, that only they used, then maintenance would be tricky.

    If your array wrapper is “over-designed”, then I’d question whether the code reviewer considers any amount of design to be acceptable. It looks harmless to me[*]. I suppose you could have just made it a struct with two public members, and lose the benefit of read-onliness. How keen are your colleagues on const-correctness in general?

    I think the goal for 2 should be to reach consensus on whether that C API should be used directly from C++, or wrapped. If it should be wrapped (and the arguments for that are probably quite strong, what with namespacing and RAII), design a wrapper that everyone will use, and designate it “the C++ API for this module” rather than “a C++ wrapper that one module uses for this other module”.

    It’s possible that everyone else genuinely prefers the API as it is, over a more OO API or using STL. Following their conventions will make it easiest for them to maintain your code, as long as their conventions are solid C programming style. C++ is a multi-paradigm language, and “C with a limited number of bells and whistles” isn’t the paradigm you’re used to. But it is a valid paradigm, and if it’s what the existing codebase uses then you have to question whether what your company needs right now is a one-man revolution, however enlightened.

    [*] (the API, that is. They might question whether it will be passed by value inappropriately, and whether it’s wise for every instance to have to be as big as the biggest. That’s all for you to argue out with the reviewer, but is nothing to do with “over-design”.

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

Sidebar

Related Questions

I was recently trying to explain to a programmer why, in ASP.Net, they should
A programmer I know has a website that is fully Standards Compliant. It uses
I'm a C/C++ programmer recently working in C#, and i'm trying to do some
Recently Zed Shaw (a programmer who blogs) mentioned that ODBC references should be removed
I am a programmer at a financial institute. I have recently been told to
I'm a beginner (self-learning) programmer learning C++, and recently I decided to implement a
Recently, many programmers and that includes me, have taken the X out of AJAX,
We have a junior programmer that simply doesn't write enough tests. I have to
I am a novice programmer who is trying to teach myself to code, specifically
We have an application which runs in a JRE environment. The application uses some

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.