> Competition at larger scales naturally breeds cooperation at smaller scales because in order for a group to effectively compete with another group (large-scale competition), there must be cooperation within the group.
> Cooperation can also breed competition since sometimes the best way for the group to achieve its shared goals is to facilitate some healthy competition among its subgroups.
The concepts an architect works with all day are likely to be modules, components, connectors, stakeholders, evaluation, analysis, documentation, views, modeling, quality attributes, business goals, and technology roadmaps.
The concepts an implementer works with all day are likely to be objects, methods, algorithms, data structures, variables, debugging, statements, code comments, compilers, generics, operator overloading, pointers, and build scripts.
API 名称和文档与具体行为匹配就好,不要给调用方错误的预期,剩下的如何处理就是调用方的责任了
此外不要把异常用成正常业务的流程控制手段
如果调用方的预期是总能得到正确的结果,则在无法满足外部期望的时候,应该 throw,尽早暴露问题并修复
如果调用方的预期是有些情况无法计算,则调用方应该用 Tester-Doer Pattern,或者调用返回 Option.Some / Option.None 的 API,无法计算作为正常业务场景,由调用方用 if else 去控制流程
至于性能,只要不是运行时频繁抛出来,几乎不可能成为性能瓶颈
如果你不是天才,就老老实实上 profiler 找瓶颈有针对性地去调,先学会走,再去学跑