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

  • Home
  • SEARCH
  • 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 308851
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T07:41:18+00:00 2026-05-12T07:41:18+00:00

Inspired by this question which started out innocently but is turning into a major

  • 0

Inspired by this question which started out innocently but is turning into a major flame war.

Let’s say you need to a utility method – reasonably straightforward but not a one-liner. Quoted question was how to repeat a string X times. How do you decide whether to use a 3rd party implementation or write your own?

The obvious downside to 3rd party approach is you’re adding a dependency to your code.
But if you’re writing your own you need to code it, test it, (maybe) profile it so you’ll likely end up spending more time.

I know the decision itself is subjective, but criteria you use to arrive at it should not be.

So, what criteria do you use to decide when to write your own code?

  • 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-12T07:41:18+00:00Added an answer on May 12, 2026 at 7:41 am

    General Decision

    Before deciding on what to use, I will create a list of criteria that must be met by the library. This could include size, simplicity, integration points, speed, problem complexity, dependencies, external constraints, and license. Depending on the situation the factors involved in making the decision will differ.

    Generally, I will hunt for a suitable library that solves the problem before writing my own implementation. If I have to write my own, I will read up on appropriate algorithms and seek ideas from other implementations (e.g., in a different language).

    If, after all the aspects described below, I can find no suitable library or source code, and I have searched (and asked on suitable forums), then I will develop my own implementation.

    Complexity

    If the task is relatively simple (e.g., a MultiValueMap class), then:

    1. Find an existing open-source implementation.
    2. Integrate the code.
    3. Rewrite it, or trim it down, if it excessive.

    If the task is complex (e.g., a flexible object-oriented graphing library), then:

    1. Find an open-source implementation that compiles (out-of-the-box).
    2. Execute its “Hello, world!” equivalent.
    3. Perform any other evaluations as required.
    4. Determine its suitability based on the problem domain criteria.

    Speed

    If the library is too slow, then:

    1. Profile it.
    2. Optimize it.
    3. Contribute the results back to the community.

    If the code is too complex to be optimized, and speed is a factor, discuss it with the community and provide profiling details. Otherwise, look for an equivalent, but faster (possibly less feature-rich) library.

    API

    If the API is not simple, then:

    • Write a facade and contribute it back to the community.
    • Or find a simpler API.

    Size

    If the compiled library is too large, then:

    • Compile only the necessary source files.
    • Or find a smaller library.

    Bugs

    If the library does not compile out of the box, seek alternatives.

    Dependencies

    If the library depends on scores of external libraries, seek alternatives.

    Documentation

    If there is insufficient documentation (e.g., user manuals, installation guides, examples, source code comments), seek alternatives.

    Time Constraints

    If there is ample time to find an optimal solution, then do so. Often there is not sufficient time to write from scratch. And usually there are a number of similar libraries to evaluate. Keep in mind that, by meticulous loose coupling, you can always swap one library for another. Find what works, initially, and if it later becomes a burden, replace it.

    Development Environment

    If the library is tied to a specific development environment, seek alternatives.

    License

    Open source.

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

Sidebar

Related Questions

No related questions found

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.