DEV Community

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

Dan Netherton 👨‍💻 on April 26, 2018

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 t...
Collapse
 
adamthewizard profile image
Adam

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

Collapse
 
dannetherton profile image
Dan Netherton 👨‍💻

Sweeeeet Relieeffff. Nice. 👍🏻

Collapse
 
craser profile image
Grumpy and

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.

Collapse
 
moopet profile image
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.

Collapse
 
elkhan profile image
Elkhan

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

Collapse
 
craser profile image
Grumpy and

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

Collapse
 
nektro profile image
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!

Collapse
 
sait profile image
Sai gowtham

For reversing a string i used reduce method🤗

function strrev(str){
return [...str].reduce((acc,next)=>next+acc)
}
Collapse
 
dannetherton profile image
Dan Netherton 👨‍💻

Nice!

Collapse
 
scottishross profile image
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!".

Collapse
 
scotthannen profile image
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.

Collapse
 
dannetherton profile image
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.

Collapse
 
henautumn profile image
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!!

Collapse
 
yeboahnanaosei profile image
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!!!!

Collapse
 
billgeek profile image
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!

Collapse
 
neilgall profile image
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.

infoq.com/interviews/meijer-monads

Collapse
 
rajaasyraf profile image
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.

Collapse
 
jaredchesebro profile image
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.

Collapse
 
dmerand profile image
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.

Collapse
 
lioobayoyo profile image
lioobayoyo • Edited

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.

Collapse
 
tedhagos profile image
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

Collapse
 
antonrich profile image
Anton • Edited

Yes I had that same with reduce (to be precise with foldl and foldr in Haskell). When it clicked it was such a wonderful feeling.

Reduce is very powerful stuff.

I think a couple days ago I got what a flip function means.

flip f a b = f b a

It's useful when you want to partially apply a function but the arguments are not in the place where they should be. You just flip them and that's it.

It didn't click until I saw a good example.

Collapse
 
apixelvisuals profile image
APixel Visuals • Edited

For me it would be implementing OAuth2 onto my website, along with learning the significance of async/await in NodeJS.

Collapse
 
threedeeprinter profile image
Dan Benge

Learning Linq along with Generics. I think a golden light poured out of my LCD when that all clicked. It helped me understand a lot about what was going on in Entity Framework too.

Collapse
 
presto412 profile image
Priyansh Jain

Oh for me it was python list and dict comprehension. I just couldn't stop using them no matter how hard I tried.

Collapse
 
sergeyzubov profile image
Sergey Zubov

Haven't had that sweet feeling in a while but I do remember it very well from first years in university.

First one was understanding very basics, at that moment even thought should I even be doing programming in my life. But at one moment it was "eurika" I understand variables, function calls, doing some math (do you remember how many times you have coded calculators?) etc.

Later same feeling came after getting beyond simple queries (you know: SELECT * FROM table). After first written join statement I understood why the heck you even need DB for real.

And it goes on and on, OOP, MVC and every other thing that now is just regular day at work.

Miss that warm, sweet, rewarding feeling. Not because I think that I understand everything just because somehow learning and understanding new stuff became daily routine.

Collapse
 
david_j_eddy profile image
David J Eddy

Yes, for me it was callback functions as as an argument to another function.

Collapse
 
nektro profile image
Meghan (she/her)

This is a very 🦄 article

Collapse
 
coolgoose profile image
Alexandru Bucur

For me my moment was when I understood this in a class and started viewing classes more than just a common name for functions.