<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Elliot Anderson</title>
    <description>The latest articles on DEV Community by Elliot Anderson (@elliot31878).</description>
    <link>https://dev.to/elliot31878</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F905575%2F2794880b-eafe-4efe-98a8-8f4d457bacde.jpg</url>
      <title>DEV Community: Elliot Anderson</title>
      <link>https://dev.to/elliot31878</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/elliot31878"/>
    <language>en</language>
    <item>
      <title>Clean Code (Comment)</title>
      <dc:creator>Elliot Anderson</dc:creator>
      <pubDate>Mon, 20 May 2024 11:00:37 +0000</pubDate>
      <link>https://dev.to/elliot31878/clean-code-comment-56c1</link>
      <guid>https://dev.to/elliot31878/clean-code-comment-56c1</guid>
      <description>&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsgi6gbbhk9h37og0d9en.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsgi6gbbhk9h37og0d9en.jpg" alt="Image description" width="800" height="375"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;clean code like an art or play an instrument.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;dirty code it's bring you to a conclusion in short time.&lt;br&gt;
but when your software enters in the market and users use your software you confront with huge amount of bugs and in is that time your code (complexity + dependency) equal to bankruptcy of a business or a group or company.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;your code must be tell your program story&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;generally  comments the less the better.&lt;br&gt;
when a person write comment for any class, function and etc&lt;br&gt;
he knows better then anyone, he's code is dumb and over time, he realizes this amount of confusion and frequent turns in his code.&lt;/p&gt;

&lt;p&gt;even write comment has rules you can't write any comment you like.&lt;/p&gt;

&lt;p&gt;Some good comments&lt;/p&gt;

&lt;h2&gt;
  
  
  Legal Comments
&lt;/h2&gt;

&lt;p&gt;Sometimes our corporate coding standards force us to write certain comments for legal&lt;br&gt;
reasons. For example, copyright and authorship statements are necessary and reasonable&lt;br&gt;
things to put into a comment at the start of each source file.&lt;/p&gt;

&lt;h2&gt;
  
  
  Clarification
&lt;/h2&gt;

&lt;p&gt;Sometimes it is just helpful to translate the meaning of some obscure argument or return&lt;br&gt;
value into something that’s readable. In general it is better to find a way to make that argu-&lt;br&gt;
ment or return value clear in its own right; but when its part of the standard library, or in&lt;br&gt;
code that you cannot alter, then a helpful clarifying comment can be useful.&lt;/p&gt;

&lt;h2&gt;
  
  
  TODO Comments
&lt;/h2&gt;

&lt;p&gt;t is sometimes reasonable to leave “To do” notes in the form of //TODO comments. In the&lt;br&gt;
following case, the TODO comment explains why the function has a degenerate implementa-&lt;br&gt;
tion and what that function’s future should be.&lt;/p&gt;

&lt;p&gt;Some bad comments&lt;/p&gt;

&lt;h2&gt;
  
  
  Mumbling
&lt;/h2&gt;

&lt;p&gt;Plopping in a comment just because you feel you should or because the process requires it,&lt;br&gt;
is a hack. If you decide to write a comment, then spend the time necessary to make sure it&lt;br&gt;
is the best comment you can write.&lt;/p&gt;

&lt;h2&gt;
  
  
  Journal Comments
&lt;/h2&gt;

&lt;p&gt;Sometimes people add a comment to the start of a module every time they edit it. These&lt;br&gt;
comments accumulate as a kind of journal, or log, of every change that has ever been&lt;br&gt;
made. I have seen some modules with dozens of pages of these run-on journal entries.&lt;/p&gt;

&lt;h2&gt;
  
  
  Position Markers
&lt;/h2&gt;

&lt;p&gt;Sometimes programmers like to mark a particular position in a source file. For example, I&lt;br&gt;
recently found this in a program I was looking through:&lt;/p&gt;

&lt;p&gt;//---------------- API FETCH ------------------------&lt;/p&gt;

&lt;p&gt;you can see any bad or good comments in linux project&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/torvalds/linux"&gt;https://github.com/torvalds/linux&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Developing or building software is like music. A musician can play an untuned instrument well in front of people and no one can understand the quality of the music. But a professional musician can easily notice your bad performance.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Conclusion : &lt;/p&gt;

&lt;p&gt;Generally if you work in the large team and you all have the same commenting rules and have some developers for updates your old comments can use commenting.&lt;/p&gt;

&lt;p&gt;But you should consider that if you are in a small or medium team, committing to a project can have serious consequences.&lt;br&gt;
You should consider that you have to do tasks such as bugs, updates, refactoring, adding new features, etc. and if all of these include commenting, you will completely destroy the productivity of the product system. you did and in the future that group will be doomed to failure.&lt;/p&gt;

&lt;p&gt;Thanks for reading.&lt;/p&gt;

&lt;p&gt;Regards Elliot :)&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Why use javaScript typed arrays</title>
      <dc:creator>Elliot Anderson</dc:creator>
      <pubDate>Sun, 19 May 2024 15:03:09 +0000</pubDate>
      <link>https://dev.to/elliot31878/why-use-javascript-typed-arrays-10b3</link>
      <guid>https://dev.to/elliot31878/why-use-javascript-typed-arrays-10b3</guid>
      <description>&lt;p&gt;First of all what is the is typed array&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Feakz2jampwl0rzb5c4x1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Feakz2jampwl0rzb5c4x1.png" alt="Image description" width="591" height="322"&gt;&lt;/a&gt;&lt;br&gt;
JavaScript typed arrays are array-like objects that provide a mechanism for reading and writing raw binary data in memory buffers.&lt;/p&gt;

&lt;p&gt;You can read more details from JS-TYPE-ARRAYS&lt;/p&gt;

&lt;p&gt;So when i read about js typed array i cant find answer about&lt;/p&gt;

&lt;p&gt;Why use it in our project and after searching a lot about it, I found an article and code about it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Type insurance
&lt;/h2&gt;

&lt;p&gt;Let’s suppose you want numeric, or specifically Uint8 values at some function for the purpose of analyzing or processing bytes. If a Uint8Array is passed to this function, then the function does not have to make safety checks and validations on the type and the code will be cleaner.&lt;/p&gt;

&lt;h2&gt;
  
  
  Nonverbal communication
&lt;/h2&gt;

&lt;p&gt;Other developers will have an easy time understanding what values such an array will contain, while an array with unspecified element type may contain “anything”.&lt;/p&gt;

&lt;h2&gt;
  
  
  Memory optimization
&lt;/h2&gt;

&lt;p&gt;Let’s suppose you are storing 1024 integer values in this array. If you use up a single byte per item, then you are using only 1 KB for the items of this array.&lt;/p&gt;

&lt;h2&gt;
  
  
  Example
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;Consider a clinic where there are 3 queues of patients, surface patients, critical patients and emergency patients, each of these queues are 10–20–30 long respectively, and there should not be more than these amounts of disruption in the queue and the clinic. How do you implement such a structure?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;We need 3 type arrays with the following names&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;    Superficial patients (Max Patients 10)&lt;/li&gt;
&lt;li&gt;    Critical patients (Max Patients 20)&lt;/li&gt;
&lt;li&gt;    Emergency patients (Max Patients 30)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;‍&lt;code&gt;const patientsBuffer = new ArrayBuffer(30);‍&lt;/code&gt;&lt;br&gt;
&lt;code&gt;const superficialPatients = new Uint8Array(patientsBuffer, 0, 10);&lt;/code&gt;&lt;br&gt;
&lt;code&gt;const criticalPatients = new Uint8Array(patientsBuffer, 0, 20);&lt;/code&gt;&lt;br&gt;
&lt;code&gt;const emergencyPatients = new Uint8Array(patientsBuffer, 0, 30);&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;console.log(emergencyPatients.byteLength); // 10&lt;/code&gt;&lt;br&gt;
&lt;code&gt;console.log(emergencyPatients.length); // 30&lt;/code&gt;&lt;br&gt;
&lt;code&gt;console.log(criticalPatients[0]); // 0, the initial value&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;As you have seen, we were able to create arrays by using ArrayBuffer &amp;amp; Uint8Array , which in the first step is the optimal use of memory storage.&lt;br&gt;
second stage&lt;br&gt;
The limit of the range of each queue&lt;br&gt;
The third step is the readability and cleanliness of the code.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Use array-typed Optimize your program and Enjoy Coding
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Thanks for reading this short article.&lt;br&gt;
Elliot .&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
