Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

6
  • 1
    So as I understand, the main reason to make some piece of code into a library is when it is going to be used across different projects (even if they are all internally developed) in order for that code not to be duplicated, updated, maintained separately? And if you are only going to be developing a single project then there is no need to make something into a library (unless you intend on using it in further projects at a later date). Commented Aug 25, 2017 at 20:02
  • @AndrewMurtagh: Yes, that's pretty exactly how I'd put it. Although there may be technical reasons too; I'm not that familiar with C/C++ development - maybe keeping part of the code as a library is necessary so it can be loaded optionally or even loaded and unloaded on demand, and thus reduce memory usage when the fuctionality is not needed? Commented Aug 25, 2017 at 20:09
  • I believe that may be possible through shared libraries. Thanks for clarifying, I'll mark your answer as accepted. Commented Aug 25, 2017 at 20:21
  • Nearly every VCS for the past decade supports external references or submodules. This removed the duplicate code and bugfix problem. Might include more information on why these aren't a viable solution if you still believe they're valid problems. Commented Aug 25, 2017 at 20:28
  • Think also in maintenance. 1) The lib can be maintained independently and in parallel. 2) Is code easy to replace. 3) Small code base are easier to manage for small teams and easier to understand for everybody. 4) if time-to-market is critical, you will prefer to have faster builds. Code in libs is code you don't compile over and over in the pipeline (IMO). 5) It's reliable reusable code... You made It ;-) Commented Aug 25, 2017 at 20:39