TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Ask HN: When does it make sense to roll your own X?

135 pointsby li4ickalmost 6 years ago
Suppose you find a library that kinda does what you need, but not really. Do you adapt it to your needs or do you build a version from scratch that really suits your needs, but might take a bit of time to develop?

48 comments

anderspitmanalmost 6 years ago
My rule of thumb when considering adding a dependency these days is to start by trying to implement the functionality myself. But I don&#x27;t let myself spend too much time on it (maybe an hour or two. maybe a day). More often than not I&#x27;ll get bogged down pretty quickly and realize the problem is more complicated than I assumed. This approach gives me:<p>1. Greater appreciation for the dependency<p>2. Better chance of modifying the dependency when it breaks or doesn&#x27;t work the way I want, because I&#x27;m at least somewhat familiar with the types of tradeoffs you have to make to implement such a thing.<p>3. A chance that the problem turns out to be simple enough to not require a dependency and the prototype works just fine forever.<p>4. Get to learn something new.<p>Obviously there are exceptions. I wouldn&#x27;t try to implement a relational database just because I need one. But in these situations I try to take a step back and ask if I even need a full DB. Would flat files work fine for the task at hand?
评论 #20462022 未加载
CoolGuyStevealmost 6 years ago
When the packages and configuration files for the project are more complicated than the python code it would take to do the one simple thing that you need. A lot of frameworks tend to bloat to handle every use case and become overly complicated because of it.<p>Things like passing protobufs&#x2F;gRPC when C structs, JSON, or CSV files will do, job scheduling systems that could be replaced by a postgres table, most Kafka applications.<p>I once worked with a guy who would pattern match whatever problem you had to the trendy Apache or Google library and then spend weeks&#x2F;months setting it all up. He was easily the least productive person I&#x27;ve ever worked with.
评论 #20432099 未加载
评论 #20432743 未加载
评论 #20432636 未加载
评论 #20432067 未加载
评论 #20432239 未加载
gtstevealmost 6 years ago
Depends on the quality of what currently exists and the license. Typically if I find something liberally licensed that does 80-90% of what I want, I&#x27;ll fork the project, add the remainder and send a pull request back to the parent project (which is normally ignored).<p>Other things I take into account are how important the X is to the business. My company&#x27;s product parses a very strange industry-specific file format. There are some commercial parsers and some open-source ones which do most of what I need but I opted to roll my own as working with this file format is very important and I can&#x27;t risk license concerns.<p>Also, it might not be very nice but I don&#x27;t want to help my competitors.
评论 #20431780 未加载
评论 #20431437 未加载
caseymarquisalmost 6 years ago
&quot;If it’s a core business function — do it yourself, no matter what.&quot; was Joel Spolsky&#x27;s take.<p>He wrote an article on the topic: <a href="https:&#x2F;&#x2F;www.joelonsoftware.com&#x2F;2001&#x2F;10&#x2F;14&#x2F;in-defense-of-not-invented-here-syndrome&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.joelonsoftware.com&#x2F;2001&#x2F;10&#x2F;14&#x2F;in-defense-of-not-...</a>
评论 #20433632 未加载
franciscopalmost 6 years ago
Ah this is a very difficult, multi-variable question. I think this question should be given with a lot more context. Of importance, out of the top of my head, are:<p>- Do you need the get results <i>now</i>, or long-term maintenance is more important?<p>- Are you going to roll your own internal tool or publish it as open source?<p>- How responsive are the developers of the original library? Did you attempt to ask them for help&#x2F;consulting&#x2F;etc?<p>- Can you wrap the library so that you get 80-90% of the work out of the way? Can you fork it so that you get 50-70% of the work already done? As everyone mentions here, licensing is important for this question.<p>- Do you have people who have created and maintained libraries before? Do you know what it takes to publish your own library?<p>For example, I&#x27;ve written hundreds of small libraries and projects in Javascript, so I know the tools, common issues and details of creating a new library. So for me, creating a new one is fairly easy. For someone who has written the same amount of code in their career, but mainly focused on a single codebase, the cost (both short and long-term) of creating a new library is a lot higher.
评论 #20431823 未加载
评论 #20431762 未加载
评论 #20431755 未加载
gwbas1calmost 6 years ago
It depends on how critical the X is to your risk.<p>For example, I lead a project where we wrote a driver instead of using an open source one. Writing our own manged risk, because the open source ones were unstable or had data integrity issues. Overall, the &quot;cost&quot; of &quot;writing a driver&quot; was about 5-10% of the total effort, once we consider integration, QE, installers, signing...<p>The thing with 3rd party frameworks is that they aren&#x27;t built for <i>your</i> requirements. So, if you don&#x27;t &quot;roll your own X,&quot; you need to make sure that the X you choose will meet your <i>business critical</i> requirements early in a proof of concept.<p>Also, if you are going to &quot;roll your own X,&quot; it&#x27;s worth it to do a few POCs with other Xs. This way you can learn how to make a better design, and what to encapsulate in your X.<p>(In my case, the 3rd party drivers encapsulated poorly. Most of my effort spent writing our driver was things I&#x27;d need to figure out anyway, because the other drivers didn&#x27;t encapsulate basic details that I didn&#x27;t care about.)<p>---<p>Other times, it makes sense to &quot;roll your own X&quot; to keep things simple. ORMs are a great example. Their leaning curve can be higher than simple queries and boring code. If you only have a few queries, why bother adding something that&#x27;s just going to get in the way?<p>Which gets to: Do not use frameworks in place of design patterns.
oneplanealmost 6 years ago
&quot;When it adds value&quot;, or so it is said. Define when it value is added and you get the edge you need to cross when it becomes viable.<p>Say you are working on a FOSS project to replace something and the one of the dependencies doesn&#x27;t work out. If you have the project capacity, it might add more value to roll a replacement.<p>Example: say you are writing a metrics collector, and you need something that can run inside a container because you want to deploy it as a sidecar. A dependency you use needs root network access for some reason, and you can&#x27;t really bypass it using CAP_&#x27;s because it&#x27;s hardcoded to look for UID 0. You can patch it if the code allows for it, but if it doesn&#x27;t, you still need a fix so you might as well roll your own.<p>On the other hand, say you are in a commercial setting, then value is probably not added by rolling your own until it&#x27;s either freeing up resources or addressing a business need.<p>Example: you are running a bunch of APIs behind a gateway, and the gateway exposes those APIs on a subdomain based on their name. But you kinda want them on the path of a single domain instead. You could do an ugly patch with a reverse proxy in front of it and rewrite all requests, but at that point you might as well implement a replacement gateway that does the same thing. While it might be a slightly bigger effort, it both frees up resources and gets a business requirement resolved.<p>There really is no one-size-fits-all rule, even if you take licenses, quality, maintenance, sourcing, cost etc. into account it still won&#x27;t cover all cases. Say you are a small company but your software is used on billions of devices. Rewriting a part of a kernel would give you a few cycles less CPU time required for a task that multiplied by billions saves a lot of computational power, but you, as a small company, don&#x27;t have the resources to do so. Even if the license, quality and maintenance is right, you still wouldn&#x27;t rewrite something like that.
mratzloffalmost 6 years ago
Every time you roll your own, you need to attach a future cost: bug fixes, documentation, testing, training, and so on. Your future costs can quickly spiral out of control when you implement your own solutions. Furthermore, because these are so expensive to maintain, yours will be a bare-bones version and start to show its age rather quickly. The cost of switching away from something increases over time, so inertia will incentivize staying with your minimal, custom solution while other, better solutions will become more full-featured and robust.<p>Unless you pay the cost to keep up with the industry (or switch away from your custom solution once others meet your needs), you will fall behind. But keep in mind that others are most likely not paying this cost, so they&#x27;re investing in features, continuing to outpace you in areas that matter.<p>In short, only implement something yourself when absolutely necessary—for example, when it&#x27;s a core competency, or when no current solution exists. Even a de facto solution that&#x27;s suboptimal tends to be better than your own, because it will be documented, new contributors won&#x27;t have to train on it, and it may improve over time. If you have to switch away from it at some point, there may be tools to automate or simplify that transition.<p>The smartest decision for things outside your core competency is &quot;do what everyone else is doing.&quot; Focus on innovating on the things that matter instead.
davismwflalmost 6 years ago
One of the key considerations I look at is license. If the 3rd party library has a license I can work with, modify and use etc. And you have to consider distribution too in that conversation. A lot of times this one fact takes away all doubt on the right way forward. People use Apache licenses on a lot of projects that it is questionable if not down right improper, and I am kinda anal about that as for commercial products you don&#x27;t want someone coming back and saying you violated the terms&#x2F;spirit of the license.<p>Outside of licensing. It is usually based upon the needs of the project, if I can find a library that does 80% of what I need and I can add the remaining 20% and I am happy to live with that code then I&#x27;ll definitely use a 3rd party. In general I favor those libraries, but just so many times the licensing trips the flag that it isn&#x27;t worth the risk and adding a few extra days or even weeks to a project is well worth the time.<p>One other point, I also am really big on logging&#x2F;metric collection, if I need to go in and instrument an entire library then it adds another level of work so I start thinking about just creating our own. But not all libraries do need detailed logging and metrics (although IMO most do).
评论 #20427488 未加载
tomxoralmost 6 years ago
My <i>default</i> these days is to roll my own (at least within some predefined context), this is because I view each new dependency as a significant cost, so i&#x27;ll invert my answer: For me to include an external dependency it must provide very relevant and high value to the project to outweigh it&#x27;s inherent costs.. even if that is satisfied I feel like I should also trust the authors.<p>This attitude has basically eliminated unhappy surprises from external code for me. This is probably a disposition earned through developing mostly in the JavaScript community (I am now the polar opposite of the NPM duct tape developer, and I prefer flat dependency trees).
评论 #20433170 未加载
评论 #20435061 未加载
teamskialmost 6 years ago
My brain says never, for everything there is some turn-key thing. Even your entire project might be franksteined with some third-party products and Zapier into something working. Same with libs, better a crappy lib than working days for something you might not need.<p>My gut says always: most of the times turn-key stuff has weaknesses and good libs with perfect apis, well maintained and with a great community are rare but they are there of course.<p>Hard question since what the gut says is more fun while the alternative is just about gluing libs together. But using libs and once they don&#x27;t fulfill your needs build yourself is the right but more boring way to go.
评论 #20432209 未加载
talkingtabalmost 6 years ago
If the library is crucial to what you are making it is worthwhile to <i>consider</i> rolling your own. Not because it will be better but in the process you will understand the problem in a way that you otherwise cannot.<p>Libraries also tend to be general purpose so up to half of the code in a library may not be pertinent to your usage.<p>I wrote an app that used a lot of Oauth and ended up writing my own instead of using the excellent Passport library. It would have been easier to use that, but I gained an understanding of Oauth that I would not otherwise have, and my code is small, understandable and easy for me to maintain and modify. Just my 3 cents worth.
aklingalmost 6 years ago
For personal projects, I will happily build everything from scratch myself. It’s great fun and I learn so much, so why wouldn’t I? (Although it’s fricken awesome when people show up to help out.)<p>For work projects, I like to look for the best available FOSS option and then try to help out on that project so I can feel a bit invested in it. This helps calm down my hacker urges to build my own thing from scratch :)
err4ntalmost 6 years ago
I always makes sense to roll your own X when you&#x27;re a leader in the field and X doesn&#x27;t exist yet until you (or somebody else) makes it and releases it.<p>I&#x27;ve had a lot of situations like that and been accused of NIH syndrome, but what is the alternative…not doing something at all because nobody else has built or released something that can be used? Every library or tool in existence started out because somebody wasn&#x27;t content with the status quo enough to bother inventing a new thing. This is the only way the state of the art can progress.
bullenalmost 6 years ago
This is not a popular opinion, but I think you should always rewrite the wheel. The reason is simple, the product you are building cannot be more interesting than the technology that lies under it. If you rewrite that, you will have to learn how things really work. And only when you do that, can you improve the fundamentals.
评论 #20433266 未加载
评论 #20433399 未加载
davesmith1983almost 6 years ago
A few scenarios I can think of are:<p>1) If it doesn&#x27;t work or works poorly.<p>2) If it is trivial to implement.<p>3) Licensing problems.<p>4) If the implementation is overly complicated.<p>5) The (framework) vendor have a habit of updating and breaking your code. This happens a lot with the Angular team. There is nothing like the annoyance of an Angular update and they have broken some feature you are using and you have to update code that was working absolutely fine. Since then I have avoided Angular entirely.<p>Things I am less strict on:<p>1) The project is EOL. It may work perfectly fine. This happens to open-source software as well. Typically this means there is a better alternative out there.<p>2) Awkward syntax &#x2F; api. You can normally just wrap this.<p>3) Maintainers are difficult to work with or don&#x27;t fix bugs.
Const-mealmost 6 years ago
Depends on the library. If it&#x27;s a good one, makes sense to adopt, I sometimes do: <a href="https:&#x2F;&#x2F;github.com&#x2F;Const-me&#x2F;nanovg" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;Const-me&#x2F;nanovg</a><p>Some libraries have hundreds of megabytes of their own dependencies hard to remove.<p>Some libraries have very low code quality, makes it expensive to modify.<p>Some libraries are very hard to build, e.g. I&#x27;ve never managed to build Skia. When you can&#x27;t build it you can&#x27;t adopt it.<p>You should also pay attention to license, there&#x27;re GPL licensed libraries out there, if you&#x27;ll try to use or adapt them you&#x27;ll have to open source your complete software under the same license.
malikeralmost 6 years ago
Makes sense to do it when you can hack together a quick prototype that will teach you more about the problem and will be fun.<p>We needed a sensor data capture platform at work. There were a lot of odd requirements, like consuming data from embedded hardware, severe bandwidth restrictions, and high-precision (GPS) timekeeping. We hacked something together in python + flask in 2 weeks, and it was easy to experiment on the analysis side by just writing another flask route and generating some html with plot.ly and leaflet.<p>We&#x27;re also evaluating thingsboard and the elastic stack, but setting those up, experimenting, and extending them was slower, less fun, and harder to debug. At some point we&#x27;ll do a shootout between all the platforms and pick the winner if this is something that gains significant users, in which case the community and active support of the platforms will be a big advantage.
评论 #20434281 未加载
AYBABTMEalmost 6 years ago
If the subset of feature that I need can be written in the amount of time it would take me to read thru and internalize the library, I&#x27;ll just write it from scratch. Then if there&#x27;s a problem with it, my team and I will already have a good understanding of the code, instead of discovering that the library is in fact crap (which they often turn out to be).<p>Then if it&#x27;s something that doesn&#x27;t really matter and the library code is pedestrian (a logging library), I&#x27;ll use the library.<p>If it&#x27;s something that matters a lot and it&#x27;s expert knowledge and is a large body of work (a complex math&#x2F;compression&#x2F;crypto library), I&#x27;ll use the library.
scotty79almost 6 years ago
You might want to roll your own prototype to discover what you actually need. Then when you know that, it&#x27;s much easier to pick a library that satisfies you actual needs not the needs you thought you&#x27;ll have.
JustFinishedBSGalmost 6 years ago
Whenever X is closed&#x2F;proprietary and doesn&#x27;t have an open alternative. Never rely on something you do not ( or at least cannot if you wanted ) control. Never. You WILL regret it one day.
评论 #20434990 未加载
Tooalmost 6 years ago
Google for how to do X in language Y. If 99% of the top answers on stackoverflow say use library Z then just do it. Usually there will be 3 different Z in which case you should take some time to decide on one of them.<p>If there is no Z, don&#x27;t try to find the needle in the npm haystack of poorly maintained libraries with tons of needless sub-dependencies. Unless the problem domain is very beyond your capabilities, just roll your own.
ashleynalmost 6 years ago
Programming your own GUI in an &quot;engineless&quot; plain-OpenGL&#x2F;DirectX graphical project or game. I rolled my own GUI for my C++ game because all existing examples were either very badly designed (think singletons everywhere), obscenely expensive, or just outright abandoned. Writing something that uses a hierarchial box model with style attributes isn&#x27;t too bad.
jacquesmalmost 6 years ago
Reasons for valid NIH:<p>- you are on your own and don&#x27;t care about the future maintenance cost of your code<p>- you want to learn<p>- the available solutions are objectively crap<p>Invalid reasons:<p>- job security<p>- you&#x27;re a control freak<p>- you think all code you write is immediately better than other people&#x27;s battle tested solutions, aka inflated ego.<p>- you want to be seen as the maintainer of some prestigious project rather than as the contributor to someone else&#x27;s prestigious project.
ciguyalmost 6 years ago
I wrote an article that covers this from a DevOps perspective, among other things. Perhaps you&#x27;ll get some value from it: <a href="https:&#x2F;&#x2F;calebfornari.com&#x2F;2019&#x2F;07&#x2F;11&#x2F;devops-decision-making&#x2F;" rel="nofollow">https:&#x2F;&#x2F;calebfornari.com&#x2F;2019&#x2F;07&#x2F;11&#x2F;devops-decision-making&#x2F;</a>
chvidalmost 6 years ago
Why would you make your own leftpad when someone already has spent the time and the energy perfecting and publishing leftpad?
taorminaalmost 6 years ago
Another good question to always ask is &quot;If I&#x27;m getting X from Y, what do I do if Y stops providing X the way I need it?&quot;<p>An example might be analytics. It&#x27;s good to know that you can drop in a third-party library and just go, but you need to make sure to look at how you can move your data off of that platform and use it yourself. You also need to consider how much of a time investment switching off of Y would be. How much effort will rolling your own be? How much effort will rolling your own after using Y? How hard will it be to swap Y out for Z?<p>Another classic case here is web hosting. I use GCP. I&#x27;ve used AWS. I really don&#x27;t want to, but if Google or Amazon kicked me off&#x2F;out&#x2F;raised the prices too much, I&#x27;ll host from my own hardware, and go to Fry&#x27;s if I need to get more hardware than I have. I really don&#x27;t want to, but I will.
bluedinoalmost 6 years ago
Can we go over <i>bad reasons</i> to roll your own x?<p>1. You don’t want to take the time to learn an existing product<p>2. You’re not going to properly code and test your own solution<p>3. You think your product is too unique to use an existing solution<p>4. You’re going to leave features out that you would have gotten for free
评论 #20435568 未加载
nickjjalmost 6 years ago
It really depends on the task at hand and what the alternatives are.<p>For example I would much rather write 200 lines of my own code to deal with user authentication (leaning on my framework or a lower level library to deal with the gory bits of setting and deleting sessions), vs. pulling in some higher level authentication library that has 3,000 lines of code but tries to be so generic that it&#x27;s a jumbled mess which is difficult to customize.<p>Basically the more important the feature is for my application, the more inclined I am to write my own code. Although I may at times draw inspiration from other libraries that don&#x27;t quite solve my problem but helps me get closer to what I want to do.
nullwasamistakealmost 6 years ago
Depends on the license. If it&#x27;s permissive I&#x27;ll pop open the code to see if it&#x27;s any good. Maybe 50&#x2F;50 it&#x27;s good enough.<p>From scratch only if I&#x27;m doing something truly unique. New algorithm&#x2F;protocol. Unpopular language I&#x27;m forced to use is missing something I need. Existing solutions too slow or buggy. Maybe a couple times a year I get to make wheels.<p>NIH is a huge problem at most (all?) software companies. At my current place I spend about 1&#x2F;2 of my time dicking around with crap internal tools and libraries.<p>It&#x27;s rare I write anything that&#x27;s not glue code. Makes everything boring but I don&#x27;t get paged often and we have relatively few bugs.
RantyDavealmost 6 years ago
Almost never. If you have (for instance) scale that the canonical solution doesn&#x27;t handle, consider it. If you&#x27;ll be completely shafted if the canonical solution disappears, consider it.<p>Please don&#x27;t make another build system. Please.
knbknbalmost 6 years ago
Polyfilling is also some kind of &quot;roll-your-own X&quot;.<p><a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Polyfill_(programming)" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Polyfill_(programming)</a><p>In web programming, it might sometimes be useful to write your own polyfill when you need to add a single feature for backward-compatibility reasons. Well, a third-party polyfill library that provides that missing feature perfectly might be available. However, the library is too big (with respect to file size) or adds too much complexity during the build process (by pulling in lots of other dependencies).
dragonwriteralmost 6 years ago
&gt; Suppose you find a library that kinda does what you need, but not really. Do you adapt it to your needs or do you build a version from scratch that really suits your needs, but might take a bit of time to develop?<p>Which do you think will take more time to develop and maintain: the wrapper layer that adapts the existing library to your needs, or the ground-up homegrown implementation? Your estimate of the answer here (along with the risk calculus of the external dependency and the reliability of it&#x27;s maintainer) are the key factors in answering the question
jugg1esalmost 6 years ago
There are numerous articles out there that will tell you not to roll your own rule engine and indeed there are lots of them out there. But unless you are solving a well known problem, I&#x27;ve always found the open source rule engines to be either opinionated or just too large&#x2F;unwieldy. It&#x27;s not THAT hard to make your own. You only ever a handful of chances in your career to implement a rule engine anyway - since they are usually the core of the software that a company sells. Make it right!
评论 #20439772 未加载
hyperpalliumalmost 6 years ago
&gt; adapt it to your needs<p>If it&#x27;s a feature that can be cleanly added into the architecture - i.e. it&#x27;s just filling in a gap.<p>But if you have to modify the whole thing in a way that doesn&#x27;t quite fit... it&#x27;s a nightmare. Even with your own code, it&#x27;s simpler to start from scratch with a clean slate.<p>Also Alan Kay&#x27;s extreme position: &quot;those who <i>can</i> create their own [libraries], should&quot;
coffeefirstalmost 6 years ago
In the &quot;kind of does what you need&quot; case, I&#x27;d write my own but maybe borrow ideas from the original.<p>The moment you fork something, you&#x27;ve created work for yourself when you want to upgrade it.<p>That may be fine for a prototype. But I&#x27;ve seen it done on software that lasts 5-10 years and those are always the things that turn into maintenance headaches and blockers to unrelated upgrades.
meddlepalalmost 6 years ago
If you want to own governance and direction of an X.
cgrealyalmost 6 years ago
As always, the answer is highly dependant on a number of factors: - How complex is X? - What expertise do you have available for X? - How critical is X?<p>But in general, if X is not part of your core business, only as a last resort.<p>99% of the time, even if there is a suboptimal library, as long as its actively maintainted, you&#x27;re better off extending the functionality, than re-implementing.
contingenciesalmost 6 years ago
When the total lifecycle cost to use existing solutions is higher than the cost to build and maintain, when the future direction of development is unlikely to match your requirements, when the existing solutions lack critical functionality and modification or extension are non-viable, or when you want to learn more about the implementation.
jkoudysalmost 6 years ago
I frequently run across libs that are more complicated to configure and call than implementing the features myself. I&#x27;ll often roll my own simply because the lib (even if it&#x27;s really popular) takes more time to use than that &quot;bit of time to develop&quot;.
mikekcharalmost 6 years ago
I come from a era where free and open source software was quite rare when doing commercial ventures. Also I did a fair amount of embedded work in my early career. As a result, my normal first reaction is build over &quot;buy&quot;.<p>There are lots of very good reasons to prefer building something. First, the design of the code will fit your use case more or less perfectly. Unless you get it wrong, in which case you can change it relatively easily. If you use an off the shelf library&#x2F;framework, you may need to jump through hoops to use it. Those hoops may result in other hoops, which result in other hoops, etc, etc. In the end, you may introduce nearly as much code complexity adapting your code to someone else&#x27;s design than you save by using their library&#x2F;framework. (NB: You <i>could</i> just use &quot;convention over configuration&quot; ala Rails, which is another way of saying, &quot;Do everything my way and you&#x27;ll never have any conflicts&quot; ;-) ).<p>Second you have control over the code. If you use a library&#x2F;framework, it may change over time in ways that don&#x27;t fit your project. You are stuck making the choice of maintaining all of that change or eventually suffering from bitrot. A good example is if your library has another dependency. It replaces that dependency with a new one which isn&#x27;t supported on your system.<p>Related to that, you may decide that you need new functionality that the library&#x2F;framework does not give you. If you were working with your own code, it&#x27;s easy to add that functionality. If you don&#x27;t, you need to either maintain a series of patches, or try to get your changes merged upstream. Some projects are easier than others to work with.<p>When I&#x27;ve decided that I&#x27;d rather not roll my own, if possible, I look at the alternatives. The first thing I do is read the code. Can I understand it? Will I be able to fix bugs if I need to? How much of the code is related to what I&#x27;m doing and how much is unrelated? How will the structure of the code affect what I&#x27;m doing? Are there any controversial dependencies?<p>Then I look at the community. I look at open issues. I look at how discussions progress. I look at closed issues. Do people get yelled at for asking questions? Are suggestions for improvement valued? I look at open and closed PRs. How easy is it for an outsider to make contributions?<p>After that, I make an estimate in my head of the maintenance cost of code I wrote myself vs the maintenance code of using one of the alternatives that I&#x27;ve researched. Usually if we are talking about 1 week of work or less rolling your own wins out (there are exceptions, though). If I only need a handful of lines of code, I&#x27;ll frequently make my own derived library with those lines of code (For example, I do a fair amount of Ruby code and there is useful code in Rails... But I&#x27;m not going to grab ActiveSupport just because I want stringify_keys or something similar).<p>Finally, if a library is important to my code, I&#x27;ll usually make an adaptor for it. Instead of calling the functions of the library directly, I&#x27;ll make another library that wraps it. That way if I run into problems with the dependency I can swap it out without much difficulty. Of course, for frameworks that doesn&#x27;t make sense because part of what you are buying with the framework is the design.
评论 #20431648 未加载
koolbaalmost 6 years ago
If you read through the code and determine the quality is beyond repair, or the project model itself does not lend itself to repair, it’s a fine time to chart your own course.<p>If you decide to open source it then kudos to you. If you don’t, I won’t think less of you.
qrbLPHiKpiuxalmost 6 years ago
If X=crypto, then never.
评论 #20431836 未加载
评论 #20431827 未加载
tuckerpoalmost 6 years ago
When you feel you could better implement X for your niche needs.
joaofiliperochaalmost 6 years ago
depending the time that needs to be spend of the fix ... max 4h
gokalmost 6 years ago
Always roll your own.
lazyjonesalmost 6 years ago
Almost never. People should even consider using SWIG or similar to use libraries for other languages instead of wasting time on duplicating efforts and neglecting their core product&#x2F;project.
superkuhalmost 6 years ago
The X window system is being dropped from dev by Red Hat. So yeah, you&#x27;ll probably need to roll your own. As for the other X, non-institutional chemistry is generally frowned upon by governments.<p>Generally X existing things are going to be way too complex and heavy. Implementing your own allows you to avoid all that. But of course this only applies for individuals. Anyone stuck as part of a company or institution won&#x27;t have the choice.