Skip to content

Commit 025cc58

Browse files
committed
feat(i18n): 1.03.03.article
1 parent 38b2508 commit 025cc58

File tree

1 file changed

+33
-33
lines changed

1 file changed

+33
-33
lines changed

1-js/03-code-quality/03-comments/article.md

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -117,64 +117,64 @@ Relitanya, kita tak bisa menghindar total dari komentar "penjelasan". Ada algori
117117

118118
## Komentar baik
119119

120-
Jadi, explanatory comments are usually bad. Which comments are good?
120+
Jadi, komentar penjelasan biasanya jelek. Komentar mana yang bagus?
121121

122-
Describe the architecture
123-
: Provide a high-level overview of components, how they interact, what's the control flow in various situations... In short -- the bird's eye view of the code. There's a special language [UML](http://wikipedia.org/wiki/Unified_Modeling_Language) to build high-level architecture diagrams explaining the code. Definitely worth studying.
122+
Jelaskan arsitekturnya
123+
: Sediakan overview tingkat-tinggi dari komponen, bagaimana mereka berinteraksi, apa aliran kontrolnya di berbagai situasi... Singkatnya -- gambaran umum dari kode. Ada bahasa spesial [UML](http://wikipedia.org/wiki/Unified_Modeling_Language) untuk membangun diagram arsitektur tingkat-tinggi yang menjelaskan kode. Sangat berfaedah untuk dipelajari.
124124

125-
Document function parameters and usage
126-
: There's a special syntax [JSDoc](http://en.wikipedia.org/wiki/JSDoc) to document a function: usage, parameters, returned value.
125+
Parameter dan kegunaan fungsi dokumen
126+
: Ada syntax spesial [JSDoc](http://en.wikipedia.org/wiki/JSDoc) untuk mendokumentasi fungsi: kegunaan, parameter, nilai kembalian.
127127

128-
For instance:
128+
Misalnya:
129129
```js
130130
/**
131-
* Returns x raised to the n-th power.
131+
* Kembalikan x yang diberi pangkat n.
132132
*
133-
* @param {number} x The number to raise.
134-
* @param {number} n The power, must be a natural number.
135-
* @return {number} x raised to the n-th power.
133+
* @param {number} x Angka yang mau dinaikkan.
134+
* @param {number} n Pangkat, harus angka asli.
135+
* @return {number} x hasil setelah pangkat n.
136136
*/
137137
function pow(x, n) {
138138
...
139139
}
140140
```
141141

142-
Such comments allow us to understand the purpose of the function and use it the right way without looking in its code.
142+
Komentar macam ini membolehkan kita memahami maksud fungsi dan memakainya dengan tepat tanpa melihat isi kode.
143143

144-
By the way, many editors like [WebStorm](https://www.jetbrains.com/webstorm/) can understand them as well and use them to provide autocomplete and some automatic code-checking.
144+
Oya, banyak editor seperti [WebStorm](https://www.jetbrains.com/webstorm/) bisa memahami mereka juga dan memakai mereka untuk menyediakan autocomplete dan beberapa pengecekan-kode otomatis.
145145

146-
Also, there are tools like [JSDoc 3](https://github.com/jsdoc3/jsdoc) that can generate HTML-documentation from the comments. You can read more information about JSDoc at <http://usejsdoc.org/>.
146+
Juga, Ada tool seperti [JSDoc 3](https://github.com/jsdoc3/jsdoc) yang bisa menggenerate dokumentasi-HTML dari komentar. Kamu bisa baca informasi lebih tentang JSDoc di <http://usejsdoc.org/>.
147147

148-
Why is the task solved this way?
149-
: What's written is important. But what's *not* written may be even more important to understand what's going on. Why is the task solved exactly this way? The code gives no answer.
148+
Kenapa tugas ini diselesaikan begini?
149+
: Apa yang tertulis itu penting. Tapi apa yang *tak* tertilis mungkin lebih penting lagi untuk memahami yang terjadi. Kenapa tugas ini diselesaikan tepat seperti ini? Kodenya tak memberikan jawaban.
150150

151-
If there are many ways to solve the task, why this one? Especially when it's not the most obvious one.
151+
Jika ada banyak cara menyelesaikan tugas, kenapa harus ini? Apalagi ini belum jelas.
152152

153-
Without such comments the following situation is possible:
154-
1. You (or your colleague) open the code written some time ago, and see that it's "suboptimal".
155-
2. You think: "How stupid I was then, and how much smarter I'm now", and rewrite using the "more obvious and correct" variant.
156-
3. ...The urge to rewrite was good. But in the process you see that the "more obvious" solution is actually lacking. You even dimly remember why, because you already tried it long ago. You revert to the correct variant, but the time was wasted.
153+
Tanpa komentar macam ini situasi berikut memungkinkan:
154+
1. Kamu (atau kolegamu) membuka kode yang ditulis kapan hari, dan melihat bahwa ini "suboptimal".
155+
2. Kamu berpikir: "Koq bego ya saya waktu itu, dan lihat betapa pintar saya sekarang", dan menulis-ulang menggunakan varian yang "lebih jelas dan benar".
156+
3. ...Urgensi menulis-ulang itu bagus. Tapi di proses yang kamu lihat adalah solusi "lebih jelas" tersebut jadi minus. Kamu bahkan agak lupa kenapa, karena kamu sudah mencobanya di masa lalu. Kamu balikkan ke varian yang benar, tapi waktumu terbuang percuma.
157157

158-
Comments that explain the solution are very important. They help to continue development the right way.
158+
Komentar yang menjelaskan solusi itu penting. Mereka membantu melanjutkan pengembangan ke arah yang benar.
159159

160-
Any subtle features of the code? Where they are used?
161-
: If the code has anything subtle and counter-intuitive, it's definitely worth commenting.
160+
Ada fitur halus dari kodenya? Di mana mereka dipakai?
161+
: Jika kodenya punya sesuatu yang halus dan kontra-intuitif, itu sudah pasti bagus untuk dikomentari.
162162

163163
## Kesimpulan
164164

165-
An important sign of a good developer is comments: their presence and even their absence.
165+
Tanpa penting dari pengembang yang baik ialah komentar: kehadiran mereka dan kealfaan mereka.
166166

167-
Good comments allow us to maintain the code well, come back to it after a delay and use it more effectively.
167+
Komentar yang baik membuat kita memelihara kode lebih baik, kembali ke situ setelah delay dan memakainya secara efektif.
168168

169-
**Comment this:**
169+
**Komentari ini:**
170170

171-
- Overall architecture, high-level view.
172-
- Function usage.
173-
- Important solutions, especially when not immediately obvious.
171+
- Arsitektur keseluruhan, pemandangan tingkat-tinggi.
172+
- Kegunaan fungsi.
173+
- Solusi penting, terutama yang masih belum jelas.
174174

175-
**Avoid comments:**
175+
**Hindari komentar:**
176176

177-
- That tell "how code works" and "what it does".
178-
- Put them in only if it's impossible to make the code so simple and self-descriptive that it doesn't require them.
177+
- Yang menjelaskan "bagaimana kode bekerja" dan "apa kelakuannya".
178+
- Menaruh mereka hanya jika sudah tak mungkin menyederhanakan kode dan menjelaskan diri sendiri yang mana itu tak dibutuhkan.
179179

180-
Comments are also used for auto-documenting tools like JSDoc3: they read them and generate HTML-docs (or docs in another format).
180+
Komentar juga dipakai untuk mengotodokumentasikan tool seperti JSDoc3: mereka membacanya dan menggenerate HTML-docs (atau docs di format lainnya).

0 commit comments

Comments
 (0)