Ask HN: As a developer what are your aha moments?

125 points by greenleaf3 ↗ HN
To me the aha moments where as follows:

1. When I was introduced to QBasic

2. When I got to know how simple and amazing Lisp is

3. When I was able to code at the speed of my thoughts with VIM

4. When I got to know Express.js (after learning Django)

5. When I knew that everything in Smalltalk is a message including if else statements

188 comments

[ 4.0 ms ] story [ 233 ms ] thread
When I learned what a kernel was, and the implications of proprietary closed source kernels, I was instantly radicalized to the cause of gnu and libre software.
When react/redux finally "clicked" in my head. Coming from an MVC world it was quite a paradigm change.
Same here. The first time I added a spinner animation while secondary data was being fetch was an eye opener.

Although, I have a growing dislike for Redux.

What don't you like about Redux (genuine question)? I find myself using useState and useReducer a lot more recently, but I still think redux, or at least the pattern of having actions/reducers/dispatchers/selectors the best way to approach state in the UI
When I actually understood the idea behind functional programming, specially being able to think in the form of recursive functions than loops.
My favorite all-time aha moment was coming from a CVS world and learning how to use git. Oh, you just hash the entire lot of the files together and use that as a version for the repo? Aha! The change set should be for all the files together!
Trying to master non-framework CSS and realizing how dead simple styling a website can be when you are using a framework instead of trying to reinvent the wheel all over.
What is your favorite CSS framework/s?
Bootstrap - my one and only experience with a CSS framework. Love it, but can't compare to anything yet.

I'll properly give Bulma, Tailwind or another popular framework a go for my next project - let me know if you can recommend any other.

1. When I understood everything that happened in a custom chart with d3 I created, including d3 patterns, animation, svg, everything else just paled in comparison.

2. When I gave into Power BI finally and fixed a report someone else created, it felt so good. I don't think there is anything that compares to it and I only scratched the surface.

this is on my bucket list! I have managed to get by using either simpler libraries such as chart.js or adapting the data of an already-made chart so far.

What would be a good resource that helped you get to that aha moment ?

1. When I realized programming was hard

That’s it. For a long time I thought I was good at programming and I kept making the same mistakes over and over. All nighters, leet coding, runtime hacks, etc...

And then one day it struck me. It’s hard and my mind can’t keep up with yesterday’s cowboy coding.

Slowly I started putting defense mechanisms everywhere - good type systems, immutability, compile type instead of runtime, never overwork and sleep the best I can.

Life is much better now and I'll never go back to thinking I'm good at programming.

> good type systems, immutability, compile type instead of runtime, never overwork and sleep the best I can

I agree with you on this.

I figured it out in another incidence. I was in my first year as programmer, and I believed I was a pretty good one.

I remember I was hanging around in a small computer book store, and there was a big book of 'code complete 2' there. I have totally no idea what's that, just opened it out of interest, and I remember I flipped to a chapter about how to write a good 'if else'. And I was like 'holy crap, I wasted my entire life, I never thought in that way, I must be the rookiest rookie in the entire programmer world'. I immediately purchased the book, and that indeed helped me a huge deal in the career.

similarly: realise that i can only think about a small number of things at once. so try to structure things to separate concerns so that i get to avoid thinking about nearly all things when working on any given part of the system. a lot easier said than done.
> I started putting defense mechanisms everywhere

Just weeks ago, the software I had just finished writing complained to me at first run that I had forgotten to configure a setting. Defensive coding ftw.

> never overwork and sleep the best I can

Your best work can be done while not at your desk. Don't mind taking frequent breaks.

How did this work - genuinely curious? If you work as a team did everyone else stop being a cowboy too then pay down that tech debt? Or is this solo work or perpetual greenfield work?
It’s a bit more complicated than I made it look of course. My bit didn’t flip in a day and the reason why I changed my ways was also because I've worked with a few people that seemed to have figured this out already and just by observing them I could figure it out myself.

Nowadays it really depends, some people for sure get it more than others. Some just dismiss a lot of the safeguards I value as some kind of functional programming hype. Teams are hard :)

Paraphrased famous CS quote from somewhere: "The sooner you acknowledge that you cannot fit the entire thing into your head, the sooner you can start factoring that acknowledgment into your design."
When I watched a world class software engineer build a real time data processing platform using only functional programming.

At a major company, over ten teams were automated in a year.

Beautiful and useful abstractions around data and data processing tasks that provided extreme value.

I could never replicate it, but it reminded me about the power of software and the extreme ability that some have to weird it.

(comment deleted)
Could you share the video you mentioned?
If someone is given the freedom to think and apply it can be amazing. Most companies don’t support this though. This was my experience early on in my career - hardly anyone wants to let coders think, instead it’s about fitting in to the processes. Not saying I’m that clever just common sense stuff. Like err let’s not get 3 people to simultaneously build 3 similar screens in the app.
the moment that I realised what a syscall is.
1. The first language I ever used/learned was batch to script things in windows. When I learned python shortly after I recall it taking quite a bit of convincing myself to accept/use the "magic" of control flow being able to automatically jump back after a function returned as I was so used to manually wiring up all my gotos (was more of a painful experience than an 'ah-ha' I guess...)

2. When I was going through Tim Roughgarden's Algorithms course and saw the derivation of runtime complexity for mergesort and finally understood/visualized what a logarithm actually did (in school it was just taught as some rote function to help you manipulate eqautions of the form y=b^x)

3. Learning how TCP works from the bottom up. I think the biggest aha moment was when the textbook I was reading explained the TCP algorithm as a state machine that's just running on the client and server machines with the rest of the underlying network just forwarding packets, i.e. "pushing the complexity to the edge of the network".

4. Working through the nand2tetris project resulted in a lot of "oh X is just basically this at its core"

5. When going through a textbook explaining how relational database engines were implemented and seeing that they're essentially just using disk-persisted hash tables and self-balancing search trees to build indices on columns and make `select`s O(1)/O(log) time (I wasn't taught this in my uni's database course and assumed there was some fancy magic going on to make queries fast)

6. Realizing that I could just do a form of graph search/dependency resolution when learning a new codebase/trying to understand how a function works. I think before seeing someone do this in front of me I would usually just panic at the thought of "thousands of lines of code" rather than just "keep iteratively diving into the functions being called". Whenever I'm learning a new language, the first thing I'll do is setup the LSP plugin in vim so that I can quickly navigate up and down call graphs. Tbh I don't understand how some developers claim to not need this and instead just manually grep+open file in order to "jump to definition".

7. Forcing myself to derive the rotation logic for AVL trees. I was curious if, given just the high level properties of how an AVL tree behaves in order to guarantee O(log) time lookups, if I would be able to figure out all the rotation cases. Was a very rewarding exercise and something I plan on writing a blog post about (eventually...)

(edit)

8. Learning about the log data structure and how state can be replicated by replaying/executing this stream of transformations/updates.

>Working through the nand2tetris project

Done various sections of this and would heartily agree with how illuminating working through the project's been

1. When I realized that there's a thing called "computer science", and you can actually study things related to programming. It's not just ad hoc tricks written by experienced and bearded C programmers. You see, I'm self-taught from an early age, and learnt programming via skimming "VB for Dummies" when I was 8 y.o. or so. I didn't know anyone at all that knew how to program. It would take another decade before I met someone who knew how to program.

2. When I read K&R at the age of 14. Before that, I had just followed random tutorials that I found on the internet. From that point on, I went straight to the source (no pun intended) when it comes to learning new stuff.

When I found that interfaces/abstraction was way more critical to understand than recursion or obscure algorithms for most real projects. Half of the battle of starting (or understanding) any project is clarifying the interfaces in which one should be nestled.
Mid 90s, when I was introduced to Java after C++. With the combination of garbage collection vs malloc/free, and just seeing that Java gave you 80% of C++'s features with 20% of the complexity, I knew that it was going to be big and take over C++ as the language for company and enterprise development.
In the 90’s, as a teen I was reading the Amiga ROM Kernel Manuals to try to learn programming on the Amiga.

The section on graphics and UI described BOOPSI - an object-oriented way of constructing UI elements with inheritance, etc. Had never been exposed to that before and it blew my mind.

The moment when I first wrote my cgi/perl thingy and deployed my first website.
After going through Ben Eater's 8bit computer video course on YouTube. He builds a computer on breadboards. It is amazing.
Yea I would say the same about nand to tetris for me. I only discovered it after college I wish I had found it sooner
1. lisp

2. realising that its more about delivering than dreaming up the perfect abstraction (get it done).

3. what you think the user wants vs what the user thinks they want vs what the user actually wants vs what the user actually needs.

4. that there are always tradeoffs

5. building a product by yourself (whether on the side or starting up) will give you invaluable experience.

Becoming proficient with tools that allow me to pry into running processes and see what they are doing under the lid

e.g.

lsof to see files and ports opened up by a process

strace to look at what system calls to the Kernel by program is making (and ltrace for library calls)

pstree to see subprocesses spawned

gdb to inject myself into infinite loops of programs written in c-based implementations (e.g. Ruby)

I'm a collector of aha-ish moments so if you want more, my YouTube account is linked to in my profile.

A few that come to mind:

- Implementing small languages, and how it inevitably leads one to a deeper understanding of all the layers that make computing and programming possible

- The Make-a-Lisp project and the language-agnostic conceptual design at the heart of it - https://github.com/kanaka/mal/blob/master/process/guide.md

- Declarative nature of React (the view as function of state); using centralized unidirectional state management and actions

- Test-driven (and, similarly, type-driven) development

- TypeScript - Benefits and costs of type definitions, dynamic/gradual and structural typing; power of a language integrated with the editor environment

- Virtual machines, QEMU, and later Docker - Commoditized, reproducible builds for applications and their environments

- Build pipeline scripts

Writing a computer graphics engine during university taught me a couple:

1. I can use math, intuitively, even if I don't know how the exact calculation works.

2. I can use a debugger and replay it again and again to understand what's happening.

3. I can diagram a high level design and not have the complete context in mind and still produce a 10K LoC OpenGL powered computer graphics engine.

After that project, programming never felt impossible to me anymore. After that project, I always had some confidence of being able to learn whatever I needed, as long as I have enough time.

Here is the engine (2013): https://www.youtube.com/watch?v=PH6-dLvZEiA&t=1s&ab_channel=...

I had a similar confidence boost when I developed a Vulkan graphics engine. People talk about this library or that framework being hard to learn and use, but when you have struggled through Vulkan and 3d engine quirks, some of them seem like a walk in a park now.

So to answer the original question, my epiphany is that something being "hard" is a relative thing and that "hardness" should never be a barrier that keeps me from reaching my goals.

When I was introduced to Arc, it was the missing piece that completed LISP for me
My discovery of Clojure followed by my discovery of Ruby's Lisp roots.
When I stopped coding, and started thinking. Turns out hacked together stuff is slower to produce than thinking overnight and getting it right.
Reactive programming coming from OOP was it for me.