← Winnitude! Search  ·  Reader Mode (2760 ms)
Links: Stay in Reader Retro Site Converter Retro Mode: OFF Original Page ↗
GITHUB · 106 LINKS

Comments · Pull Request #20 · javascript-tutorial/ro.javascript.info

Repository navigation

Comments - #20


Merged
lighthousand merged 2 commits into master from unknown repository Aug 14, 2019
Merged

Comments #20 lighthousand merged 2 commits into master from unknown repository

Conversation

ghost commented Aug 7, 2019



Copy link Copy Markdown

No description provided.

Comments ef12705 javascript-translate-bot added the review needed label Aug 7, 2019 javascript-translate-bot requested a review from a team August 7, 2019 17:30 iliakan mentioned this pull request Aug 7, 2019 Romanian Translation Progress #1 Open lighthousand reviewed Aug 8, 2019
View reviewed changes
Comment thread 1-js/03-code-quality/03-comments/article.md
Outdated
După cum știm din capitolul <info:structure>, comentariile pot fi pe o singură linie: începând cu `//` sau pe mai multe linii : `/* ... */`.

We normally use them to describe how and why the code works.
Noi le folosim în mod obișnuit pentru a descrie cum și de ce codul funcționează.
lighthousand reviewed Aug 8, 2019
View reviewed changes
Comment thread 1-js/03-code-quality/03-comments/article.md
Outdated
## Comentarii rele

Novices tend to use comments to explain "what is going on in the code ". Like this:
Începătorii tind să utilizeze comentariile pentru a explica "ce se întâmplă în cod ". Ceva de genul:
lighthousand reviewed Aug 9, 2019
View reviewed changes
Comment thread 1-js/03-code-quality/03-comments/article.md
Outdated
```

Now we can understand the code easily. The function itself becomes the comment. Such code is called *self-descriptive *.
Acum putem înțelege codul mult mai ușor. Funcția în sine a devenit comentariul. Acest tip de cod se numește *autodescriptiv *.
lighthousand reviewed Aug 9, 2019
View reviewed changes
Comment thread 1-js/03-code-quality/03-comments/article.md
Outdated
```

Then it might be a better variant to refactor it into functions like:
O variantă mai bună ar fi să îl separi în funcții precum:
lighthousand reviewed Aug 9, 2019
View reviewed changes
Comment thread 1-js/03-code-quality/03-comments/article.md
Outdated
```

Once again, functions themselves tell what's going on. There's nothing to comment. And also the code structure is better when split. It's clear what every function does, what it takes and what it returns.
Încă o dată, însuși funcțiile ne spun ce se întâmplă. Nu e nimic de comentat. De asemenea, structura codului este mai bună când este împărțită. Este clar ce face fiecare funcție, ce primește și ce returnează.
lighthousand reviewed Aug 9, 2019
View reviewed changes
Comment thread 1-js/03-code-quality/03-comments/article.md
Outdated
Încă o dată, însuși funcțiile ne spun ce se întâmplă. Nu e nimic de comentat. De asemenea, structura codului este mai bună când este împărțită. Este clar ce face fiecare funcție, ce primește și ce returnează.

In reality, we can't totally avoid "explanatory" comments. There are complex algorithms. And there are smart "tweaks" for purposes of optimization. But generally we should try to keep the code simple and self-descriptive .
În realitate, nu putem evita în totalitate comentariile "explicative". Există algoritmi complecși. Și există și "încercări" deștepte cu scopul optimizării. Dar în general ar trebui să încercăm să păstrăm codul simplu și autodescriptiv .
lighthousand reviewed Aug 9, 2019
View reviewed changes
Comment thread 1-js/03-code-quality/03-comments/article.md
Outdated
Describe the architecture
: 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 diagram language [UML]( http ://wikipedia.org/wiki/Unified_Modeling_Language) for high-level architecture diagrams. Definitely worth studying .
Descrierea arhitecturii
: Oferă o vedere de ansamblu asupra componentelor, cum interacționează, care este ordinea de control în diverse situații ... Pe scurt -- ochiul de vultur al codului. Există o diagramă specială a limbajului [UML]( https :// ro. wikipedia.org/wiki/Unified_Modeling_Language) pentru diagrame de nivel înalt. Se merită studiul acestora .
lighthousand reviewed Aug 9, 2019
View reviewed changes
Comment thread 1-js/03-code-quality/03-comments/article.md
Outdated
Document a function usage
: There's a special syntax [JSDoc](http://en.wikipedia.org/wiki/JSDoc) to document a function: usage, parameters, returned value .
Documentarea utilizării unei funcții
: Există o sintaxă specială [JSDoc](http://en.wikipedia.org/wiki/JSDoc) pentru a scrie documentația unei funcții: utilizare, parametri, valoare returnată .
lighthousand reviewed Aug 9, 2019
View reviewed changes
Comment thread 1-js/03-code-quality/03-comments/article.md
Outdated
```js
/**
* Returns x raised to the n-th power .
* Returnează x șa puterea n .
lighthousand reviewed Aug 9, 2019
View reviewed changes
Comment thread 1-js/03-code-quality/03-comments/article.md
Outdated

If there are many ways to solve the task, why this one? Especially when it's not the most obvious one.

Apropo, multe editoare precum [WebStorm](https://www.jetbrains.com/webstorm/) le pot înțelege la fel de bine și să le folosească pentru a asigura autocompletare și verificărri automate ale codului.
lighthousand reviewed Aug 9, 2019
View reviewed changes
Comment thread 1-js/03-code-quality/03-comments/article.md
Outdated
Fără asemenea comentarii următoarea situație este posibilă:
1. Tu (sau colegul tău) deschizi codul scris acum ceva timp, și vezi că este "suboptimizat".
2. Te gândești: "Ce stupid am fost atunci, și cât de deștept sunt acum", și rescrii codul folosind varianta "mult mai evidentă și corectă".
3. ...Impulsul de a rescrie codul a fost bun. Dar în continuarea dezvoltării observi că "cea mai evidentă soluție" este actualmente insuficientă. Îți amintești cu greu de ce, deoarece ai testat-o acum mult timp. Te întorci la varianta corectă, dar timpul a fost pierdut.
lighthousand reviewed Aug 9, 2019
View reviewed changes
Comment thread 1-js/03-code-quality/03-comments/article.md
Outdated

Any subtle features of the code? Where they are used ?
: If the code has anything subtle and counter-intuitive, it's definitely worth commenting .
Orice caracteristică subtilă a codului? Unde este folosită ?
lighthousand reviewed Aug 9, 2019
View reviewed changes
Comment thread 1-js/03-code-quality/03-comments/article.md
Outdated
Any subtle features of the code? Where they are used ?
: If the code has anything subtle and counter-intuitive, it's definitely worth commenting .
Orice caracteristică subtilă a codului? Unde este folosită ?
: În cazul în care codul are ceva subtil sau neintuitiv, atunci este necesară comentarea .
lighthousand requested changes Aug 9, 2019
View reviewed changes

lighthousand left a comment



Copy link Copy Markdown
Member

Choose a reason for hiding this comment

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

Modifications needed

javascript-translate-bot added changes requested and removed review needed labels Aug 9, 2019

javascript-translate-bot commented Aug 9, 2019



Copy link Copy Markdown

Please make the requested changes. After it, add a comment "/done".
Then I'll ask for a new review 👻

Update article.md eb42c85

ghost commented Aug 9, 2019



Copy link Copy Markdown
Author

/done

javascript-translate-bot added review needed and removed changes requested labels Aug 9, 2019 javascript-translate-bot requested a review from a team August 9, 2019 14:30 lighthousand approved these changes Aug 14, 2019
View reviewed changes
javascript-translate-bot added needs +1 and removed review needed labels Aug 14, 2019 lighthousand merged commit 712a32a into javascript-tutorial : master Aug 14, 2019

javascript-translate-bot commented Aug 14, 2019



Copy link Copy Markdown

Thank you 💖 I updated the Progress Issue #1 🎉 🎉 🎉

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

Labels

needs +1

2 participants