Write libraries instead of services (if possible)





The service involves constant administrative costs that the service provider has to bear. A properly designed library transfers all of these costs to its users.



This means that the library (if its use is possible) is able to provide the user with the same functionality, while costing the developer less than the service.



Typically, centralizing such administrative costs is considered a service advantage.

People say, "Services are easy to work with because they can be updated centrally so that slow-to-update users don't ruin the lives of others."



But this implies that users who don't update on time can influence everyone else. If one user cannot negatively influence other users, then we do not care how quickly individual users update; they only harm themselves.



You can prevent the negative impact of some users on others by not sharing the state of resources between users; in other words, avoiding services.



Let's take a common scenario as an example: a developer creates both a library and a service, but later discovers that the library (already released) contains some kind of bug or incompatibility, and it needs to be updated for everyone before improving the service. This becomes a big headache, because of which the developer can naively assume that the functionality needs to be transferred from the library to the service to facilitate updates.



But if you do not have a service at all, but only a library that contains all the functions and does everything that the service should do, then this problem will not arise at all. Non-upgrading users will suffer from problems existing in the original version of the library, and everyone else will be fine.



It is not always possible to avoid services in this way; but this is possible more often than is thought. Here are some ideas to consider:



  • , , . , , - , , Linux Kubernetes. , .



    , , .
  • , , . , ; , ยซยป.



    , , , . , :



    • ( )
    • ( )
    • (, , )
    • , (, ยซยป , )
    • ,


    , .
  • , . , โ€” .



    , , , . :





    , .
  • โ€” , , ( , JSON, ..).



    . , ; .
  • , . , , , , , .



    , , , . , .


Using this and other ideas, you can often create a library instead of a service.



By eliminating the maintenance and upgrade costs associated with services, libraries can contain more functionality, which benefits both the developer and the user.






Advertising



VDSina offers VDS for rent for any task, a huge selection of operating systems for automatic installation, it is possible to install any OS from your own ISO , a convenient proprietary control panel and a daily payment of a tariff that you can create individually for your tasks.






All Articles