Live data from Hacker News

Write libraries instead of services, where possible

catern.com

111–120 of 181 posts

Re: Write libraries instead of services, where possible

#111

If this isn’t obvious, we are lost. Creating a rest endpoint where a library would do is pure insanity.

And yet..

I wholeheartedly agree with your sentiment.

Unfortunately, the obvious economic incentive to effectively paywalling code through the Internet, is so strong that on this very website (that was supposed to have hacker mentality) most of the comments are in favour of it, because “you have to make a living”…

Yes, I think we are lost.

Re: Write libraries instead of services, where possible

#113

The difference lies in deployment. A library is a piece of code that you embed. A service is already deployed and configured, ready to use. Services provide a much nicer boundary for splitting responsibilities in any SaaS-like organization.

Agreed. Building libraries from multiple private repos is hell in comparison to just having each as their own service.

Re: Write libraries instead of services, where possible

#114
post #110

Libraries and services both have maintenance costs and upgrade impedance from clients. The costs might differ, but in my experience work out to about the same overall. The correct way to determine whether a piece of software should be a library or service is by examining its intended purpose and its dependencies. - If the software is dependent on another service or a data store, it should be a service: this provides…

It’s not an either or. As argued elsethread, it should arguably always be a library (though not necessarily a published one), and optionally (if needed) also a service that wraps the library.

Re: Write libraries instead of services, where possible

#115
post #98
post #85

I think this is roughly true, but at a BigCo it’s not really feasible/easy unless you have a monorepo or otherwise extremely good build/integration tooling to deal with many repos (though Go can sort of deal with this) The issue is coordinating changes (and, god help you, library releases) across repos is often an utter nightmare with multiple PR/merge builds

> it’s not really feasible/easy unless you have a monorepo or otherwise extremely good build/integration tooling to deal with many repos[...] The issue is coordinating changes [...] across repos is often an utter nightmare with multiple PR/merge builds I'm coming up on a year out of $BIG_TECH_JOB (where the idea of a monorepo was horrifying) and transferred to $WAY_SMALLER_NON_TECH_COMPANY_WHO_USES_TECH_JOB (where th…

What I’ve heard from friends working at places where the monorepo model has worked well, is that it also involved a culture shift such that the burden of upgrading the consuming services is put on the shoulders of the _providers_ of the library, rather than the consumers. This implicitly brings along some benefits, like making the providers not cause excessive/unnecessary version churn and ensuring easy upgrade paths, because they experience the pain rather than it being externalized onto the consumers :) Also, good tooling helps—and I think that this model also encourages investing in that.

Re: Write libraries instead of services, where possible

#116
post #27

It's all fun and games until you hit version n+1 or n+2, and often realize how slow many customers are to upgrade the library. Then there are the potential conflicts in your own dependencies. And let's not forget the occasional breaking change you introduced. You are now sacrificing the money saved by not hosting to maintain what will likely be a growing matrix of possible versions, underlying assumptions, and my per…

This is a completely broken model.

You are wrong by pushing your changes on "slow to update" customers. Customers know when to update much better than you do. If you are trying to update before they want to, you are doing them a disservice.

This attitude is inspired by the desire to sell more, and often times, it means to sell more unwanted crap, where customers are trapped by the "package deal", where they are either forced to update to gain useless features and the headache resulted from various inconsistencies and defects coming from the last update, or they are unable to get the product at all (because the provider cancels support or wouldn't sell older versions etc.)

In other words, you with straight face describe some really shady practice and you don't even realize how bad it sounds.

Re: Write libraries instead of services, where possible

#117
post #94

Earlier quoted context omitted.

This is making technology objectively worse to solve people problems, and this only expands. More software needs iron clad leadership and control. Any organization that lacks this can’t help but produce shit software. There has to be a single person with real decision making power than can force upgrades and prioritization of work, and they need to be able to axe people or teams who can’t hack it.

OK but most business compete in a market. And the people they employ are in a labour market. It seems that worse is better. What we see is just another manifestation of the current economic paradigm. Waste is winning. Making too many pairs of jeans so we burn tons of perfectly good new pairs daily wins. Throwing hundreds of engineers on problems bashing out hundreds of thousands of lines of code sending megabyte mess…

Most engineering orgs don’t understand or feel “the market” until mass layoffs. They exit their companies with beautiful resumes touting micro services and k8s.

Re: Write libraries instead of services, where possible

#118
post #27

It's all fun and games until you hit version n+1 or n+2, and often realize how slow many customers are to upgrade the library. Then there are the potential conflicts in your own dependencies. And let's not forget the occasional breaking change you introduced. You are now sacrificing the money saved by not hosting to maintain what will likely be a growing matrix of possible versions, underlying assumptions, and my per…

Yes you need to have n versions you support in parallel in the wild. One per released incompatible binary API (so in semver 1.x, 2.x etc). We support about 30 libraries with 5 ppl spread around a fortune 1000 org here and there. It’s quite tenable, we are just super strict regarding ticket policy and release notes, so we always know what’s released where. Just have a system. Stick to it. Keep things organized. Works like a charm. If someone wants a service out of those someone just packages them to docker and puts them to backemd somewhere. We can focus on pure business logic, someone else maintains services etc. Really nice setup.

Re: Write libraries instead of services, where possible

#119
post #36
post #27

It's all fun and games until you hit version n+1 or n+2, and often realize how slow many customers are to upgrade the library. Then there are the potential conflicts in your own dependencies. And let's not forget the occasional breaking change you introduced. You are now sacrificing the money saved by not hosting to maintain what will likely be a growing matrix of possible versions, underlying assumptions, and my per…

> It's all fun and games until you hit version n+1 or n+2, and often realize how slow many customers are to upgrade the library. How is that different with services? I don't develop services, but I can imagine that before breaking the services, you have to poll with your biggest customers and you don't break until they are ready to move to the new version. The alternative I can imagine is to keep providing the old se…

Simple answer is YOU control the deploy of a server in miroservices, so YOU decide when it goes live. You aren't playing spreadsheet telephone at scale to get everyone even im an internal org to update. If you're smart you have your callers send version information and you usually just add fields, only removals or renames cause version issues. If you're having everyone use a library they control when they update the logic and you have less telemetry when some wierd corner of your company is using out of date logic.

Re: Write libraries instead of services, where possible

#120

If this isn’t obvious, we are lost. Creating a rest endpoint where a library would do is pure insanity.

And yet.. I wholeheartedly agree with your sentiment. Unfortunately, the obvious economic incentive to effectively paywalling code through the Internet, is so strong that on this very website (that was supposed to have hacker mentality) most of the comments are in favour of it, because “you have to make a living”… Yes, I think we are lost.

If you have any feasible ideas that could plausibly work where people don't "have to make a living" so that we can find ourselves and not be lost, we're all ears. Until then we're stuck in a place where people need money to pay for frivolous things like "food" or "rent" or "transportation". Still, in the face of that, there's a site called GitHub where people do freely share code, despite the economic misincentives, so I think the kids will be alright.
Post reply on HN