## DEV Community

Dan Netherton 👨‍💻

Posted on

# Every developers 'oh my god I get it' moment.

So recently, I've been working on my personal project cssgr.id using vanilla JS. The code uses a lot of different objects and arrays and I needed to use Array.reduce() for something.

For some reason, I've never quite understood how this method worked. Something inside my brain didn't quite grasp it, but...with a few (a lot of) console logs I finally got it working how I needed it to and moved on to my next task.

After coming back to the code the next day and reading through what I'd done previously, it just...clicked! I understood how reduce() worked! I finally grasped what it was doing with my data and why it returned the values it did. This is what I'm referring to in the title as the 'oh my god I get it' moment.

I remember having a similar experience when first using GIT and working with branches. I even had it when first learning how to nest rules in SCSS!

I'm really interested to know firstly, if anyone else has experienced these awesome moments during their work, and second, what it was for you that just 'clicked'!

Hey Dan,

As a newbie, I had one of these when I first realised that a nested for loop would execute completely every time the outer loop ran once! I literally stood bolt upright in front of my computer and the relief was incredible lol

Dan Netherton 👨‍💻

Sweeeeet Relieeffff. Nice. 👍🏻

Chris Raser

I remember the exact moment I understood recursion. I was sitting on this bench, and trying to wrap my head around this function:

``````(define sum (lambda (ls)
(if (null? ls)
0
(+ (car ls) (sum (cdr ls))))))

(sum '(8 6 7 5 3 0 9))

38
``````

I really had to struggle with the idea that the function added up the whole list without there being any variable that actually held that number.

At some point, my brain pictured a red carpet unrolling infinitely into space, and the light went on. The idea locked into place and I totally understood. I loved that class. (C211) It was a summer session, so it was warm days in flip-flops practicing my tuba, and evenings hanging out in the CS dept computer lab with the other students. Good memories.

Ben Sinclair

I think the toughest thing for someone who doesn't know it coming to this code is translating things from "car" and "ls" and "cdr" and so on. In fact, "define", "sum" and "if" are the only words here that are obvious to a newcomer.

Elkhan

Awesome piece of code to bring one back down to Earth. A-ha moment killer. 😉

Chris Raser

I was a music student at the time, so programming was completely new and amazing to me.

Meghan (she/her)

I just had this moment on Monday. I finally made an app that interacts with OAuth 2 and didn't use a library! I'd read all the wiki articles and seen the diagrams but for some reason it wasn't clicking. OAuth seemed so unnecessarily complicated and then I finally made something with it and it worked! I literally screamed out loud in excitement lol!

Sai gowtham

For reversing a string i used reduce method🤗

``````function strrev(str){
return [...str].reduce((acc,next)=>next+acc)
}
``````

Dan Netherton 👨‍💻

Nice!

Ross Henderson

Absolutely relatable! I struggled to understand loops and cursors in SQL, and eventually someone on Stack Overflow wrote one in a way I could kind of understand. But after using them for ages and knowing that they work, I realised "Oh my god, I actually know how this works now!".

Scott Hannen

One involved classes. I was just learning .NET and I was reading nothing but examples of classes as cars, with properties for headlights, methods for starting the engine, etc. I could understand the code but had no idea how it related to anything real I might write. So I asked a manager, and she introduced me to an experienced dev who printed out (this was early 20th century) examples of real production classes. It clicked, and was the first step on a long road.

The other was when someone showed me dependency injection using .NET. They didn't explain it. They just told me to follow the pattern of an existing WCF service to create a new one. So I did it first and understood it later. Then he explained to me what it was doing. When I saw how that changed the way to write a class, it was like flipping a light switch. I never wrote unit tests because my code was untestable, but it showed me how to write code that I could unit test.

That second one was after I had stagnated for a few years. It changed everything for me because it led to learning more principles which led to more and more. It was a catalyst.

Dan Netherton 👨‍💻

That's great! It's funny, I remember understanding how basic HTML worked many many years ago when a university lecturer printed it out for me too. You can't be some old fashioned paper sometimes.

henAutumn

Great Question Dan!

My "aha" moment came the first time i read someone else's code and actually understood it! I had cloned someone's repository because they did something cool and i wanted to create another version of it. I spent h o u r s just trying to grasp the flow, and then suddenly it just fell into place! I felt so awesome!!

Nana Yeboah

PHP developer here. Mine has to do with the first time I understood the concept of an API. When I started out the sound of API always sent some chills down my spine!

Eventually I decided I needed to understand it. Google to the rescue..... After a lot of reading here and there I eventually got it.

I tried the Github API and oh what a joy it was to see the JSON data returned on my browser screen.

I was like oh I get it now!!!!

William Mitchell

I still have these moments every now and then. My first was with MVC and MVVM. (When I did some android dev many years ago) The whole concept was just too confusing for me, but one day some lightbulb just switched on and suddenly I understood the concept without any issue!

My general amazement of programming started back in '94 when I first used QBASIC. Amazing how we can use plain english and magic happens inside a little metal box!

Neil Gall • Edited

A relatively recent one for me would be Erik Meijer talking about monads as just another way to do function composition. A whole world of imagined complexity fell away and I saw a beautiful simple thing for what it is.

Raja Asyraf

I was struggling to understand how unit testing works and why would I need that. I tried to read all the tutorials and discussion, but still could not get into my mind yet. Then, I just realized that I never tried to get it hands-on. So I picked one simple tutorial on PHPUnit and follow the steps. And that's the "oh my god I get it" moment for me to basically understand the unit testing. Conclusion is, read only is not enough, get our hands dirty and keep practicing until we get it.

jaredchesebro

As a scrappy developer I've had about one of those moments a month since the day I started coding websites. It's one of the most rewarding feelings when something you've struggled to understand just clicks. Often times it's when I walk away from a problem and come back to it that the answer reveals itself.

Donald Merand

Great question! Understanding recursion is the "whoa" that has had the biggest reverberation through my life on computers. I first learned it on Scheme/Lisp in college (where recursion is not just a good idea, it's the law!), but I still get a little bit of that thrill each time I use it in an algorithm in any language.

When I realized that in JavaScript testing "something == true" or " == false" isn't a correct test for "truthy" and "falsy" values.

More precisely : when I tried to understand why it didn't work, I stumbled upon the excellent series "You don't know JS", and read a little bit of it every minute of my train commute time.

(I started by the chapter Coercion, and quickly had to have a look on the previous ones about Types.

I ended up eating the whole series.

I also ended up not fearing reading (some parts of) ES standard to settle some doubts.

And now I'm starting to love JS instead of hating it, finally understanding how it goes.

Ted Hagos

I remember when I first realized that Java objects were like structs with functions (I was coding in C at the time), and that it was okay. My mind was stubbornly rejecting the idea that structs can contain functions in them; it was then that the other stuff in OOP started making sense to me