Skip to content

83. Remove Duplicates From Sorted List#3

Open
hroc135 wants to merge 2 commits intomainfrom
sendahuang14-patch-3
Open

83. Remove Duplicates From Sorted List#3
hroc135 wants to merge 2 commits intomainfrom
sendahuang14-patch-3

Conversation

@hroc135
Copy link
Copy Markdown
Owner

@hroc135 hroc135 commented Jul 18, 2024

```

### Step 2
- Discordを見ていたら再起でもできそうということでやろうとしてみたが、なかなかうまくいかず、他の人のコードを見た。再起苦手、、
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

と思っていたら以下の説明が参考になりました
https://discord.com/channels/1084280443945353267/1261259843671687188/1262997002891821056

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

別に、ループも「仕事の引き継ぎ」だと思いますし、「部下」に仕事の依頼であるように思います。仕事の引き継ぎやループで Discord を検索すると例が出てくるように思います。
https://discord.com/channels/1084280443945353267/1195700948786491403/1197102971977211966

@colorbox
Copy link
Copy Markdown

良さそうに思います 👍

```

### Step 3
- 結局これに落ち着いたというコード
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

命名は、current がいいですかね。現在注目しているもの、くらいの意味でしかないので、そんだったら一文字でもよくないか、くらいの気持ちがあります。

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

そこは結構悩んだところです。styleguideに依ると、変数名はスコープの大きさに比例し、使用頻度に反比例するとのことなので、今回はcurとかcでもいいかなとは思いつつ、パッと見でわかりにくい名前をつける勇気が出ませんでした

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

日本語だったら、「これ」とか「このノード」とか言うと思うので node とかでいいと思いますね。あとは、先頭から読んでいってパズルにならないことかと思います。
https://discord.com/channels/1084280443945353267/1225849404037009609/1234206158630289450
https://discord.com/channels/1084280443945353267/1225849404037009609/1234192025826496703

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

discordの議論読みました。「パズルにならない」というのは読み手に負担をかけない、上から読んですんなりわかるようなコード、という風に理解しました。これができるようになるためには、Step2が終わった時点で一回記憶をなくして初めてそのコードを見るような気分になって吟味をすることが必要なんじゃないかなと思いました

Copy link
Copy Markdown

@hayashi-ay hayashi-ay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

良いと思います。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants