
Ask HN: What was your “eureka” moment while programming? - minionslave
My Eureka moment was when I figured out what interfaces were for.<p>I never understood the difference between interfaces and abstract classes. I asked on online forums and stackoverflow the typical answer I got was: &quot;An interface is a contract that you define... A class has to implement the methods defined in the interface for it to work.&quot;<p>&quot;Why do I need to use a contract if I can can simply implement the call the methods directly? Why do I need that middle man&quot;.
I was working on a small web api project with Nancy,  MySQL lite was used initially, but,  I wanted to use a database like MySQL or PostgreSQL. The small project I was working on to learn Nancy needed refactoring. So, I asked myself &quot;What if I could swap database at will&quot;. That when all the concept of interfaces came together.<p>I could simply use an interface as a mediator, which mean defining methods inside an interface, as long as the code calling the database implements these methods, things will work fine.
======
hoodoof
Understanding how to pass functions.

For me this was more important than grasping object oriented programming.

The second deep insight was that programming is less about language syntax and
mostly an exercise in manipulating data into and out of common data structures
such as arrays and hashes.

~~~
minionslave
I what thinking about that the other day. Programmers are in the business of
transforming data.

It's just finding the easiest method to do so.

