Yudong Jin

Results 276 comments of Yudong Jin

新年快乐! 我没有读过这本书,想请教: - 书中对“单一职责”的定义是什么,以及它作用的单位是什么(类 or 方法)?是设计模式中的“单一职责(SRP)”么? - 比如这里的 `offerFirst()` , `offerLast()` , `offer()` ,三者是整体满足单一职责即可,还是要各自满足单一职责? - 如果两个方法有 50% 的相同步骤,50% 的不同步骤,那么使用 helper 方法来合并这些相同步骤,会违背单一职责么? `如果依赖标志位控制的方法,建议拆成多个方法` 如果有出处页码的话希望可以分享,想去学习一下~ 是的,本书没有采用工程上的注释规范,以换取更加紧凑的排版。

嗯嗯,所以就是 SRP 。 感觉我们对”只做一件事“的主语”事“的定义不同。你认为“队首入队”和“队尾入队”是两件事,而我认为“入队”是一件事,从中分出了“两种 case”。换言之,我将"入队"作为单一职责的评价单位。 另外,SRP 只是设计模式的一种,各种设计模式之间会互相影响,我们可能需要做出选择。 扫了一下这本书,有一段我和作者的想法一致。 > 书中 p9 提到: > 简单代码规则,依其重要顺序: > - 能通过所有测试 > - 没有重复代码 > - 体现系统中全部设计理念 > - 包括尽量少的实体,比如类、方法、函数等 > 在以上逐项中,**我最在意代码重复**。如果同一段代码反复出现,就表示某种想法未在代码中得到良好的体现。我尽力去找出到底那是什么,然后再尽力清晰地表达出来。“ 对于 deque...

Merged in #307 cause I can't push new commits to your repo. Thanks for the contribution!

@khoaxuantu Sorry that I missed this one. Plz review it, thx!

> Sorry, I forgot to switch to different branch for testing workflow. That's fine. I suggest you double-check all the changes after submitting the PR. It will help eliminate the...

This PR is closed because of no response from the author.

Hi, @K3v123 @yuelinxin @thomasq0 @Yucao-cy, We are working on standardizing the title format, including H1-H6 titles, figure titles, table titles, table header titles, class and method titles in code, etc....

> So this should only applies in titles, not in full text right? The full text is already formatted with first-letter capitalization. From this perspective, we want to apply the...

Thanks @K3v123 @thomasq0 @yuelinxin @RafaelCaso ! I've looked at the title format of several books. Most use "Title Case (capitalizing all the major words)", while some use "Sentence case (capitalizing...