Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
也就是说,在这些词的一般编程意义上。
据我了解,两者似乎都是导入的外部代码集合,用于在项目中抽象编程并使其更容易。您不能像在库中那样调用服务中的方法吗?我还看到了一些关于面向服务编程的东西,这让我有点困惑。
服务通常在单独的服务器上运行,您通过使用协议与其通信来使用服务的功能,例如对 Web 服务的 HTTP 请求。
另一方面,库是直接集成到您自己的代码中的代码。
但是,库和服务都应该为您提供稳定的、文档齐全的界面,并且在这个意义上它们是相似的。