Live data from Hacker News

Write libraries instead of services, where possible

catern.com

71–80 of 328 posts

Re: Write libraries instead of services, where possible

#71
post #53
post #44

Earlier quoted context omitted.

Only on the FOSS world, because it is the only way to force devs to pay. There is another alternative universe where commercial software, including libraries, gets sold.

A few libraries in the Java world have this model. They haven't produced unicorns but seem to be pretty stable businesses - jOOQ(1), hibernate(2) etc. I'm researching DB libraries for work and so those are the ones I recalled immediately, but I think there are some commercial UI ones too. [1] https://www.jooq.org/ [2] http://hibernate.org/orm/support/

Sidekiq [0], as well. Though that's a Ruby background processor.

[0]: https://sidekiq.org/

Re: Write libraries instead of services, where possible

#72
post #44

Earlier quoted context omitted.

Only on the FOSS world, because it is the only way to force devs to pay. There is another alternative universe where commercial software, including libraries, gets sold.

> Only on the FOSS world, because it is the only way to force devs to pay. What about the approach that the Qt library uses, where they have a free GPL version and a paid commercial license? People might pay to avoid GPL obligations while using the library.

A nitpick, but that's not true of Qt any more. You can use the latest Qt under the LGPL3 licence.

https://en.wikipedia.org/wiki/Qt_(software)

Re: Write libraries instead of services, where possible

#74

> A service has constant administration costs which are paid by the service provider. A properly designed library instead moves these costs to the users of the library. I agree with the articles point, but this introduction, right there, is why it's not happening. SaaS turns your startup into a unicorn and yourself into a rich person. Or at least that's what you are hoping/aiming for. A library is not going to make y…

Is SaaS really the only viable (or "unicorn") business model? Do people not sell software licenses anymore? (In theory nothing prevents you from making your license require recurring payment as well)

Recurring revenue is much more stable than license purchases and also less prone to piracy. Adobe's incredibly successful transition (from a share price perspective) is a testament to the value ascribed to recurring revenue models.

In fact, companies that sell services with a recurring revenue component are generally seen as higher margin and more stable across industries. For instance, Aerospace & Defense companies that have a strong "Aftermarket" presence (which really means maintenance, spares, repairs, etc.) generally command higher valuations.

The SaaS hype just takes this to the ultimate level. Digital services have very little costs (relative to their physical counterparts). Recurring digital revenue equates to mind-boggling numbers like Salesforce having >70% gross margins, which is probably the most prominent reason why Tech valuations have skyrocketed in the cloud era

Re: Write libraries instead of services, where possible

#75
post #60

I don't hear people talk about the design side of services vs libraries enough, but I think it's a huge part of the picture. Many people reach for services too fast because they feel more comfortable thinking about APIs through the lens of HTTP verbs and resource URLs than they do in the comparatively infinite garden of options inside a program. The REST paradigm, despite most people not understanding, needing, or ut…

SOAP doesn't have anything like the restrictions rest has, does it?

Re: Write libraries instead of services, where possible

#77
I don't think there's a one size fits all solution here, and there are constraints that the author isn't seeing.

In favor of a service are cases where users want plugins, and the upstream doesn't want to maintain them. An example is anything that touches DNS, like cert-manager, external-dns, things like that. There are thousands of DNS hosts, and they each have their own API. So nobody wants to provide support for all of them out of the box -- the upstream maintainer's entire life will become approving PRs for obscure DNS services. The maintainer can't test them, because they don't have an account, so can't own the quality of the final product anymore. Therefore, nobody does this. Services are an answer to this problem -- the thing you actually want to use defines an API for DNS services, and the DNS provider gives you a program that can receive messages to update DNS, and everyone is happy. You just run it as a sidecar, and you can update it when your DNS provider changes their API, and update the other thing whenever they add a new feature that you want. The coupling is loose, so you don't get the same perfect reliability as a purpose-built "update foocorp dns whenever an ingress rule adds a hostname", but it's pretty good.

(I honestly don't know if this is actually how cert-manager and external-dns work. I use cert-manager and it builds in libraries for the DNS providers I use, with the caveat that they aren't accepting any more. I don't use external-dns, but I heard some rumblings about making a standard a few years back for this sort of thing. Didn't check in on the status of either. It's just a hypothetical example ;)

Libraries are unhelpful here because there are a billion programming languages, and the upstream provider will never choose your programming language of choice as their priority. Additionally, container builds are hard and I've never heard of anyone with a reliable way of taking some sort of upstream project and building it with local add-ons at every upstream commit, tagging stable versions in parallel with the upstream, etc. Definitely possible, but out of reach of the average container operator. Things like Go without dynamic linking (a feature I agree with, BTW), and container builds make services more critical for the plugin type use case. (My dream is to just write libraries in something that compiles to WebAssembly and use that to implement a plugin system in applications that need it. Some people are kind of sort of doing this; Envoy for example.)

On the other hand, sometimes you need the deep integration that only libraries can provide. It's popular to use sidecars to add network features like distributed tracing and mTLS; linkerd and Istio are examples. But these are exactly the use cases where you should use libraries instead of services. You need to see the TLS handshake so that your application can make authorization decisions based on the peer that you're connected to. To do distributed tracing, you need to copy the X-B3-Trace-Id header out of the incoming HTTP request into the outgoing HTTP request. Libraries can do that for you, but services can't.

In summary, the answer on library or service is "it depends". Hopefully this comment adds a little more nuance than the original article.

Re: Write libraries instead of services, where possible

#78

> A service has constant administration costs which are paid by the service provider. A properly designed library instead moves these costs to the users of the library. I agree with the articles point, but this introduction, right there, is why it's not happening. SaaS turns your startup into a unicorn and yourself into a rich person. Or at least that's what you are hoping/aiming for. A library is not going to make y…

One of the reasons smart contracts work so well is that they retain some of the properties of libraries yet are monetizable.

Re: Write libraries instead of services, where possible

#79
post #3

Earlier quoted context omitted.

You can sell a library just as well as any other piece of software I think.

Stealing a library is easier than stealing a service.

Including a stolen library you in commercial software that you distribute is easy to do but also easy to detect, so it only means that you're willing to pay a triple of the price in damages.

Re: Write libraries instead of services, where possible

#80
post #61
post #36

Counter argument, don't deploy your code on other people's hosts.

Got it, buy the cheapest possible 600$ server, pay 200$/month to collocate it (also do a cost benefit of different facilities), be responsible for all hardware failures and availability issues.

One issue I have seen in distributed systems is where a library is on another customer/teams hosts and brings them down due to a bug in the library. The other customer/team has no way to fix the bug and is dependent on getting the attention of the company/team who vended the lib in the first place. One I remember is where a library had a bug which created 0 byte files and exhausted the inodes causing an outage.

Cloud systems have become cheap enough and flexible enough that protecting your customers by not putting your bugs on their hosts is not as big as a lift as it used to be when you had buy bare metal servers or explicit VMs.

Post reply on HN