DEV Community

dannohh
dannohh

Posted on

2 1

Reading, Writing, and Arithmetic Operators :)

Reading Code~

I think everyone would agree that the ability to read code is imperative to being able to write good code. It has been just recently that I personally have realized how "breaking down" code in my own words has helped me become a better aspiring developer and student.

How I read code~

In the beginning, I had heard that before you begin to write code, you should at least know how to read it. I thought that maybe the syntax or keywords may be the most important part of that process. It turns out I was wrong 👎

Don't get me wrong! Syntax and keywords are super important! However, the LOGIC behind syntax is what I really wanted to know...

As a soldier, it was imperative that complex concepts be "broken down" into smaller, easy to digest concepts so that every other soldier could understand, regardless of their education level. So when I read code to myself or out loud to anyone else, it looks like this.. ⬇️

A simple example

// a little JS

document.querySelector('div').addEventListener('click', myFunction);

In this short example code snippet, I try to take the entire idea into account and find myself asking the question

What does the dev want this code to do???

Look at the elements Dannohhh! Looks like we're working with some HTML elemnts! Sweet! I know a div element is about to be manipulated in some way. because we're "grabbing" it with a querySelector() method. Perfect, now lets do something with the div! Maybe we want to addEventListener?? YUP! moving on, what are we going to listen for? A CLICK event. And finally, what's going to happen after that 'click'? Well, it turns out that myFunction is going to happen!

So in my 🧠~

This says to me: Dannohhh, pay attention! This code is going to grab the 'div' element from the DOM, and listen for a click, when the div is clicked, myFunction will be executed! Likely causing AWESOMENESS to happen!

Thank you so much for reading and hopefully this helps someone!

How do YOU read code?

Hostinger image

Get n8n VPS hosting 3x cheaper than a cloud solution

Get fast, easy, secure n8n VPS hosting from $4.99/mo at Hostinger. Automate any workflow using a pre-installed n8n application and no-code customization.

Start now

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay