构建您不会讨厌的API:回顾

tech2022-09-03  110

This is a review of Phil Sturgeon’s book Building APIs You Won’t Hate.

这是Phil Sturgeon的书“ 您不会讨厌的建立API ”的评论。

构建您不会讨厌的API (Building APIs You Won’t Hate)

A bit of an edgy title, isn’t it? It makes sense, though. The potential of a developer hating anything he built given enough time to work on it is enormous. It’s an inverse parabola of sorts – your enthusiasm will grow for a given amount of time, and then proportionally drop until you sink below the starting point of pleasure. If you push through this depression, learn new techniques, and then apply them to your work you get a kind of sine wave in which your enthusiasm again rises until it starts dropping, and so on and so forth.

有点前卫的标题,不是吗? 不过,这是有道理的。 如果有足够的时间来进行开发,那么憎恨他所构建的任何东西的开发者的潜力都是巨大的。 这是一种相反的抛物线–您的热情会在给定的时间内增长,然后成比例地下降,直到您沉迷于快乐的起点以下。 如果您克服这种抑郁症, 学习新技术 ,然后将其应用到您的工作中,就会产生一种正弦波,您的热情会再次上升,直到它开始下降,依此类推。

This book tries to help you make the climb along the parabola last as long as possible – its aim is to teach you some API development practices which make your APIs simpler, more robust, and more “people-who-are-not-you”-friendly.

本书试图帮助您尽可能长时间地沿着抛物线进行攀登–其目的是教您一些API开发实践,这些实践将使您的API更简单,更健壮,并使更多的“不是您的人” -友好。

写作风格和受众 (Writing Style and Audience)

Phil remains true to himself in a manuscript filled with humorous remarks, snarky comments, and practical examples. The chapters are well structured and fluidly presented with content breaks in just the right places, never making the book overwhelming or frustrating.

菲尔(Phil)的手稿充斥着幽默的言论,刻薄的评论和实际的例子,对自己仍然忠贞不渝。 这些章节结构合理,在适当的地方流畅地显示了内容,这些内容决不会使本书泛滥成灾。

The audience of the book is, I would argue, intermediate and senior level developers who want to improve their existing design or just seek advice on how to get started with proper API development before they turn it into a mess they’re already expecting it to be. You will have little to no use of the book if you’re a junior, but maybe buying it and keeping it in your Leanpub shelf wouldn’t be a bad idea for when you’ve got a couple more notches on your PHP club.

我认为,本书的读者是希望改进现有设计或只是寻求有关如何正确进行API开发的建议的中高级开发人员,然后再将它们变成已经期望的烂摊子是。 如果您是大三学生,则几乎不会使用这本书,但是如果您PHP俱乐部有更多特色,也许买下来并将它保存在Leanpub架子上并不是一个坏主意。

The one downside is that Phil can’t spell to save his life. And not just typos and the occasional apostrophical butchery:

缺点之一是菲尔无法拼命挽救他的生命。 不仅是错别字和偶尔的撇号屠杀 :

but also the cringeworthy grammar and at times milk-curdling phrasing. In typical Leanpub fashion, this is where the need for a professional editor really becomes obvious. Indie authors, I’m absolutely certain you know someone who studied English in at least some regard (and was relatively good) – ask them to read your work and correct it during writing, it’ll help loads. If you can’t find anyone, pay someone! Heck, I’ll do it for free, just send me your books.

而且还有令人畏惧的语法,有时还有挤牛奶的措辞。 在典型的Leanpub方式中,真正需要专业编辑的地方很明显。 独立作者,我绝对可以肯定您知道有人至少在某种程度上学习过英语(并且相对不错)–请他们阅读您的著作并在写作过程中进行更正,这将有助于您的学习。 如果找不到任何人,请付钱! 哎呀,我会免费的,只要把你的书寄给我。

This, though, is the only gripe I have with the book.

不过,这是我对这本书唯一的抱怨。

技术方面和内容 (Technical Aspect and Content)

Technically, this book excels on almost all levels.

从技术上讲,这本书在几乎所有水平上都表现出色。

The content is evergreen and bound to stay relevant for a while, with only the occasional reference to irrelevant operating systems and their package managers (OS X, Homebrew). These parts would have been better if replaced with a common Vagrant setup like Homestead or Homestead Improved in the book’s introduction, then demoing all further examples on it. Such an approach would have made the code parts more approachable to all readers, even keeping their URLs consistent, removing the need to mention home directories, example domains, etc. It’s a minor potential upgrade with a relatively minor positive reading flow effect, but still a potential upgrade.

内容是常绿的,并且一定会保持一段时间的相关性,仅偶尔引用不相关的操作系统及其软件包管理器(OS X,Homebrew)。 如果用本书介绍中的Homestead或Homestead Improvement这样的通用Vagrant设置代替这些部件,然后演示所有其他示例,则这些部件会更好。 这样的方法将使所有读者都更容易理解代码部分,甚至使其URL保持一致,无需提及主目录,示例域等。这是一个较小的潜在升级,具有相对较小的积极阅读流程效果,但仍然潜在的升级。

As someone who deals with other people’s APIs daily and is working on his own, I could appreciate all the tips within. Not only does Phil go out of his way to recommend excellent accompanying tools to use during development and debugging (and show their basic use), his examples are all real-world and based on his experiences working on a heavy duty API.

作为每天处理别人的API并独自工作的人,我将不胜感激其中的所有技巧。 Phil不仅不遗余力地推荐在开发和调试过程中使用的出色随行工具(并展示了其基本用法),而且他的示例都是真实世界,并且基于他在重型API上的工作经验。

Almost every chapter lists common approaches in designing a specific feature of an API and ends in a comparison of their pros and cons, usually culminating in the approach Phil took and preferred during his adventures. I found the authentication chapter particularly interesting, as that’s the only aspect of API development I’ve ever had problems with, though I would have preferred it to touch a bit more on the topic of ACL and role based control through the API request itself.

几乎每一章都列出了设计API特定功能的常用方法,并以它们的优缺点进行了比较,通常以Phil在冒险过程中所采用和偏爱的方法为最终结果。 我发现身份验证这一章特别有趣,因为这是我遇到过的API开发的唯一方面,尽管我希望它通过API请求本身来进一步涉及ACL和基于角色的控制这一主题。

Having been published a while back, the book’s Documentation chapter is missing RAML as an option, but the chapter is so filled with practical instructions and step by step examples it doesn’t even matter – learning on a practical, real world example of documentation far outweighs the benefit of just hearing about a newer concept.

该书的“文档”一章已经出版了一段时间,但缺少RAML作为选项,但该章充斥着实用的说明和分步示例,这甚至都没有关系–学习一个实际的,现实的文档示例胜过仅仅听到一个新概念的好处。

Content-wise, the only missing chapter is “Caching” and Phil acknowledges this in the book’s outro. Caching within the context of API development is an incredibly powerful topic, one I enjoyed hearing about in one of Ross Tuck’s talks at ZgPHP, and I do hope it’ll be added soon.

就内容而言,唯一缺少的章节是“缓存”,Phil在本书的开头部分承认了这一点。 在API开发的上下文中进行缓存是一个非常强大的主题,我在Ross Tuck在ZgPHP 的一次演讲中听到了一个有趣的话题 ,并且我希望很快能添加它。

结论 (Conclusion)

I’m giving the book a 4/5 with an elephpant killed off just because of the spelling and grammar and maybe a little bit because of the missing Cache chapter.

我给这本书提供4/5的评分,其中的elephpant只是因为拼写和语法而被淘汰,也许是因为缺少“缓存”一章而被淘汰了。

All in all, this book is a gold vein chock full of nuggets of valuable information and if you’re considering building an API for whatever purpose, give it a read. By the way, you can get it cheaper now – by using this link, the first 100 customers get a big discount.

总而言之,这本书充满了宝贵的信息,如果您出于任何目的考虑构建API,请阅读本书。 顺便说一下,您现在可以更便宜–通过使用此链接 ,前100个客户可以享受很大的折扣。

Did you read it? What did you think?

你读过它吗? 你觉得呢?

翻译自: https://www.sitepoint.com/build-apis-wont-hate-review/

相关资源:jdk-8u281-windows-x64.exe
最新回复(0)