Live data from Hacker News

Write libraries instead of services, where possible

catern.com

301–310 of 328 posts

Re: Write libraries instead of services, where possible

#301

Earlier quoted context omitted.

Complaining that subscriptions are a bad deal for me as a user is a valid, if weak, market signalling mechanism. And they are a bad deal, because with each subscription comes a business relationship you have to manage, which is annoying and prone to being forgotten (which is what many companies offering subscriptions, particularly the "less than coffee" types, are very much counting on). > Is it also miserable "fight…

> with each subscription comes a business relationship you have to manage, which is annoying and prone to being forgotten Though, this is one advantage of centralized services like Paypal and the iOS ecosystem. At any time, I can see the iOS apps that are auto-billing me and I can rescind the contract from that UI. I don't need to call anyone or hope their Cancel actually does anything. I don't need to watch my state…

> Nobody wants to buy a subscription yet the app transaction they want on their terms (e.g. buy once, never expire) presumably doesn't exist

It used to. The subscription model is pretty new and has only become common in the last decade or so (generously; it's probably even more recent). Buying a perpetual license to use a copy of software was the way to buy software up until fairly recently.

You can characterize this shift as malicious, as a result of corporate greed and a desire to protect IP. Or you can characterize it as simply companies struggling to generate stable, predictable revenue with the old model, and finding subscription revenue to be more healthy. Regardless, subscription models are new, not the long-time status quo.

> It's a pebble's throw from just complaining that you'd prefer if everything was free so that you could keep your hard earned money.

No, it's not, and it's disingenuous of you to suggest that's where people are going with this.

Re: Write libraries instead of services, where possible

#302

Earlier quoted context omitted.

sorry! so I'll clarify Elixir inherits a library called OTP from erlang which is a set of primitives for building massively concurrent systems. A Genserver is sort of like a Base Class for a object that runs as an independant process that plugs into OTP. By inheriting/implementing the Genserver behavior, you create an independant process that can be mounted in an OTP supervision tree which runs at the top of your app…

> there's very little hype behind it This isn't a knock against Elixir or the Erlang ecosystem but I would definitely say that Elixir gets a decent amount of hype. Each time a new release comes out it invariably shoots to the front page of HN.

And before Elixir, Erlang itself was a frequent visitor on the HN front page. Still is.

Re: Write libraries instead of services, where possible

#303
post #253
post #244

Earlier quoted context omitted.

This, a million times this! The app stores made the most sensible model extremely cumberstone! I want to buy a software and own it forever. On the other hand, forcing the developer to provide upgrades for free forever is not sustainable. Maybe there is a clever way to work around this issue using in app purchases ...

You are overthinking it. A lot of software just doesn't need elaborate updates. For one utility app that I sell, I just build a new version every couple of years when it's no longer compatible with the latest OS, and people still buy it. There really is no need for updates for some apps. If there is demand for updates (eg. because customers want new features), then you can just sell it as a new app. People who want t…

I don't think that's really the same concept, though.

Yes, a utility app might be "done" at some point and only need updates when the App Store requires you to build against a newer iOS SDK. Fine. But many apps go through large changes over time and accumulate large improvements that might be worth paying more for.

Selling a new major version as a new app is a clumsy experience for users. They need to find the new app, install it, somehow transfer all the data and settings from the old app to the new, and then delete the old app. Most of that isn't something the app author can automate or do for the user.

I agree that some people might "abuse" this sort of functionality to sell subscriptions without selling subscriptions. But so what? Under this imaginary App Store upgrade flow, the user could also choose to keep using the old version and not upgrade. That gives the user more choices, not less.

Re: Write libraries instead of services, where possible

#304
> But if you didn't have the service in the first place - if there was only the library, containing all the functions, doing whatever the service was supposed to do in the first place - you wouldn't have this problem. Users who don't upgrade would suffer whatever problem exists in the initial version of the library, and everyone else would be fine.

While I tend to prefer a library over a service where possible, there’s an implication I didn’t see mentioned: if your use case involves communication between library instances (or collaboration on shared data) at runtime, you might have to choose between requiring users to only run matching versions of the library (complicates library use) or implementing very strong backwards compatibility (preferable, but can seriously complicate iteration, especially during early stages).

Re: Write libraries instead of services, where possible

#305
post #137

Earlier quoted context omitted.

"REST" these days is a defacto code name for "(JSON?) calls over HTTP", with loosey-goosey adherence to anything close to what the original REST author meant. At this point, we might as well call it RPC-style organized calls over HTTP using JSON representations and defined by "Swagger" files. Likewise, most of SOAP was "RPC-style organized calls over HTTP (or TCP) using mostly XML serialization and defined by XSDs. Y…

I think JSON is an improvement over XML for RPC, though they are similar. Generic JSON serialization/deserialization is trivial for any language with arrays and string maps. With XML, are fields serialized as attributes or as tags? Unless you are doing something really weird, JSON tells you just to use a JSON object. And for lists: do you use a special like take for the items or do you skip the intermediate step and…

The main product I work on has a specification that dictates the use of SOAP/XML. So I'm probably more familiar with SOAP than REST (by which I mean JSON/HTTP). Although I don't really delve deep into the RPC code when it can be avoided.

The answer to pretty much all your questions is "depends on the schema". There are XSD (XML Schema Definition) files that you can use to define types. You can define sequences, etc.

Then you can define a WSDL (Web Services Description Language) file which describes the RPC operations, arguments, return types, etc.

After that, you can use something like gSOAP to generate C/C++ out of the WSDL and XSDs. I think Java has a lot more variety in turning a WSDL into code, but last time I looked on the Java side of things it was super confusing. None of the tools seemed to work well together. They would never shut up about beans, and there always seemed to be a bunch of tool specific annotations. Pretty disappointing, and definitely makes me lean towards REST for personal projects, if only from a KISS perspective.

My impression is that SOAP and XML could probably make a much more complex web service than REST (again, abusing the term to mean JSON/HTTP). But after having worked on a pretty confusing contract-first web service, I am kinda jaded about it.

Re: Write libraries instead of services, where possible

#306
post #82

Earlier quoted context omitted.

In general I agree with you. However: > For instance, Aerospace & Defense companies that have a strong "Aftermarket" presence (which really means maintenance, spares, repairs, etc.) generally command higher valuations. Not sure whether that's a good example, because that might just be exploiting some weirdness in how government projects get funding approval, and might not be relevant to the wider (and software) world…

A&D encompasses Commercial aerospace like OEMs and their suppliers which are unrelated to Defense spending. Another example are Automotive companies like heavy-duty vehicle parts manufacturers, which also benefit from higher Aftermarket exposure

Yes, that's a better example!

(I thought your initial point was good, just that the argument for it wasn't as strong as it could be.)

Re: Write libraries instead of services, where possible

#308
This reminds me one this section from The Art of Unix Programming

http://www.catb.org/esr/writings/taoup/html/ch04s04.html

> One consequence of the emphasis that the Unix programming style put on modularity and well-defined APIs is a strong tendency to factor programs into bits of glue connecting collections of libraries, especially shared libraries (the equivalents of what are called dynamically-linked libraries or DLLs under Windows and other operating systems).

>If you are careful and clever about design, it is often possible to partition a program so that it consists of a user-interface-handling main section (policy) and a collection of service routines (mechanism) with effectively no glue at all. This approach is especially appropriate when the program has to do a lot of very specific manipulations of data structures like graphic images, network-protocol packets, or control blocks for a hardware interface. Some good general architectural advice from within the Unix tradition, particularly applicable to the resource-management challenges of this sort of library is collected in The Discipline and Method Architecture for Reusable Libraries [Vo].

>Under Unix, it is normal practice to make this layering explicit, with the service routines collected in a library that is separately documented. In such programs, the front end gets to specialize in user-interface considerations and high-level protocol. With a little more care in design, it may be possible to detach the original front end and replace it with others adapted for different purposes. Some other advantages should become evident from our case study.

>There is a flip side to this. In the Unix world, libraries which are delivered as libraries should come with exerciser programs.

>APIs should come with programs, and vice versa. An API that you must write C code to use, which cannot be invoked easily from the command line, is harder to learn and use. And contrariwise, it's a royal pain to have interfaces whose only open, documented form is a program, so you cannot invoke them easily from a C program — for example, route(1) in older Linuxes. -- Henry Spencer

>Besides easing the learning curve, library exercisers often make excellent test frameworks. Experienced> Unix programmers therefore see them not just as a form of thoughtfulness to the library's users but as an indication that the code has probably been well tested.

>An important form of library layering is the plugin, a library with a set of known entry points that is dynamically loaded after startup time to perform a specialized task. For plugins to work, the calling program has to be organized largely as a documented service library that the plugin can call back into.

Re: Write libraries instead of services, where possible

#310

Write libraries AND services, where it makes sense. I wrote a Python library to scrape google news [0] We also have it as a service [1] Want to know why? Because devs who can't pay won't pay. Businesses who can pay will rather pay for a service (API in our case), and not care about maintaining it. [0] https://github.com/kotartemiy/pygooglenews [1] https://newscatcherapi.com/google-news-api

How does the liscence agreement with Google look like, you just pay per Query? Does Google prohibit caching? Just curious as I remember reading nightmare stories of companies basing their business model on Google services (maps).
Post reply on HN